Installing Gcc for ARM

The installation is a bit tedious since the tools we compile are later used for compiling the other tools. Here is a description on how to compile the toochain and install it into your home directory. The script can be found here: sh I have upgraded the script to use gcc-4.4. The newest version of newlib is 1.18 but I couldn't make it work.
Now I use the Debian source packages of gdb, gcc and binutils so you need to install the following packages:

#apt-get install binutils-source gcc-4.4-source gdb-source libgmp3-dev libmpfr-dev libmpc-dev

The script:


export MYSRCPATH=$HOME/src/cross-tools
export MYPREFIX=$HOME/cross
export GCCVERS=4.4.4
export GCCVERS1=4.4
export BINUTILSVERS=2.20.1
export GDBVERS=7.1
export NEWLIBVERS=1.17.0

mkdir -p $MYPREFIX
mkdir -p $MYSRCPATH/Dist

#gpg --verify gcc-$GCCVERS.tar.bz2.sig

#gpg --verify binutils-$BINUTILSVERS.tar.bz2.sig

#gpg --verify gdb-$GDBVERS.tar.bz2.sig



tar xvJf /usr/src/gcc-$GCCVERS1/gcc-$GCCVERS-dfsg.tar.xz
tar xvjf /usr/src/binutils/binutils-$BINUTILSVERS.tar.bz2
tar xvjf /usr/src/gdb.tar.bz2
tar xvzf Dist/newlib-$NEWLIBVERS.tar.gz
cp Dist/t-arm-elf gcc-$GCCVERS/gcc/config/arm/t-arm-elf

mkdir -p $MYSRCPATH/target/arm-elf/binutils
cd $MYSRCPATH/target/arm-elf/binutils
../../../binutils-$BINUTILSVERS/configure \
--target=arm-elf --prefix=$MYPREFIX \
--enable-interwork --enable-multilib --with-float=soft
# --disable-werror
make all
make install


mkdir -p $MYSRCPATH/target/arm-elf/gcc
cd $MYSRCPATH/target/arm-elf/gcc
../../../gcc-$GCCVERS/configure \
--target=arm-elf --prefix=$MYPREFIX --enable-interwork \
--enable-multilib --with-float=soft \
--enable-languages="c,c++" --with-newlib \
make all-gcc
make install-gcc

mkdir -p $MYSRCPATH/target/arm-elf/newlib
cd $MYSRCPATH/target/arm-elf/newlib
../../../newlib-$NEWLIBVERS/configure --target=arm-elf --prefix=$MYPREFIX \
--enable-interwork --enable-multilib --with-float=soft
make all
make install

cd $MYSRCPATH/target/arm-elf/gcc
make all
make install

mkdir -p $MYSRCPATH/target/arm-elf/gdb
cd $MYSRCPATH/target/arm-elf/gdb
../../../gdb/configure --target=arm-elf --prefix=$MYPREFIX \
--enable-interwork --enable-multilib --with-float=soft
make all
make install

Then you need to add the following line to your .bashrc file

export PATH=${PATH}:${HOME}/cross/bin