First steps in RIOT-OS

This content has 5 years. Please, read this page keeping its age in your mind.

Exploring is the correct attitude in our field. So, I decided to play with riot os. It’s popular real time operating system for IoT which lots of nice feature. I can see a great potential in robotics too. You can also check the ROS2 RIOT package!


First you need to download it using the following commands:

git clone git://
git checkout

Then if try to build the examples that comes with RIOT, you most probably face 2 problems:

  1. Error: sys/cdefs.h no such file or directory ubuntu 16.04
    No worries, try to install the following library (if you use Ubuntu)
sudo apt-get install g++-multilib
  1. The GNU Embedded Toolchain for Arm is missing (in my case that I want to use Arduinos based on ARM M0 and M3).
    First, you need to download it from arm developer site:

Then lets install it, but how?
We can create an opt folder inside home following these commands:

$ mkdir -p "${HOME}"/opt
$ cd "${HOME}"/opt
$ tar xjf ~/Downloads/gcc-arm-none-eabi-x-xxxx-xx-major-linux.tar.bz2
$ chmod -R -w "${HOME}"/opt/gcc-arm-none-eabi-x-xxxx-xx-major

Then we need to add at the end of .bashrc like that:

export PATH=$PATH:${HOME}/opt/gcc-arm-none-eabi-x-xxxx-xx-major/bin

Now, we are ready to play!

There is the option use the native port but I wanted to do experiments with real boards, and I tried the following three:

    • arduino M0 Pro
    • arduino Due
    • stm32f4 discovery

So after installing RIOT, we need to execute the following commands (assuming that we are inside the project folder and the board is connected to /dev/ttyACM1 port).

arduino M0 pro

BOARD=arduino-zero make flash PORT=/dev/ttyACM1
BOARD=arduino-zero make term PORT=/dev/ttyACM1

and if we want to reset it, we can use:

BOARD=arduino-zero make reset PORT=/dev/ttyACM1

arduino due

BOARD=arduino-due make flash PORT=/dev/ttyACM1
BOARD=arduino-due make term PORT=/dev/ttyACM1

stm32f4 discovery

make BOARD=stm32f4discovery flash

but for this case, in order to make openocd work, you need to edit the following file /RIOT/boards/stm32f4discovery/dist/openocd.cfg

# increase working area to 64KB
set WORKAREASIZE 0x10000
source [find interface/stlink-v2-1.cfg]
transport select hla_swd
source [find target/stm32f4x.cfg]
reset_config srst_only
$_TARGETNAME configure -rtos auto

It works very nice – download it and play!