Using the Rust Standard Library (std)

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.

Chip Support

In order for applications targeting std to be built for ESP devices, two things are required:

  1. LLVM/Clang support
  2. Support for the device in esp-idf

Refer to the table below to see if your chip is supported.


Since 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.

Standard Library Features

The supported std features are as follows:

  • Threads
  • Mutexes and other synchronization primitives
  • Collections
  • Random number generation
  • Sockets

In addition to the std features there is an embedded-svc implementation for esp-idf, esp-idf-svc, which adds extra support for services/modules not available in the standard library, including:

  • Wi-Fi management
  • NVS (non-volatile storage)
  • Networking services like httpd and ping

In general, this approach should feel quite similar to developing for most normal PC environments.

Relevant esp-rs crates

esp-rs/esp-idf-halAn implementation of the embedded-hal and other traits using the esp-idf framework.
esp-rs/esp-idf-svcAn implementation of embedded-svc using esp-idf drivers.
esp-rs/esp-idf-sysRust bindings to the esp-idf development framework. Gives raw (unsafe) access to drivers, Wi-Fi and more.
esp-rs/embedded-svcAbstraction traits for embedded services. (WiFi, Network, Httpd, Logging, etc.)

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


I updated my sdkconfig.defaults file but it doesn't appear to have had any effect

You must clean your project and rebuild in order for changes in the sdkconfig.defaults to take effect:

$ cargo clean
$ cargo build

The documentation for the crates mentioned on this page is out of date or missing

Due to the resource limits imposed by, 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:

***ERROR*** A stack overflow in task main has been detected.

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 sdkconfig.defaults file:


In this example, we are allocating 7kB for the main task's stack.

How can I completely disable the watchdog timer(s)?

Add to your sdkconfig.defaults file:


Recall that you must clean your project before rebuilding when modifying these configuration files.