Compiling_AVR-GCC-cvs
If you want to use an uptodate AVR-GCC toolchain on linux, e.g. because you need support for new devices, you must compile it yourself.
This page covers the minimal version of the toolchain without many addons using avr-libc from cvs.
In the moment this should not be neccessary. Use the stable avr-libc (1.4.0).
Contents
see also: Compiling_AVR-GCC
Download the source
mkdir /usr/src/avr-toolchain-src
cd /usr/src/avr-toolchain-src
wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.1.tar.bz2 \
http://ftp.gnu.org/gnu/gcc/gcc-3.4.4/gcc-3.4.4.tar.bz2 \
http://www.kieltech.de/~ufechner/patch-2005-05.zip \
http://www.kieltech.de/~ufechner/avr-mem.sh.gz
Apply the patches
unzip patch-2005-05.zip gunzip avr-mem.sh.gz chmod +x avr-mem.sh tar --bzip2 -xvf binutils-2.16.1.tar.bz2 tar --bzip2 -xvf gcc-3.4.4.tar.bz2 patch binutils-2.16.1/gas/config/tc-avr.c patch/binutils-2.16.1-2005-5.diff patch -d gcc-3.4.4/gcc/config/avr avr.c ../../../../patch/gcc-3.4.4-2005-5.diff
See also: Patching_AVR_GCC
Set up the environment
export MAJVERSION="2005" export SUBVERSION="4" export VERSION="$MAJVERSION.$SUBVERSION" export PREFIX="/usr/local/avr-toolchain-$VERSION" export PROGPREFIX="avr-" export TARGET="avr" export PATH="$PREFIX/bin:$PATH"
Build and install binutils
cd /usr/src/avr-toolchain-src
cd binutils-2.16.1
mkdir obj-avr
cd obj-avr
../configure --target=$TARGET \
--prefix=$PREFIX \
--program-prefix=$PROGPREFIX
make
make install
Build and install avr-gcc
cd /usr/src/avr-toolchain-src
cp avr-mem.sh $PREFIX
cd gcc-3.4.4
mkdir obj-avr
cd obj-avr
../configure --target=$TARGET \
--prefix=$PREFIX \
--program-prefix=$PROGPREFIX \
--enable-languages=c \
--disable-nls
make
make installPay attention: This builds the c compiler only, not the c++ and the ada compiler. Change the configure options, if you need any of them.
Build and install avr-libc
cd /usr/src/avr-toolchain-src cvs -z3 -d:ext:anoncvs@savannah.nongnu.org:/cvsroot/avr-libc co avr-libc
Answer yes to the question "Are you sure you want to continue connecting?".
cd avr-libc ./bootstrap ./configure --build=`./config.guess` --host=avr --prefix=$PREFIX make make install
optional: The programmer AVRDUDE
cd /usr/src/avr-toolchain-src wget http://savannah.nongnu.org/download/avrdude/avrdude-5.0.tar.gz tar -zxvf avrdude-5.0.tar.gz cd avrdude-5.0 mkdir obj-avr cd obj-avr ../configure --prefix=$PREFIX make make install
Final steps
Add the toolchain directory to your path. You could add the following lines to /etc/profile:
PATH="$PATH:/usr/local/avr-toolchain-2005.4/bin" export PATH
Check, if your installation was successfull:
avr-gcc --version avr-ld --version
Display the supported cpus:
avr-gcc -dumpspecs
Links
This page is based on:
Programming guide includes installation guide based on rpm packages
ChromiteBlue.com uptodate avr tool chain
Back to AVR-GCC