Seeed Studio XIAO ESP32S3 with NuttX(RTOS)
Introduction
NuttX is a mature real-time operating system (RTOS) widely recognized for its standards compliance and small footprint. One of NuttX's main features is its scalability, which allows it to be used in environments ranging from 8-bit microcontrollers to 64-bit systems. This flexibility is achieved through adherence to POSIX and ANSI standards, enabling you to experiment with similar NuttX features across a wide range of chips from different architectures, families, and semiconductor vendors.
Additionally, NuttX offers many advanced and useful features, such as USB, Ethernet, Audio, and Graphics subsystems. These characteristics make NuttX an attractive choice for developers seeking a versatile, robust RTOS capable of operating on various types of hardware.
NuttX supports a vast and continually expanding number of boards. The official documentation provides a comprehensive list of supported boards, organized by architecture and System-on-Chip (SoC) series.
For instance, the Seeed Studio XIAO ESP32S3 page in the NuttX documentation offers detailed descriptions of each supported feature and instructions on how to utilize them. Also there is a specific page in the NuttX documentation for Espressif ESP32S3 series chips, where you can find the list of MCUs and peripherals supported.
Installation
The Nuttx documentation provides a guide to different platforms.For Seeed Studio XIAO ESP32S3 please follow these steps:
Download Espressif esptool(https://docs.espressif.com/projects/esptool/en/latest/esp32/):
~/nuttxspace/nuttx$ esptool.py version
esptool.py v4.8.1
4.8.1Create a workspace
mkdir nuttxspace
Clone the repositories
cd nuttxspace
git clone https://github.com/apache/nuttx.git nuttx
git clone https://github.com/apache/nuttx-apps apps
The Apache Nuttx it's divided into two project:
- Nuttx: contains implemented the kernel, driver and subsystems.
- Apps: contains a collection of tools, shells, network utilities, libraries and interpreters.
Applications
To start an application it's necessary to load a configuration on NuttX, calling the command:
./tools/configurate.sh board_name:your_application
Also it's possible to check the list of board-supported a running the command:
./tools/configurate.sh -L
Build NuttX (build process will generate the firmware binaries, including nuttx.uf2):
cd nuttx
make distclean
./tools/configure.sh xiao-esp32s3:nsh
make V=1The RESET and BOOT buttons can be used to enter “Bootloader” mode by press and hold the BOOT key while powering up and then press the RESET key once.
Load the firmware using esptool.py:
make flash ESPTOOL_PORT=/dev/ttyACM0 ESPTOOL_BINDIR=./
Hands-on
It's time to explore NuttX practically. In this session, two applications are available: USBNSH and COMBO.
NSH
The NuttShell(NSH) is a shell system to be used in NuttX, similar to bash and other similar options. It supports a rich set of included commands, scripting and the ability to run your own applications as “builtin” (part of the same NuttX binary). The NSH configuration enables console at USB using 115200 bps.
We can start the build process clearing the previous configuration
cd ~/nuttxspace/nuttx
make distclean
Now we select the NSH configuration to the xiao-esp32s3 board:
./tools/configurate.sh xiao-esp32s3:usbnsh
Compile the source code.
make -j
Load the firmware into you board, reboot the board and connect NuttShell (NSH) console over USB using the CDC/ACM serial interface:
picocom -b 115200 /dev/ttyACM0
Access the NuttShell console:
NuttShell (NSH) NuttX-12.8.0
nsh> uname -a
NuttX 12.8.0 2c845426da-dirty Apr 6 2025 22:53:57 xtensa esp32s3-xiao
nsh>
Typing ?
, you will access the available options for commands and built-in applications.
nsh> ?
help usage: [-v] [<cmd>]
. cp exec ls reboot truncate
[ cmp exit mkdir rm uname
? dirname expr mkrd rmdir umount
alias date false mount set unset
unalias dd fdinfo mv sleep uptime
basename df free pidof source usleep
break dmesg help printf test xd
cat echo hexdump ps time
cd env kill pwd true
Builtin Apps:
getprime hello nsh ostest sh
Let's say hello to NuttX, type hello
and then it executes the command:
nsh> hello
Hello, World!!
Congratulations, your first interation with NuttX was completed.
COMBO
This configuration enables three example applications, gpio and leds. The General Purpose Input/Output (GPIO) is a microcontroller's most fundamental part, allowing it to connect to the external world. This way we will use the NSH to access and configure those pins as we wish. But first, let's clear the previous configuration.
cd ~/nuttxspace/nuttx
make distclean
Select the combo configuration to the xiao-esp32s3 board.
./tools/configurate.sh xiao-esp32s3:combo
Compile de the source code.
make -j
Load the firmware into you board, run a serial communication program such as minicon or picocom:
picocom -b 115200 /dev/ttyACM0
NuttShell (NSH) NuttX-12.8.0
nsh>
To check which options are accepted to interact with this application, type gpio -h
, and it will return a list of parameters.
NuttShell (NSH) NuttX-12.8.0
nsh> gpio -h
USAGE: gpio [-t <pintype>] [-w <signo>] [-o <value>] <driver-path>
gpio -h
Where:
<driver-path>: The full path to the GPIO pin driver.
-t <pintype>: Change the pin to this pintype (0-10):
-w <signo>: Wait for a signal if this is an interrupt pin.
-o <value>: Write this value (0 or 1) if this is an output pin.
mation and exit.
Pintypes:
0: GPIO_INPUT_PIN
1: GPIO_INPUT_PIN_PULLUP
IO_INPUT_PIN_PULLDOWN
3: GPIO_OUTPUT_PIN
4: GPIO_OUTPUT_PIN_OPENDRAIN
5: GPIO_INTERRUPT_PIN
6: GPIO_INTERRUPT_HIGH_PIN
7: GPIO_INTERRUPT_LOW_PIN
8: GPIO_INTERRUPT_RISING_PIN
9: GPIO_INTERRUPT_FALLING_PIN
10: GPIO_INTERRUPT_BOTH_PIN
To confirm the GPIO device files were created, type ls/dev
. After typing, you can see some gpios were declared define on boards/arm/ra/xiao-esp32s3/include/board.h, which represent :
- On board LED:
- Yellow -> GPIO21
- GPIOs
- 1 Input -> GPIO1
- 1 Input w/ IRQ -> GPIO3
- 1 Output -> GPIO2
nsh> ls /dev
/dev:
console
gpio0
gpio1
gpio2
null
ttyACM0
ttyS0
userleds
zero
nsh>
Following these commands to read GPIO1(/dev/gpio1) and GPIO3(/dev/gpio2) (with interruption) and write at GPIO2(/dev/gpio0).
NuttShell (NSH) NuttX-12.8.0
nsh> gpio -o 1 /dev/gpio0
Driver: /dev/gpio0
Output pin: Value=0
Writing: Value=1
Verify: Value=1
nsh> gpio -o 0 /dev/gpio0
Driver: /dev/gpio0
Output pin: Value=1
Writing: Value=0
Verify: Value=0
nsh> gpio /dev/gpio1
Driver: /dev/gpio1
Input pin: Value=0
nsh> gpio /dev/gpio1
Driver: /dev/gpio1
Input pin: Value=1
nsh> gpio /dev/gpio1
Driver: /dev/gpio1
Input pin: Value=0
nsh> gpio -w 1 /dev/gpio2
Driver: /dev/gpio2
Interrupt pin: Value=0
Verify: Value=1
nsh> gpio -w 1 /dev/gpio2
Driver: /dev/gpio2
Interrupt pin: Value=0
Verify: Value=1
The USERLEDS is a subsystem that allows to control of the LEDs with single operation. Also, you can use commands-line like the printf. In this demo we will turn on and turn off the Yellow LED on-board each 1 seconds.
Typing leds
, you observe the LEDs blinky same time.
NuttShell (NSH) NuttX-12.8.0
nsh> leds
leds_main: Starting the led_daemon
leds_main: led_daemon started
led_daemon (pid# 7): Running
led_daemon: Opening /dev/userleds
led_daemon: Supported LEDs 0x01
led_daemon: LED set 0x01
nsh> led_daemon: LED set 0x00
led_daemon: LED set 0x01
led_daemon: LED set 0x00
led_daemon: LED set 0x01
led_daemon: LED set 0x00
led_daemon: LED set 0x01
led_daemon: LED set 0x00
Check the video below with the demo for gpio and leds:
For more information about NuttX RTOS, please visit NuttX Documentation
✨ Contributor Project
- This project is supported by the Seeed Studio Contributor Project.
- A special thanks to Rodrigo for his dedicated efforts. Your work will be exhibited.
Tech Support & Product Discussion
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.