Documents/Toolchains

From Nutwiki
Jump to: navigation, search

AVR and ARM Toolchains for Linux

This Document contains instructions to build AVR/ARM toolchains on Linux.

AVR on Linux

Download and unpack the following sources into separate folders.

Download Sources: binutils (ftp://gcc.gnu.org/pub/binutils/releases)
gcc (ftp://gcc.gnu.org/pub/gcc/releases)
avrlibc (http://download.savannah.gnu.org/releases/avr-libc/)

Because those Path names are so difficult to remember we set an environment variable called prefix to our install destination.

$ export prefix=/whereever/you/want/to/install/
          

After unpacking we should now have an directory for each of our archives. To keep things clean we create a build directory in each subdirectory. From the build directory we run the usual configure make install. After a sucessful build we add the required directories to the PATH. This is necessary because the gcc needs binutils.

Building binutils:


$ ../configure --prefix=$prefix --target=avr --disable-nls
$ make
$ make install
$ PATH=$PATH:$prefix/bin
$ export PATH
          

Building gcc:


$ ../configure --prefix=$prefix --target=avr --enable-languages=c,c++ --disable-nls \
    --disable-libssp --with-dwarf2
$ make
$ make install
$ PATH=$PATH:$prefix/avr/bin
$ export PATH
          

Building avrlibc:


$ ../configure --prefix=$prefix --build=`../config.guess` --host=avr
$ make
$ make install
          

ARM on Linux

For Arm we use newlib instead of avrlibc.

Download Sources: binutils (ftp://gcc.gnu.org/pub/binutils/releases)
gcc (ftp://gcc.gnu.org/pub/gcc/releases)
newlib (ftp://sources.redhat.com/pub/newlib/)

for binutils:


$ ../configure --prefix=[targetroot] --target=arm-elf --enable-interwork --enable-multilib
$ make
$ make install
$ PATH=$PATH:[targetroot]/arm-elf/bin
$ export PATH
          

for gcc:


$ ../configure --prefix=[targetroot] --target=arm-elf --disable-threads \
    --enable-interwork --enable-multilib --enable-languages=",c,++" \
    --with-newlib --with-headers=[newlib-source]/newlin/libc/include
$ make
$ make install
$ PATH=$PATH:[targetroot]/bin
$ export PATH
          

for newlib:


 
$ ../configure --prefix=[targetroot] --target=arm-elf --enable-target-optspace
$ make
$ make install