Upload sketch on Arduino Yun from command line

Keeping in mind that these are the steps that Arduino IDE follows when you upload a sketch on the board:

  • Copy <your_sketch>.hex
  • Merge your sketch with the bootloader
  • Program ATMega32u4

We can repeat those steps by hand in this way:

  • scp your_sketch.hex root@arduino.local:/tmp

now let's go in the Yun via ssh to run these commands:

root@Arduino:~# merge-sketch-with-bootloader.lua /tmp/your_sketch.hex
...

root@Arduino:~# run-avrdude /tmp/your_sketch.hex
...

avrdude: verifying ...
avrdude: 12866 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

That's all!

Ah... if you are wondering: "Where is the hex file of my compiled sketch?" then go to the IDE preferences and enable the verbose output option ;)