Introduction
RIOT is a free, open-source operating system for the Internet of Things, running on 8-bit, 16-bit, and 32-bit microcontrollers. It provides real-time capabilities, a small memory footprint, and a POSIX-like API.
What RIOT Does
- Provides a microkernel with real-time scheduling and multi-threading on constrained devices
- Supports ARM Cortex-M, RISC-V, MSP430, and native Linux/macOS targets
- Includes IPv6, 6LoWPAN, CoAP, MQTT, and LoRaWAN network stacks
- Offers a POSIX-like API and standard C/C++ support
- Provides a tickless scheduler for battery-powered deployments
Architecture Overview
RIOT uses a microkernel design where drivers, network stacks, and application logic run as modules atop a minimal kernel handling threads, IPC, and scheduling. The native port lets developers test applications as regular host processes using GDB and Valgrind before deploying to hardware.
Self-Hosting & Configuration
- Install the ARM or RISC-V toolchain for your target platform
- Board support packages define pin mappings and peripheral drivers per board
- Include only needed modules in Makefiles to minimize footprint
- Use the native board target for development without physical hardware
- Configure network and radio drivers via module inclusion flags
Key Features
- Tickless real-time scheduler with constant-time context switching
- Over 250 supported boards across multiple CPU architectures
- Certified Thread and 6LoWPAN implementations
- Minimum footprint of approximately 1.5 KB RAM and 5 KB ROM
- Comprehensive CI testing across multiple hardware platforms
Comparison with Similar Tools
- Zephyr: Broader industry backing but steeper learning curve and larger footprint
- FreeRTOS: Widely adopted but lacks built-in networking stacks and POSIX API
- Contiki-NG: Focused on low-power IPv6 but uses protothreads, not real OS threads
- Mbed OS: Tight ARM integration but less portable to non-ARM architectures
FAQ
Q: What hardware do I need to start? A: Use the native target to run RIOT on Linux or macOS with no hardware. For physical boards, nRF52840-DK and STM32 Nucleo are well supported.
Q: How does RIOT handle networking? A: RIOT includes a full IPv6 stack with 6LoWPAN, CoAP, MQTT-SN, LoRaWAN, and BLE modules.
Q: Can I use standard C libraries? A: Yes, RIOT supports newlib and picolibc with POSIX-compatible wrappers for sockets, timers, and file descriptors.
Q: How does memory usage compare to other RTOSes? A: A minimal RIOT application runs with roughly 1.5 KB RAM and 5 KB ROM, competitive with FreeRTOS and smaller than Zephyr.
Sources
- Repository: https://github.com/RIOT-OS/RIOT
- Documentation: https://doc.riot-os.org/