Espressif provides a C-based development framework called esp-idf which has support for all Espressif chips starting with the ESP32; note that this framework does not support the ESP8266.
esp-idf in turn provides a newlib environment with enough functionality to build the Rust standard library (
std) on top of it. This is the approach that is being taken to enable
std support on ESP devices.
In order for applications targeting
std to be built for ESP devices, two things are required:
- LLVM/Clang support
- Support for the device in
Refer to the table below to see if your chip is supported.
esp-idf does not have support for the ESP8266, we unfortunately are unable to use these libraries with it. See the Bare Metal page for information on the
no_std HAL for this chip.
std features are as follows:
- Mutexes and other synchronization primitives
- Random number generation
- Wi-Fi management
- NVS (non-volatile storage)
- Networking services like
In general, this approach should feel quite similar to developing for most normal PC environments.
|esp-rs/esp-idf-hal||An implementation of the |
|esp-rs/esp-idf-svc||An implementation of embedded-svc using |
|esp-rs/esp-idf-sys||Rust bindings to the |
|esp-rs/embedded-svc||Abstraction traits for embedded services. (|
The aforementioned crates have interdependencies, and this relationship can be seen below.
graph TD; esp-idf-hal --> esp-idf-sys & embedded-svc esp-idf-svc --> esp-idf-sys & esp-idf-hal & embedded-svc
You must clean your project and rebuild in order for changes in the
sdkconfig.defaults to take effect:
$ cargo clean $ cargo build
Due to the resource limits imposed by docs.rs, internet access is blocked while building documentation and as such we are unable to build the documentation for
esp-idf-sys or any crate depending on it.
Instead, we are building the documentation and hosting it ourselves on GitHub Pages:
If the second-stage bootloader reports this error, you likely need to increase the stack size for the main task. This can be accomplished by adding the following to the
In this example, we are allocating 7kB for the main task's stack.
Add to your
Recall that you must clean your project before rebuilding when modifying these configuration files.