Table of Contents

RIOT in a nutshell

RIOT is an open-source microkernel-based operating system, designed to match the requirements of Internet of Things (IoT) devices and other embedded devices. These requirements include a very low memory footprint (on the order of a few kilobytes), high energy efficiency, real-time capabilities, communication stacks for both wireless and wired networks, and support for a wide range of low-power hardware.

The quickest start

You can run RIOT on most IoT devices, on open-access testbed hardware (e.g. IoT-lab), and also directly as a process on your Linux/FreeBSD/OSX machine (we call this the native port). Try it right now in your terminal window:

boards

The platform dependent code is split into two logic elements: CPUs and boards, while maintaining a strict 1-to-n relationship, a board has exactly one CPU, while a CPU can be part of n boards. The CPU part contains all generic, CPU specific code (see below).

The board part contains the specific configuration for the CPU it contains. This configuration mainly includes the peripheral configuration and pin-mapping, the configuration of on-board devices, and the CPU's clock configuration.

On top of the source and header files needed for each board, this directory additionally may include some script and configuration files needed for interfacing with the board. These are typically custom flash/debug scripts or e.g. OpenOCD configuration files. For most boards, these files are located in a dist sub-directory of the board.

cpu

For each supported CPU this directory contains a sub-directory with the name of the CPU. These directories then contain all CPU specific configurations, such as implementations of power management (LPM), interrupt handling and vectors, startup code, clock initialization code and thread handling (e.g. context switching) code. For most CPUs you will also find the linker scripts in the ldscripts sub-directory.

In the periph sub-directory of each CPU you can find the implementations of the CPU's peripheral drivers like SPI, UART, GPIO, etc. See Peripheral Driver Interface for their API documentation.

Many CPUs share a certain amount of their code (e.g. all ARM Cortex-M based CPUs share the same code for task switching and interrupt handling). This shared code is put in its own directories, following a xxxxx_common naming scheme. Examples for this is code shared across architectures (e.g. cortexm_common, msp430_comon) or code shared among vendors (e.g. stm32_common).

drivers

This directory contains the drivers for external devices such as network interfaces, sensors and actuators. Each device driver is put into its own sub-directory with the name of that device.

All of RIOT's device drivers are based on the peripheral driver API (e.g. SPI, GPIO, etc.) and other RIOT modules like the xtimer. This way the drivers are completely platform agnostic and they don't have any dependencies into the CPU and board code.

sys

RIOT follows the micro-kernel design paradigm where everything is supposed to be a module. All of these modules that are not part of the hardware abstraction nor device drivers can be found in this directory. The libraries include data structures (e.g. bloom, color), crypto libraries (e.g. hashes, AES) , high-level APIs (e.g. Posix implementations), memory management (e.g. malloc), the RIOT shell and many more.

sys/net

The sys/net sub-directory needs to be explicitly mentioned, as this is where all the networking code in RIOT resides. Here you can find the network stack implementations (e.g. the GNRC stack) as well as network stack agnostic code as header definitions or network types.

pkg

RIOT comes with support for a number of external libraries (e.g. ccn-lite, microcoap). The way they are included is that RIOT ships with a custom Makefile for each supported library that downloads the library and optionally applies a number of patches to make it work with RIOT. These Makefiles and patches can be found in the pkg directory.

tests

Many features/modules in RIOT come with their own test application, which are located in this directory. In contrary to the examples these tests are mostly focusing on a single aspect than on a set of features. Despite for testing, you might consider these tests also for insights on understanding RIOT.

dist & doc

All the tooling around RIOT can be found in these two folders.

doc contains the doxygen configuration and also contains the compiled doxygen output after running make doc.

Lastly, the dist directory contains tools to help you with RIOT. These include the serial terminal application pyterm, generic scripts for flashing, debugging, reseting (e.g. support for OpenOCD, Jlink), as well as code enabling easy integration to open testbeds such as the IoT-LAB. Furthermore you can find here scripts to do all kind of code and style checks.