Skip to content

Commit

Permalink
Unify different boards into target and switch to ESP-BSP-RS (#78)
Browse files Browse the repository at this point in the history
* refactor project structure to have one code for multiple targets
  • Loading branch information
georgik authored Dec 20, 2024
1 parent dc48159 commit 9216722
Show file tree
Hide file tree
Showing 107 changed files with 453 additions and 2,990 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-esp32-c6-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Integration for ESP32-C6
on:
push:
paths:
- "esp32-c6-devkit/**"
- "../../esp32-c6/**"
- "spooky-core/**"
- "spooky-embedded/**"
workflow_dispatch:
Expand Down
39 changes: 0 additions & 39 deletions .gitpod.Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions .gitpod.yml

This file was deleted.

20 changes: 0 additions & 20 deletions Disabled-Workspace.Cargo.toml

This file was deleted.

122 changes: 46 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,29 @@ The Teleport spell requires some time to recharge. There are some not friendly s
Binaries are available in [GitHub Releases](https://github.com/georgik/esp32-spooky-maze-game/releases).

Binaries can be flashed by:
- GUI [esp-helm](https://github.com/georgik/esp-helm)
- CLI [espflash](https://github.com/esp-rs/espflash) `espflash write-bin 0x0 spooky-maze-esp-wrover-kit.bin`
- Web browser (experimental) [ESP-Launchpad](https://georgik.rocks/wp-content/html5/esp-launchpad/?flashConfigURL=https://georgik.rocks/wp-content/esp32/esp32-spooky-maze-game/esp-launchpad.toml).

## IDE support

### CLion
### Rust Rover

Recommendation: Open only sub-directory with specific target with specific toolchain in CLion, because only one toolchain is supported for resolving code dependencies. Opening whole workspace works, just some code dependencies might not be resolved. This is also limitation of cargo, which supports only one toolchain per build.
Recommendation: Open whole project and attach to particular Cargo.toml for specific target.

## Build and flash

Install `espflash` which is required to flash and monitor the app on Embedded Device:

```
cargo install espflash
cargo install cargo-espflash
```

Enter the directory with project and build it:

```
cd esp-wrover-kit
cargo build --release
cd esp32-s3
cargo build --release --features esp32-s3-box-3
```

### Build binaries for all targets

The script builds all possible targets: support/ci/build-esp32-firmware.sh

## Wokwi simulation in VS Code

Open subdirectory with target in VS Code with installed Wokwi Extension. Select `Wokwi: Start Simulator`.
Expand Down Expand Up @@ -79,9 +72,10 @@ Overview:
| m5stack-core2 | esp32 | ili9341 | mpu6886 accelerometer | axp192 | |
| m5stack-cores32 | esp32-s3 | ili9342c | bmi279 accelerometer | axp2101 | aw9523 |
| m5stack-fire | esp32 | ili9342c | mpu9250 accelerometer | | |
| waveshare-c6-lcd-1-47| esp32c6 | ili9341 | | | |


### Build for ESP32-S3-BOX with ILI9486
### Build for ESP32-S3-BOX-3 with ILI9486


Control: IMU
Expand All @@ -90,8 +84,8 @@ Control: IMU
- move quickly down to place dynamite and destroy walls around

```
cd esp32-s3-box
cargo run --release --monitor
cd esp32-s3
cargo run --release --features esp32-s3-box-3
```

### Build for ESP32-C3-DeviKit-RUST with ILI9341
Expand All @@ -100,8 +94,8 @@ Control: IMU
- tilt board to move character

```
cd esp32-c3-devkit-rust
cargo run --release --monitor
cd esp32-c3
cargo run --release --features esp32-c3-devkit-rust
```

#### Features
Expand All @@ -111,6 +105,17 @@ cargo run --release --monitor
- Random maze generator
- IMU Accelerometer control

### Build for ESP32-C3-LcdKit

Control: rotary encoder
- rotate encoder to move the character
- press the encoder to switch the direction

```
cd esp32-c3
cargo run --release --features esp32-c3-lcdkit
```

### Build for desktop

Control: keyboard
Expand Down Expand Up @@ -144,8 +149,8 @@ Control: buttons
- press ok & menu to place dynamite

```
cd esp32-s3-usb-otg
cargo run --release --monitor
cd esp32-s3
cargo run --release --features esp32-s3-usb-otg
```

### Build for M5Stack-FIRE with ESP32 and ILI9341
Expand All @@ -158,41 +163,12 @@ Control: MPU-9250, buttons
- move quickly down or press button B to place dynamite and destroy walls around

```
cd m5stack-fire
cargo run --release --monitor
```

#### Build M5Stack-FIRE using GitPod.io and run with Wokwi

- Open in [GitPod.io](https://gitpod.io/github.com/georgik/esp32-spooky-maze-game)

```
cd m5stack-fire
./run-wokwi.sh
cd esp32
cargo run --release --features m5stack-fire
```

- Wokwi project: https://wokwi.com/projects/350825213595746900

#### Build M5Stack-FIRE using Codespaces and run with Wokwi

- Navigate to [GitHub repository](https://github.com/georgik/esp32-spooky-maze-game)
- Click Open, select Codespaces tab, click Create Codespace

```
cd m5stack-fire
./run-wokwi.sh
```

#### Build M5Stack-FIRE and run Wokwi in local VS Code

Preview: install VS Code Wokwi plugin (private beta available on request)

```
cd m5stack-fire
cargo build --release --no-default-features --features "wokwi"
```

Press F1, select Wokwi: Start simulation

### Build for M5Stack-Core2 with ESP32 and ILI9342C

Expand All @@ -204,8 +180,8 @@ Control: MPU6886
- move quickly down or press button B to place dynamite and destroy walls around

```
cd m5stack-core2
cargo run --release --monitor
cd esp32
cargo run --release --features m5stack-core2
```

### Build for ESP32-S2-Kaluga v1.3
Expand All @@ -219,8 +195,8 @@ Control: buttons (partialy implemented based on of https://github.com/espressif/
- (not supported) press K6 button to place dynamite

```
cd esp32-s2-kaluga
cargo run --release --monitor
cd esp32-s2
cargo run --release --features esp32-s2-kaluga
```

Note for older version 1.2 - GPIO6 is used to control backlight.
Expand All @@ -229,13 +205,22 @@ Note for older version 1.2 - GPIO6 is used to control backlight.

HW: https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html

Important: Requires `espflash 2.x` - install with `cargo install espflash --git https://github.com/esp-rs/espflash.git`
Controls: not implemented

```
cd esp32-c6
cargo run --release --features esp32-c6-devkitc-1
```

### Build for Waveshare C6 LCD 1.47inch

HW: https://www.waveshare.com/esp32-c6-lcd-1.47.htm

Controls: not implemented

```
cd esp32-c6-devkit
cargo espflash flash --release --monitor
cd esp32-c6
cargo run --release --features waveshare-esp32-c6-lcd-1-47
```

### Build for ESP Wrover Kit
Expand All @@ -247,26 +232,11 @@ Control: 6 push buttons
- press button Boot to teleport

```
cd esp-wrover-kit
cargo run --release --monitor
```

## Development

Following steps are useful for IDE integration, so that IDE can recognize which is your current target and fature set.

Check `target` configurad in the file `.cargo/config.toml`.
It should be one of following values:
```
target = "xtensa-esp32-none-elf"
target = "xtensa-esp32s2-none-elf"
target = "xtensa-esp32s3-none-elf"
target = "riscv32imac-unknown-none-elf"
cd esp32
cargo run --release --features esp32-wrover-kit
```

If no value is selected, make sure to specify target on command line.

Check default `features` in `Cargo.toml`. Make sure that default set contains your board and display combinations.

If no value is selected, make sure to specify features on command line.
## Board Support Package (BSP)

The project is using [ESP-BSP-RS](https://crates.io/crates/esp-bsp) which provides macros with preconfigured
GPIOs for a specific board.
16 changes: 0 additions & 16 deletions esp-wrover-kit/.cargo/config.toml

This file was deleted.

21 changes: 0 additions & 21 deletions esp-wrover-kit/.idea/runConfigurations/Run_esp_wrover_kit.xml

This file was deleted.

28 changes: 0 additions & 28 deletions esp-wrover-kit/Cargo.toml

This file was deleted.

Loading

0 comments on commit 9216722

Please sign in to comment.