This project is a Rust application targeting Espressif microcontrollers using the ESP-IDF framework.
It was created to act as a baseline for developing my personal projects using Rust on ESP devices.
- Written in Rust
- Message based architecture
- Exec Service for task management
- Easily extensible for your own IoT projects
- Rust toolchain (nightly recommended)
- cargo-espflash for flashing
- espup for installing ESP-IDF
- Python 3 (required by ESP-IDF)
- Supported Espressif board (e.g., ESP32, ESP32-C3, ESP8266)
- I have only tested a ESP32 board.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default nightly
rustup target add xtensa-esp32-espidfcargo install espup
espup installFollow the instructions to set up the ESP-IDF environment variables. this may include running a script like "export-esp.sh"
cargo install cargo-espflashcargo buildConnect your ESP board and run:
cargo espflash flash --baud 921600 -p {Your Serial Port} --monitorReduce the baud rate if you encounter issues.
To add your own functionality, you can create new modules and services within the src/services directory. Follow the existing structure to maintain consistency. New services can follow the template provided in src/services/led_test.rs. They should also be configured in the exec functionality located in src/exec/exec.rs.
new message types can be defined in src/messages.rs and handle them in your services.
For new services I recommend setting the stack size much higher than a typical C project as Rust tasks can use more significantly more stack space due to safety checks and abstractions. pushing values onto the heap can help reduce stack usage, as rust will manage the memory for you.