Start the RIOT - Getting started with RIOT

  1. Requirements
  2. Get the source code
  3. Setup the toolchain
  4. Setup a flashing tool
  5. Hello World!
  6. Write your first applicatoin

Requirements

You may not to install additional packages for particular toolchains or flashing tools. For the MSB-A2 check the requirements in the Github Wiki.

Get the source code

You can obtain RIOT either by cloning the git repositories or download the latest tarballs.

Using the git repository

In order to obtain RIOT from the official GitHub repositories, please perform the following commands:

The kernel

git clone git://github.com/RIOT-OS/RIOT.git

The platform configurations

git clone git://github.com/RIOT-OS/boards.git
or
git clone git://github.com/RIOT-OS/thirdparty_boards.git
git clone git://github.com/RIOT-OS/thirdparty_cpu.git

Optional (recommended): Examplary projects

git clone git://github.com/RIOT-OS/projects.git

Download the tarballs

TODO: Build tarballs!

Setup the toolchain

You can either build RIOT for one of the supported hardware platforms (check our website) or try the native port. As a special platform, you will find a CPU and board called native in the repository. This target allows you to run RIOT as a process on Linux on most supported hardware platforms. Just set CPU and BOARD to native in your project's Makefile, call make, and execute the resulting elf-file.

For ARM

The recommended toolchain for RIOT on ARM is an older version (2008q3) of CodeBench (formerly CodeSourcery) from Mentor Graphics. It can be obtained here.

Linux

Direct links for Linux are

http://www.codesourcery.com/.../arm-2008q3-66-arm-none-eabi.bin (with installer)

or

http://www.codesourcery.com/.../arm-2008q3-66-arm-none-eabi-i686-pc-linux-gnu.tar.bz2.

Please note that you will have to add the directory with executables (arm-none-eabi-gcc, arm-none-eabi-as etc.) to your PATH variable in both cases. On a typical shell like bash or zsh this can be done using export, e.g.

export PATH=${PATH}:/path/to/arm-none-eabi-gcc

Windows

The direct link for the Windows version is

http://www.codesourcery.com/.../arm-2008q3-66-arm-none-eabi.exe.

Mac OS X

There is a tutorial to install the CodeSourcery toolchain on Mac OS X: https://gist.github.com/errordeveloper/1854389.

Build the toolchain from sources

There is also the possibility to build the toolchain from the sources, allowing for newer versions of GCC, binutils, and Newlib. A script to build a toolchain for the MSB-A2 is available in the RIOT git repository at
dist/tools/toolchains/build_gnuarm.sh.

For MSP430

Download and install GCC toolchain for MSP430 according to the information provided on the website.

For the native port

In order to build RIOT for the native port, you just need the GNU Compiler Collection.

Setup a flashing tool

For MSB-A2

For MSB-430H

Download and install MSPDebug according to the information provided on the website. You can also use MSPDebug for debugging.

For redbee-econotag

Folow the instructions for Getting Started with MC1322x.

For STM32F4DISCOVERY

TODO

Optional: Hello World!

If you have obtained a copy of the projects repository, you can build the famous Hello World application for RIOT.

Write your first application

To write your own RIOT application, you just need a Makefile and C file(s) containing your source code. A template Makefile is available in the dist folder of the RIOT repository.

One of the C files has to provide a main function according to this prototype:

int main(void);

Within your project's Makefile, you can define the modules you want to use.

Unless specified otherwise, make will create an elf-file as well as an Intel hex file in the bin folder of your project directory.