This workspace contains a collection of examples for the ESP32 using the esp-hal crate.
blinky: A simple example that blinks an LED.button_pressed: An example that demonstrates reading a button press.hello_world: A classic "Hello, world!" example that prints to the console.
These instructions are based on the guide Embedded Rust on the ESP32: Getting started - Setup.
espup is a tool to install and maintain the Rust toolchains for ESP32 development.
cargo install espupThis command will install the necessary toolchains, including the Xtensa Rust toolchain and the esp-idf build tools.
espup installAfter installation, espup will provide a command to set the required environment variables. You must add this command to your shell's startup file (e.g., .profile, .bashrc, or .zshrc).
The command will look something like this:
source $HOME/.cargo/envImportant: You need to restart your shell or source the startup file for the changes to take effect.
To build and flash a specific project within this workspace, navigate to its directory and use cargo-espflash. The espup install command should have already installed it.
cd blinky
cargo espflash flash --monitorThis command will:
- Build the project.
- Flash the resulting binary to the connected ESP32.
- Open a serial monitor to view the output.