User Tools

Site Tools


Launch of


Building an Arduino sketch on your board with the AVR Toolchain for MIPS

Dear Linino users,

we are proud to announce the release of the AVR Toolchain for MIPS/OpenWRT platform. That means that you are now able to build your own Arduino sketch and then upload the generated firmware directly on your board. To install it and start programming, you first have to upgrade your board to the latest Linino image. Please carefully take a look how to do it here :

How to upgrade the Linino distribution

If you own an Arduino Yun (and your control panel is the jade green colored one) please stick with the master branch of Linino otherwise you might brick your board ! On the contrary, owners of a Linino ONE can also refer to the lininoIO branching if already on natively installed on their boards.

Since the avr-toolchain package is quite cumbersome (it's about 15MB in its compressed form), you have to expand you filesystem to install it properly. Currently, the easiest and fastest way is to use our node.js installation script which will take care for you of all the necessary steps :

Node.js installation script

Once rebooted and logged in by means of SSH, type :

$ opkg update
$ opkg install arduino-files -d mnt
$ opkg install avr-toolchain -d mnt
$ opkg install make

and the system will install the Arduino libraries and the AVR Toolchain on the expanded filesystem residing on your external flash memory (don't worry if it will take a while, the two packages are quite cumbersome !). Logout and login again by means of SSH and type :

$ avr-gcc -v

if the command returns :

Using built-in specs.
Target: avr
Configured with: ../gcc-4.3.2/configure --enable-languages=c,c++ --prefix=/home/arturo/AVR_ARBORIO_2/avr-arborio --enable-long-long --disable-nls --disable-checking --disable-libssp --disable-werror --libexecdir=/home/arturo/AVR_ARBORIO_2/avr-arborio/lib --disable-shared --with-dwarf2 --host=mips-openwrt-linux --target=avr
Thread model: single
gcc version 4.3.2 (GCC)

you're ready to go ! As simple example, we'll build the simple blink sketch (the “Hello World” of microcontrollers) by leveraging a tweaked version of the Edam's Arduino makefile. Basically, this makefile takes care for you of setting all the necessary paths (the Arduino Libraries and executables ones). So, as long as the user is an experencied Arduino programmer, it allows you to entirely bypass the GUI of the Arduino IDE itself and write/build code with the use of a simple text editor and the make command.

We have of course customised the file for our purposes, to set the correct paths for LininoOS after the two packages have been installed on your system. You can download it here :

After that, create a blank folder called blink on your expanded filesystem (it's /opt) and decompress the file into it with :

unzip -d blink

browse into that folder and then with your favourite text editor create the file blink.ino and write in it the following code :

  Turns on an LED on for one second, then off for one second, repeatedly.
  This example code is in the public domain.
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second

now you have to create just a simbolic link to the linino makefile to ease your build tasks :

$ ln -s Makefile

and then run the make command with just :

$ make

after the build process has finished, you will find the freshly generated firmware in the very same folder named after the sketch name (blink.hex). At this point, you have just to upload the firware into the MCU with :

$ run-avrdude blink.hex

If the firmware has been properly loaded into the mcu, you should see the L13 led blinking. Please also keep in mind that you have to repeat the same process for every different *.ino sketch (i.e. create a new folder, copy inside that one the file, write the code and creating the symlink to the makefile itself) since the Edam's makefile (and the of course) manages only one sketch at time.

We wish you an happy AVR coding !

/var/www/ · Last modified: 2015/06/23 17:33 by arturo

2014 © dog hunter llc and the Linino Community. is a dog hunter sponsored community project. Credits