Welcome to the Simplified Embedded Rust: ESP Core Library Edition book repository. Here you will find all the book related resources. You can get a copy of the book here.
If you find any text errors, typos, or formatting issues in the book, please report a text error here so that it can be addressed in a later revision.
If you find any code issues in the book, please report a bug here so that it can be addressed in a later revision.
You are also welcome to suggest a feature here so it may be considered for content in the future.
This is a list of the project links containing the example source code for the ESP32-C3 and the ESP32. This covers both RISC-V and Xtensa architechtures. Apart from that, variations among devices for the examples in the book are minor. All projects were setup using VS Code as an editor. Each branch contains the same collection of code examples accomodated for the different ESP device. Click on the link for the device you desire to work with and clone that particular branch.
Device | Devkit | GitHub Links |
---|---|---|
ESP32-C3 | ESP32-C3-DevKitM-1 | ESP32-C3 Branch |
ESP32 | ESP32-Dev-KitC | ESP32 Branch |
Pre-wired project templates are provided to get you started with end of chapter questions. You can access all templates in the End of Chapter Questions Branch.
Questions that are not included would use exisiting book examples as templates. These are based on the ESP32-C3 device and would need to be rewired for other devices. If you notice a template missing or would like to request one, feel free to submit a feature request.
⚠️ As of January 2025, Wowki stopped supporting thestd
builder on it's web interface. While theno_std
builder is still supported on the web interface, an alternative beginner friendly option of using DevContainers and Wokwi with VSCode is introduced. With a few clicks in GitHub, Devcontainers enable the spawning of a full environment with all the book examples in a single workspace. Still, no need for any hardware and knowledge of Devcontainers is not required.
This is the recommended option for beginners as it is the quickest and easiest way to get started. The full environment will be setup in your web browser with a few clicks and without leaving this repository. All you have to do is click on the green "Code" button in the upper right corder then navigate to the codespaces tab and click "create codespace on [device name]". A tab will automatically open setting up the whole environment with the example projects for you.
If you prefer to develop locally with physical hardware, you can clone the examples locally and set them up to run on an external development board. The software required entails installing the nightly toolchain with the rust src component, modifying the target for cross-compiling in addition to installing flashing tools to download code to the external hardware. This includes the following
If you do not have Rust installed already, follow the instructions on the rustup website.
Run the following command in a terminal window:
rustup toolchain install nightly --component rust-src
Run the following command in a terminal window:
rustup target add riscv32imc -unknown -none -elf
Run the following command in a terminal window:
cargo install espflash
Afterward, the easiest way to flash an ELF binary, is to add espflash
as your Cargo runner. This way, when enterning cargo run
, the code would automaitcally perform the flashing after file generation. This is done by adding the following line to your .cargo/config.toml
file:
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "espflash flash --monitor"
When creating your own projects from scratch, it is highly recommended that you use cargo-generate
. Through cargo-generate
you can create new project templates pre-configured for any ESP device. Click on the link below for instructions to install and use cargo-generate
.
To install cargo-generate
run the following command:
cargo install esp-generate
Afterward, to generate a no-std
template run the following command:
esp-generate --chip=esp32c3 your-project
If you prefer to develop locally with Wowki (no hardware), you can clone the examples locally and install the following extensions for the simulator:
Afterward, you need to also configure your project for Wokwi using these instructions.
esp-generate
you can generate projects pre-configured for Wokwi skipping the second part after extension installation.
Options 2 and 3 are not recommended for beginners due to the added complexity and, in some cases, required installations.
This is a list of the components used in the different examples in the book. Acquiring these components is OPTIONAL and recommended only after you are comfortable with the material. You will only need these components if you are interested in doing physical hardware development at a later time (options 2 and 3 listed in the development options section earlier).
Component | Documenation | Purchase Links |
---|---|---|
Development Board (Choose one) | ESP32-C3-DevKitM-1 ESP32-C3-DevKit-RUST-1 |
ESP32-C3-DevKitM-1 (AliExpress) ESP32-C3-DevKit-RUST-1 (AliExpress) |
Female to Male Wires | N/A | AliExpress |
Prototyping Breadboard | N/A | AliExpress |
LEDs | Datasheet | AliExpress |
LED Bar | Datasheet | AliExpress |
Push Button | Datasheet | AliExpress |
Potentiometer | Datasheet | AliExpress |
NTC Temperature Sensor | Datasheet | AliExpress |
DS1307 | Datasheet | AliExpress |