Building an Example
RIOT provides a number of examples in the examples/
directory. Every example
has a README that documents its usage and its purpose. You can build them by
opening a shell, navigating to an example (e.g. examples/default
), and
running:
make BOARD=samr21-xpro
or
make all BOARD=samr21-xpro
To flash the application to a board just run:
make flash BOARD=samr21-xpro
You can then access the board via the serial interface:
make term BOARD=samr21-xpro
If you are using multiple boards you can use the PORT
macro to specify the
serial interface:
make term BOARD=samr21-xpro PORT=/dev/ttyACM1
For flashing and accessing the board via the serial interface, the current user needs to have the correct access rights on the serial device. The easiest way to ensure this is to add the current user to the group that is owning the serial device. For example, this can be achieved on Linux by issuing the following line, logging out and logging in again:
sudo usermod -aG $(stat --format="%G" /dev/ttyACM0) $USER
Note that the PORT
macro has a slightly different semantic in native
. Here
it is used to provide the name of the TAP interface you want to use for the
virtualized networking capabilities of RIOT.
We use pyterm
as the default terminal application. It is shipped with RIOT in
the dist/tools/pyterm/
directory. If you choose to use another terminal
program you can set TERMPROG
(and if need be the TERMFLAGS
) macros:
make -C examples/gnrc_networking/ term \ BOARD=samr21-xpro \ TERMPROG=gtkterm \ TERMFLAGS="-s 115200 -p /dev/ttyACM0 -e"
You may not see the greeting
main(): This is RIOT!
when you flash the board. In this case, type reboot
in the command line or reboot manually.