ESP32 Rust Bare Metal (no_std) Multi Target Template
MIT License
Template project for creating interactive apps with Rust Bare Metal (no_std) on ESP32.
The template contains also WASM and Desktop version which could help with faster implementation of concepts.
Each target HW is in separate directory. Shared code is stored in engine
.
Use espflash 2.x
which supports also targets like ESP32-C6.
Installation:
cargo install espflash --git https://github.com/esp-rs/espflash.git
cargo generate https://github.com/georgik/esp32-rust-multi-target-template.git
cd project-name
cd wasm
npm install
npm run serve
Open in web browser: https://localhost:8443.
Note: https is required for access to accelerometer data - https://w3c.github.io/deviceorientation/#security-and-privacy . It's possible to run the app without accelerometer on http.
Control: IMU
cd esp32-s3-box
cargo espflash flash --release --monitor
Control: Not implemented
cd esp32-c6-devkit
cargo espflash flash --release --monitor
Control: IMU
cd esp32-c3-devkit-rust
cargo espflash flash --release --monitor
Control: keyboard
press arrows or W,A,S,D to move the character
press Enter to perform action
macOS prerequisites:
brew install SDL2
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
sudo zypper install SDL2-devel
cd desktop
cargo run
Control: buttons
cd esp32-s3-usb-otg
cargo espflash flash --release --monitor
Control: buttons
cd esp32-s2-usb-otg
cargo espflash flash --release --monitor
HW: https://docs.makerfactory.io/m5stack/core/fire/
Control: MPU-9250, buttons
cd m5stack-fire
cargo espflash flash --release --monitor
cd m5stack-fire
./run-wokwi.sh
cd m5stack-fire
./run-wokwi.sh
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
HW: https://shop.m5stack.com/products/m5stack-core2-esp32-iot-development-kit
Control: MPU6886
cd m5stack-core2
cargo espflash flash --release --monitor
Control: buttons (partialy implemented based on of https://github.com/espressif/esp-bsp/blob/master/esp32_s2_kaluga_kit/esp32_s2_kaluga_kit.c#L59)
cd esp32-s2-kaluga
cargo espflash flash --release --monitor
Note for older version 1.2 - GPIO6 is used to control backlight.
Control: limited, only one button available
cd esp-wrover-kit
cargo espflash flash --release --monitor
See tag v0.1.0.
cargo espflash flash --release --target xtensa-esp32s2-none-elf --features esp32s2_ili9341 --monitor
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"
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.