Howto Build a GCC Toolchain for Atmel AVR Controllers

I succeded to build a working gcc toolchain for Atmel's AVR microcontrollers on an OpenSuSE 11.4 by following the recipe at

At time of this writing (2012-07-25) binutils and gcc I used were not the most recent ones (binutils-2.22, gcc-4.7.1) as I came into troubles with those (possibly only caused by my lack of experience and dumb faults).

As a test for the functioning of the toolchain I built ethersex.

Define a prefix for the configure processes and include the avr binary location into the execution path

export PREFIX=/usr/local/avr
export PATH=$PREFIX/bin:$PATH

Create the directory $PREFIX if not already existing.

To build the gcc compiler you need to have installed the devel packages of
gmp (The GNU Multiple Precision Arithmetic Library),
mpfr (MPFR multiple-precision floating-point computation shared library) and
mpc (MPC multiple-precision complex library).
My gcc used for the build was version 4.5.1.

GNU Binutils

Download the sources from
I used version 2.21.1a

tar xvjf binutils-2.21.1a.tar.bz2
cd binutils-2.21.1
mkdir build-avr
cd build-avr
../configure --prefix=$PREFIX --target=avr --disable-nls
sudo make install


Download the sources from from a reasonable mirror of like
I downloaded gcc-core 4.6.3
and gcc-g++ 4.6.3

tar xvjf gcc-core-4.6.3.tar.bz2
tar xvjf gcc-g++-4.6.3.tar.bz2
cd gcc-4.6.3
mkdir build-avr
cd build-avr
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
sudo make install

AVR libc

Download the sources from
I used version 1.8.0

tar xvjf avr-libc-1.8.0.tar.bz2 
cd avr-libc-1.8.0
./configure --prefix=$PREFIX --build=`./config.guess` --host=avr
sudo -E make install

AVR Downloader/UploaDEr (avrdude)

Download the sources from
I used version 5.11.1

tar xvzf avrdude-5.11.1.tar.gz
cd avrdude-5.11.1
mkdir build
cd build
../configure --prefix=$PREFIX
sudo make install

Permanently add $PREFIX/bin to the shell's execution path

Add e.g. to ~/.bashrc:

export PATH=/usr/local/avr/bin:$PATH

Useful References

last updated: 2012-07-25
This site maintained by:
My public PGP key
HOME Valid CSS! Valid XHTML 1.0 Strict