Archive 07/10/2020.

Trying RIOT on my own devices (arduino, raspberry-pi…)

MDer

Hello,

I could manage TP2 activity on the LAB plateform and I’m curious about how to make it work on my computer and devices I have on my desktop.

I downloaded RIOT from github and could compile hello-world on native CPU. Works well ! (but had to add libraries).

Now I’d like to make it work on a small device… Probably it is a little step forward to compile and flash my Arduino UNO with hello-world or shell examples but I miss a few clues about commands to execute…

Could you give a few advice or a link to follow ? Is it straight forward for Arduino UNO ? For Arduino M0 ? For Raspberry-pi ??

Thanks a lot for this MOOC !
Best regards,
Marc

aabadie2

Hi,

RIOT can run as a native instance on raspberry pi, similar to what you managed to do on your computer, but cannot replace the Linux operating system on it.
Regarding Arduino Uno or Arduino M0, RIOT can run on them (but Arduino M0 might not be fully supported). To compile a firmware for these targets you have to install the toolchain that corresponds to the microcontroller architecture: AVR GCC for Arduino Uno or ARM GCC for Arduino M0.
The good news is that if you don’t want to install the toolchains, you can use a Docker image provided for RIOT to build the firmware:

make BOARD=<board name> BUILD_IN_DOCKER=1 -C examples/hello_world flash term

For flashing the Arduino Uno, you will have to install avrdude and for opening the terminal, you will have to install pyserial Python package (pip3 install pyserial).

You can find the list of boards supported in RIOT in the online documentation or on simply in the boards directory on GitHub.

Alexandre

MDer

Hello,
Thank’s for your advice. It worked ! (at least on arduino uno).

Do you know which board to select for M0 ? maybe "arduino-mkrzero’ or ‘arduino-zero’ ? I also have an arduino MKR wifi 1010 ; should I use the board “arduino-mkr1000” ?

Is there any risk in programming a device with a wrong “board” used at compilation process ? (I think so…)

I give my experience for those interested ; I’m running on kubuntu 19 :

I installed the docker following this link : https://github.com/RIOT-OS/RIOT/wiki/Use-Docker-to-build-RIOT

sudo apt install docker -> don’t work : no docker command available (even with sudo) ; advice is to install docker.io package or install docker by snap.

sudo apt install docker.io ->works
sudo docker pull riot/riotbuild -> works (many downloads) but nothing in the current directory…

At that point, I should have executed the command : sudo docker run --rm -i -t -u $UID -v $(pwd):/data/riotbuild etc... from the riot root but I have no idea of the path of this “riot root” !
Anyway, this must not be useful as it’s been working.

Into “example/hello-world” dir :
make BOARD=arduino-uno BUILD_IN_DOCKER=1 DOCKER=“sudo docker” all

Compiling is OK

Installing avrdude for flashing :
sudo apt install avrdude avr-libc binutils-avr

Install of pyserial for term :
sudo apt install python3-pip
pip3 install pyserial

Back again on make, with flash and term (I had to change default /dev/ttyACM0 to /dev/ttyACM1 as my arduino is on ACM1) :
make BOARD=arduino-uno BUILD_IN_DOCKER=1 DOCKER=“sudo docker” PROG_
DEV="/dev/ttyACM1" PORT=/dev/ttyACM1 flash term

Thanks a lot. I’ll make further testings on other boards.
Marc

aabadie2

If you don’t want to use sudo docker, you can add your user account to the docker group and restart your session.

aabadie2

In general no but that depends on the programmer and it’s capacity to rewrite the flash memory even on a completely broken firmware.

rboulle

Hi,

What is the point to run RIOT on a board like Arduino Uno ? I mean, yes, this is for sure interesting as a way to learn how to install/compile it definitely :slight_smile:

But are there some use cases where it is better to use RIOT than legacy Arduino code on UNO ?

Thanks

aabadie2

Indeed, this is not very interesting since this platform (atmega328p) is too much constrained (2KB of RAM). But I guess a lot of people own the Arduino Uno board, and it’s good to be able to test RIOT on it.
In general, it’s quite challenging for the OS to support multiple architectures in a consistent way. For example AVR is an 8 bit architecture so care has to be taken on integer type sizes when programming.

If you are still interested in AVR architecture, there are other boards from Microchip that could be interesting for IoT. For example, the atmega256rfr2-xpro has a lot more RAM and a 802.15.4 radio. RIOT has support for it (see the online doc as well).

MDer

Hi,

Probably Arduino Uno is not the best plateform for RIOT but I got one on my desk :wink: and after programming hello-world (which includes all the kernel of RIOT), avrdude report 5ko out of 32ko Flash memory so there is still space left for applications…

I had several times to program on arduino some applications where the firmware has to apply some commands from serial port. That needs to build a state machine in the firmware. May be RIOT, in this case, could make it more simple, I don’t know yet…

Thanks for the details.
Marc