Building & Testing

Commands for building the firmware, flashing it, and running the host-side tests and linters. For an end-user flashing guide see Flashing the Firmware.

Toolchain setup

The Rust toolchain is pinned to channel = "esp" in rust-toolchain.toml. The target is xtensa-esp32-espidf with ESP-IDF v5.5. Install the toolchain with espup:

cargo install espup --locked
espup install
cat $HOME/export-esp.sh >> ~/.bashrc
source ~/.bashrc
cargo install cargo-generate espflash ldproxy

Build & flash

cargo build                       # debug build
cargo build --release             # release build

cargo run                         # flash + monitor (espflash runner in .cargo/config.toml)
cargo espflash flash --monitor    # alternative

Unit tests

The platform-independent modules are tested on the host (x86), not on the ESP32:

cargo test --lib --no-default-features --target x86_64-unknown-linux-gnu

Linting

cargo fmt --all -- --check
cargo clippy --all-targets --all-features --workspace -- -D warnings