ARDUINO: Setting up a Gentoo development environment…

if you’re reading this post, most likely you’re having issues with setting up Crossdev as mentioned on the arduino.cc site. i tried countless times to configure my system for AVR compiling that way, but it always failed compiling avr-libc and would never compile avr-g++ no matter how i applied the USE flags. in short, i had to manually compile the necessary environment and this article is so i don’t forget how that’s done. it seems there are only a smattering ink blot’s worth of people developing Arduino sketches under the Gentoo distribution, but this should work (in theory) for most any Linux distro out there since it’s all manual installation. if anyone happens to hit a snag during their installation, feel free to let me know.

Download the tool chain…

getting the right version is the key. some newer versions don’t play nice with ATMEL’s chips for whatever reason.

1) BinUtils 2.20.1a: http://ftp.gnu.org/gnu/binutils/binutils-2.20.1a.tar.bz2
2) GCC 4.3.6: http://gcc.petsads.us/releases/gcc-4.3.6/gcc-g++-4.3.6.tar.bz2
3) AVR LibC 1.7.1: http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.7.1.tar.bz2

these are the versions that both myself and Jose Moldonado in Spain have been able to run without problems.

Additional downloads…

you’ll need AVRDuDe. i installed it from source just to be safe, though i think the portage install is just as good.

http://download.savannah.gnu.org/releases/avrdude/avrdude-5.11.tar.gz

PREFIX and PATH

this is how my system is setup.

#PREFIX=/usr/i686-pc-linux-gnu/avr
#export PREFIX
#PATH=$PATH:$PREFIX/bin
#export PATH

make sure to do this FIRST. not modifying the PREFIX variable could potentially hose the whole system.

Compiling…

then you can start compiling binutils:

# cd binutils-2.20.1a
# mkdir obj-avr
# cd obj-avr
# ../configure --prefix=/usr/x86_64-pc-linux-gnu/avr --target=avr --disable-nls
# make
# make install

then onto gcc…

# cd gcc-4.3.6
# mkdir obj-avr
# cd obj-avr
# ../configure --prefix=/usr/x86_64-pc-linux-gnu/avr --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
# make
# make install

then avr-libc…

# cd avr-libc-1.7.1
# ./configure --prefix=/usr/x86_64-pc-linux-gnu/avr --build=x86_64-pc-linux-gnu --host=avr
# make
# make install

Symlinking your libs and includes…

now on my system, there was a /usr/avr folder that the Arduino IDE definitely looks in for the includes and additional libraries. i had to symlink two folders in order for the IDE to work.

# ln -s /usr/i686-pc-linux-gnu/avr/avr/include /usr/avr/include
# ln -s /usr/i686-pc-linux-gnu/avr/avr/lib /usr/avr/lib

…and that was that. the latest Arduino IDE ran without a hitch.

for more detailed information, go here: http://www.nongnu.org/avr-libc/user-manual/install_tools.html


Posted

in

by

Comments

Leave a Reply