Arduino

Arduino is an open source development platform using atmel microprocessors. This document describes how to use Arduino boards on Gentoo.

Prepare the kernel for USB connection
The arduino boards will be connected via USB to the computer. With this connection it is possible to write binaries to the atmega microprocessor and get debug messages from the board during run mode. Different boards have different USB interface chips. In case you prefer to use ICSP programming with an external adapter you don't need this for programming any more but eventually for debugging.
 * Arduino NG -> FTDI
 * Arduino MEGA and most of the others (8U2, 16U2, 32U4) -> CDC ACM

After booting with the new kernel this can be tested after connecting the board to the computers USB port:

Prepare the toolchain
Because we need to compile code into binaries for another target platform (avr atmel microprocessors) we have to install an cross development toolchain. We need three parts (Versions depend on your installation): this can be tested with:
 * cross-avr/gcc-4.6.3
 * cross-avr/binutils-2.21.1-r1
 * cross-avr/avr-libc-1.8.0

If gcc is already installed please pay attention of the use flag multilib. This have to be activated.

Install the toolchain using crossdev
Basic installation is out of the scope of this article. Please read the gentoo crossdev manual with special attention to the AVR section of the article.

Install non gentoo toolchain
Using the original Atmel AVR toolchain seems to be possible but not tested.

Using the debian precompiled toolchain is described there

Using arduino IDE
At the moment arduino ide and uisp package are masked with ~amd64 keyword.

This can be tested with:

Create a file called arduino containing the necessary keywords. For example:

After the keywords are set correctly arduino can be installed with:

After the start of arduino ide (an link should be found in the application/development section of your start menu) the scetchbook location should be configured.

This is possible via the menu File/Preferences/Scetchbook location/.

Using eclipse IDE
After installing eclipse IDE you can choose between two eclipse plugins. Plugins can be installed via provided update sites. Simply add the given site via eclipse menu/help/software-updates/add-site.

Arduino Eclipse Extension
Arduino Eclipse Extension is a free eclipse plugin for arduino projects developed by Jantje. It depends on the installation of arduino IDE.

Use the update site "http://www.baeyens.it/eclipse/update" for the installation of a plugin version which is compatible with arduino 1.0.4 and eclipse helios and indigo.

Use the update site "http://www.baeyens.it/eclipse/V2" for installation of a plugin version which is compatible with arduino 1.5.x and eclipse juno.

AVR Eclipse Plugin
AVR Eclipse Plugin is a free eclipse plugin for developing boards with avr atmel microprocessors. It is not especially make for the arduino boards, but it can used for that. It is not necessary to install arduino IDE for using that plugin. More informations can be found on the wiki site.

Use the update site "http://avr-eclipse.sourceforge.net/updatesite/" for installation of the plugin which is known to work with eclipse helios.

udev rule for Arduino NG
This rule can be used to make an symlink /dev/arduino, especially usefull in case of more than one arduino boards.

For example create an file 12-mikrocontroller.rules and add the line below:

udev rule for Arduino MEGA
This rule can be used to make an symlink /dev/arduino, especially usefull in case of more than one arduino boards.

For example create an file 12-mikrocontroller.rules and add the line below:

Known Bug 147155
If you can see the message below you have found an already known bug.

To fix this create a symlink so that arduino will find ldscripts:

Problem with deprecated items in avr-libc v1.8.0 and above (and Mega 2560)
If you can see the messages below you have found this compatibility issue (arduino forum).

To fix this manipulate your Arduino.h at the third line:

External resources

 * Gentoo Embedded Handbook for more information about embedded systems, cross compiling and other related topics.
 * Guide for gentoo on arduino main page little bit outdated.
 * Arduino eclipse extension main site.