doc/guides/getting-started/installing.mdx
import Contact from '@components/contact.astro';
<Contact />Most of the RIOT OS developers are using Linux on their development PCs, so you can expect the most streamlined experience here. Generally, most Linux distributions are supported.
If you are new to Linux, we recommend using Ubuntu, as it is the most widely used distribution and has the most extensive documentation and community support.
Some distributions, such as Fedora, do not provide the necessary packages for cross compilation. In this case, it is recommended to use the RIOT Docker Container.
Windows is supported through Windows Subsystem for Linux (WSL). The experience is not as streamlined as on Linux, but it is still possible to develop with RIOT.
:::note Please follow the installation guide for WSL to set up your development environment.
Afterwards, you can follow the Ubuntu installation guide. The installation of the required software packages is the same for both Ubuntu and WSL. :::
Native development on macOS machines is not officially supported.
What works well is using Linux in a virtual machine, but at much lower performance than running Linux natively.
We also offer Docker images that make it a bit easier to develop on macOS.
:::note It is also possible to run RIOT in a Docker container.
This is especially useful if you want to avoid installing the required software packages on your host system. For more information, see the Build in Docker guide. :::
Depending on the operation distribution you are using, the installation of the required software packages may vary.
sudo apt install make gcc-multilib python3-serial python3-psutil wget unzip git openocd gdb-multiarch esptool podman-docker clangd clang
sudo pacman -S make gcc-multilib python-pyserial python-psutil wget unzip git openocd gdb esptool podman-docker clang
This will show something like this depending on your distribution:
exit):::note Even if you subsequently work only via VS Code, do NOT skip this step. You will still need a "clone" of the RIOT Repository to work with. :::
git clone https://github.com/RIOT-OS/RIOT and confirm with the return-keydone. when it completedcd RIOT/examples/basic/hello-world and confirm with the return-key to enter
the folder hello-world example app in the RIOT repomake and confirm with the return key to build the app for the board
native:::tip
If you are having issues with missing libraries you can always also
use the docker container to build the app.
In this example you can type BUILD_IN_DOCKER=1 make to build the app in the docker container.
:::
:::note
The native board is a virtual board that will run an RIOT application as
regular Linux process. This can be useful for testing or during development.
The app should behave the same when run on real hardware.
:::
make termCtrl-keyCtrl-key still held, press the C-keyThis target will honor the variables controlling the build process such as BOARD, TOOLCHAIN,
DEVELHELP, etc. just like the usual build process. This works without actual compilation. By
default, the compile_commands.json is placed in the RIOT base directory. This behavior can be
overwritten using the COMPILE_COMMANDS_PATH variable by specifying the full absolute path
(including file name) of the compile_commands.json instead.
:::note
By default, the built-in include search directories of GCC will be explicitly added
and flags incompatible with clangd will be dropped. This will allow using clangd as language
server out of the box. If this is not desired, run export COMPILE_COMMANDS_FLAGS="" to turn
modification of the compile commands off. For a list of available flags, run
./dist/tools/compile_commands/compile_commands.py --help in the RIOT base directory.
:::
~/RIOT/examples/basic/hello-world
$ sign in the terminal) shows
the current working directory for the terminal~/RIOT/examples/basic/hello-world, type
cd ~/RIOT/examples/basic/hello-world to enter that path~/RIOT/examples/basic/hello-world run the command make compile-commands~/RIOT using the command cd ~/RIOTcode . to launch VS Code
examples folderbasic folder inside the examples folderhello-world folder inside the basic foldermain.c file in the hello-world folder within examples:::note You can also install that extension via the extension marketplace if that pop up does not show up. :::
:::danger
Do NOT configure RIOT as CMake project. VS Code will incorrectly detect RIOT as CMake project, because it contains external packages that indeed are using CMake.
RIOT_BOARD in the source code, IntelliSense
shows that it expands to "native".:::note
IntelliSense depends on information how to compile the source code to work
correctly, which is provided in the file compile_commands.json. You can
regenerate this file by running make compile-commands in the app you are
working on.
:::
:::caution
Re-run make compile-commands when:
puts("..."); statement
in the source codeCtrl+S)~/RIOT/examples/basic/hello-world using cd ~/RIOT/examples/basic/hello-worldmake command to build the codemake term to launch the applicationCongratulations! You just compiled your first RIOT application. To run RIOT on real hardware, proceed with the next to sections.
:::caution[Don't get lost] If this section overwhelms you, don’t worry, you can always come back to it later. This is only important if you want to develop for a specific architecture or board. For now everything should work fine with the packages installed above.
You can safely skip this section if you are just getting started with RIOT
and want to try out the examples or develop for the native board.
:::
For each architecture a default tool for flashing and on-chip debugging is listed below - in most cases OpenOCD. However, some boards use different tools, e.g. because a bootloader is installed that allows flashing via the serial interface. Check the board documentation for any details on this. If that documentation contains no info about a flashing tool, the default tool for its architecture is used.
:::tip
Running BOARD=<INSERT_TARGET_BOARD_HERE> make info-programmers-supported in your
application folder lists the programmers supported by RIOT for the given board.
:::
arm-none-eabi
BUILD_IN_DOCKER=1make flashPROGRAMMER=openocd to just use OpenOCD insteadarm-none-eabi to link against picolibc instead of newlibTOOLCHAIN=llvmarm-none-eabi insteadBUILD_IN_DOCKER=1riscv and end with
-none-elf or -unknown-elf. Note that most packages are multilib, e.g. riscv64-unknown-elf
will likely work fine for 32 bit RISC-V boards)
BUILD_IN_DOCKER=1TOOLCHAIN=llvmBUILD_IN_DOCKER=1BUILD_IN_DOCKER=1. Note that for running the executable you
still need a multilib system (or 32 bit Linux) with glibc a standard C library.