As a proud father would speak of his daughter, the developers of RIOT state, “RIOT powers the Internet of Things (IoT) like Linux powers the Internet.” A free software licensed by GNU lesser general-public licence (LGPL)-v2, RIOT is an operating system (OS) developed by a grassroots community with help from companies, academia and hobbyists worldwide.
The moment you begin working on a project for the IoT, you are pulled into tight waters, having to provide maximum flexibility at minimum resource usage. Low memory footprint and high energy efficiency are the most basic requirements, along with support for real-time functioning. RIOT is structured keeping all these factors in mind, making it perfectly suited for IoT applications.
A micro-kernel that holds up the OS in its stead
Usage of micro-kernel architecture in RIOT OS allows for a simple abstraction layer over the hardware and provides the necessary mechanisms for the OS to function right. Well-designed thread management and a priority based scheduler allow for the smooth processing of tasks. This OS exploits ultra-low interrupt latency and priority based scheduling to provide real-time action.
The micro-kernel includes a powerful application program interface (API) that takes care of inter-process communication. Mutexes are engaged to synchronise the performance between tasks, with a system timer maintaining the schedule perfectly.
Emphasising low-power operation at every stage
Once the board that is to run the OS is initialised, it goes into the lowest possible power mode, running the idle thread. Once the main thread is given priority, the board switches threads to perform the task called by the main function.
Talking about threads, it is important for the user to assign the right amount of stack to each defined thread. Especially with limited memory locations owing to the IoT angle, RIOT lets you find your way through this hurdle by introducing you to sample stack sizes that you can use as a base and accordingly customise your board.
A modular and configurable stack for communication
This free software offers support to relevant IoT standards and protocols you would need while coding for your application. It is IPv6 over Low-power Wireless Personal Area Networks (6LoWPAN)—request for comments (RFC)6282 and RFC6775 compliant, Routing Protocol for Low-Power and Lossy Networks (RPL)—RFC6550 compliant, and supports OpenWSN, Constrained Application Protocol (CoAP), Concise Binary Object Representation (CBOR) and Universal Binary JSON (UBJSON) standards.
RIOT is also compatible with Arduino API. To enhance capabilities, the OS promotes networking through tap interfaces and offers support to additional tools like Desvirt enabling network virtualisation, RIOT-TV for visualisation and packet capture based wireless sniffer.
Supporting a variety of integration
RIOT can be configured for entire platforms like TelosB or STM32 discovery boards, allows connection to various microcontrollers and a wide range of sensors. Environmental sensors, battery gas gauge, accelerometers, gyroscopes, ultrasonic range finders and servometers are some of the components you will find easy to integrate.
Drivers for interfacing devices can be added as modules to the code, many of which are readily available, too. There is also a radio driver to which you can connect through a transceiver module, which acts as a multiplexer between the network stack and the driver.
Compatible with a number of hardware chains
RIOT offers support to a whole lot of microcontrollers like MSP430, ARM7, Cortex series and x86 processors and a number of boards like Arduino boards, mbed NXP LPC1768, Nordic chip, Spark-Core, STM family and Texas Instruments development kit, to pick a few from the long list.
You only need to install a toolchain for the corresponding hardware before you can begin working with the setup. Make sure you also define the target hardware in your Makefile. Just like you call modules in Verilog coding, you can include modules for whatever interfaces you want to have in your design and add this to the Makefile as well. Unless you meddle with the settings, the designers have developed the software to automatically create an elf file and an Intel hex file as results of your application, which come in handy.
Utilities for a comfortable design experience
The most important factor while coding is the amount of resources available. Even though you might be coding in a familiar language, if the constructs are not recognised or supported by the tool being used, your expertise comes to naught.
RIOT provides cryptographic libraries and data structures like bloom filters, hash tables and priority queues. A shell acts as the link between the brain of the developer and that of the OS. To make sure that your code is of high quality, you can employ established tools like Travis and embUnit-Unit Testing.
Run RIOT from your computer
RIOT provides a native port that allows you to run the OS as a process on a Linux or MAC OS. For those who are not too familiar with embedded programming, or those who do not have one of the supported platforms, this turns out to be a handy feature.
With this port, you can develop and debug projects written for RIOT and the OS itself, without the limitations and requirements of debugging on actual hardware. Use tools like gdb or valgrind to analyse your process. You can even exploit a configurable topology to create virtual test beds of multiple networked instances of RIOT running simultaneously, or create a controlled environment and experiment your system’s functioning there.
Apart from these, RIOT is also compatible with Docker; you have everything in one place and setting up the developing environment is easy. The only thing left now is to try your hand at this tool.
Priya Ravindran is a freelance writer with EFY