Espressif has recently announced that both Zephyr and NuttX open-source real-time operating systems had gotten official support for the ESP32 series of WiSoCs.
It’s been a long time in the making, and when I first tried the community developer port of Zephyr OS on ESP32 in 2018 it did not work well at all, and I could not even make the blink LED sample work on Wemos Lolin32 board, and the WiFi sample would not even build. But time has passed, Espressif Systems started to officially work on Zephyr in 2020, and now I/Os, WiFi, and some other features work on Zephyr and NuttX RTOSes.
Zephyr on ESP32
We first wrote about the Zephyr Project in 2016 describing the OS as follows:
Zephyr Project is a lightweight real-time operating system (RTOS) designed for IoT applications and comprised of a microkernel for lower priority tasks, as well as a nanokernel to handle the real-time part. Zephyr memory footprint can be as low as 8KB, it supports x86, ARMv7-M, and ARC instructions sets, includes Bluetooth and 6LoWPAN stacks, as well as I/O drivers for GPIOs, ADC, I2C, and SPI, and supports Constrained Application Protocol (CoAP) and Datagram Transport Layer Security (DTLS).
Since then we’ve seen the real-time operating system used in multiple wireless microcontrollers, notably Nordic Semi nRF chips with Zephyr part of the company’s nRF Connect SDK, QuickLogic EOS S3 MCU + eFPGA SoC, STM32 boards with a LoRa radio, and many more.
ESP32 support may not be as complete as for the ESP-IDF, Arduino, or MicroPython, as it appears
Bluetooth is not supported yet [Update: implemented since April for ESP32, since August for ESP32-C3, see comments], but you’ll find documentation to get started, or a blog post dated April 2021 for the same that explains that UART, I2C, GPIO, SPI Master, and Timers were all working at the time. WiFi has recently been implemented and Embarcados has a tutorial in Portuguese. There’s still more work to be done, and the best place to look should be the Zephyr ESP32 roadmap on Github. The last update (July 26) shows SMP (i.e. only one core can be used), DMA, ULP, ADC, DAC, CAN, and I2S still need to be worked on.
NuttX RTOS support for ESP32
NuttX is a real-time operating system initially developed by Greg Nutt as a POSIX-compliant for 8-bit microcontrollers. Now an Apache Incubator project, NuttX scaled from 8-bit to 32-bit microcontroller environments, and mostly follows POSIX and ANSI standards, although additional standard APIs from Unix and other common RTOSs such as VxWorks can be adopted to add functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
While NuttX is older than Zephyr, as I have not seen it as often as the latter, and only used it once myself as part of the Spresense SDK for Sony Spresense board. In more recent NuttX news, we noted the Jupiter Nano board powered by a 500 MHz Microchip SAMA5 Cortex-A5 processor, and supporting both NuttX and Linux.
We can find ESP32 related source code in the Apache NuttX repository with both ESP32 and ESP32-S2 folders for Xtensa based WiSoCs, as well as an ESP32-C3 folder for the newer RISC-V variant. I feel the documentation is better than for Zephyr (for the few minutes I’ve looked at it), and we can easily find the list of supported and unsupported features.
Again GPIO and WiFi are supported, but others like Bluetooth and ADC are not. The list appears to roughly match the one from Zephyr, and the latter explains that some features are deeply implemented with the FreeRTOS RTOS used in the ESP-IDF so those are harder to port to another operating system.
You’ll also find a getting started blog post and another, in Portuguese but with screenshots in English, showing how to use LVGL graphics library with NuttX on ESP32.
Espressif Sytems also says they helped port MCUboot secure IoT bootloader project to both Zephyr and NuttX, and you can find a very recent presentation detailing how a secure boot to NuttX was achieved with MCUboot on an ESP32-Devkit-C development board.
The main takeaway is that Zephyr and NuttX RTOSes support for ESP32 has greatly improved over the last few years, but depending on the feature set required by your application may not be suitable for commercial deployment just yet.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.