How to Use Rust for ESP32 Development

Install the xtensa target with rustup, build your project with cargo, and flash it to the ESP32 using espflash.

Use the esp-idf-sys crate with cargo to build Rust applications for the ESP32, configuring the toolchain via rustup and the xtensa target.

rustup target add xtensa-esp32-none-elf
cargo install espflash
cargo build --target xtensa-esp32-none-elf --release
espflash flash --monitor /dev/ttyUSB0

This installs the ESP32 target, compiles your code, and flashes it to the device using the espflash utility.