#

Rust on ESP32

I have been tinkering with Walter - an ESP32-S3 module with NB-IoT, LTE-M, and GPS last week. Going the hard route a writing in Rust instead of using the provided libraries for C++ and MicroPython.

To my understanding, there are multiple paths to take. Using the standard library (std) one can build on top of ESP-IDF (IoT Development Framework), a C-based development framework. This is the heavier, batteries included, approach where drivers for WiFi, networking, HTTP, MQTT, peripherals and more are all provided by the underlying system based on FreeRTOS. The alternative is no_std. This requires writing everything from scratch (or at least using the right libraries) but gives full control of memory, timing, and peripherals.

Embassy makes the no_std path easier. It’s a framework that allows using async/await for efficient multi-tasking, bridging the gap between write everything yourself and full blown-out RTOS. Embassy takes care of scheduling, interrupts, and making sure the CPU sleeps when there’s nothing to do. Embassy itself doesn’t know anything about the underlying hardware, that’s where esp-hal-embassy comes in as a glue between the hardware abstraction layer and the Embassy framework, providing async-aware drivers for ESP hardware and timers and interrupts to drive the async task system.