Building the GNU ARM Toolchain for Bare Metal

 

This is an Update on http://www.kunen.org/uC/gnu_tool.html

Things to Download :

mkdir /home/yourname/site
export MYTOOLS=/home/yourname/site

# make base dir
mkdir ARM
# original archives dir
mkdir ARM/orig 
# unpackaged source dir
mkdir ARM/src
# path for building the sources (to keep them separate from the original sources)
mkdir ARM/build

Getting the source :

cd ARM/orig

wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2
wget -c ftp://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.bz2
wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.20.0.tar.gz
wget -c http://www.mpfr.org/mpfr-current/mpfr-3.1.2.zip
wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2
wget -c ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.1.tar.xz
wget -c ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.1.tar.gz

Extract the source in required folder

cd ARM/src

tar -xf ../original/gcc-4.8.0.tar.bz2
tar -xf ../original/gdb-7.6.tar.bz2
tar -xf ../original/newlib-1.20.0.tar.gz
unzip ../original/mpfr-3.1.2.zip
tar -xf ../original/binutils-2.23.2.tar.bz2
tar -xf ../original/gmp-5.1.1.tar.xz
tar -xf ../original/mpc-1.0.1.tar.gz

When i tried to build, I faces some issue with GMP Version and doing the below two solved the issue.

mv mpfr-3.1.2 gcc-4.8.0/mpfr;
mv mpc-1.0.1 mpc-1.0.1gcc-4.8.0/mpc
mv gmp-5.1.1 gcc-4.8.0/gmp

Building the toolchain

cd ../../build/
mkdir binutils-2.23.2/
cd binutils-2.23.2/
../../src/binutils-2.23.2/configure --target=arm-none-eabi --prefix=$MYTOOLS --enable-interwork --enable-multilib
make all install
export PATH="$PATH:$MYTOOLS/bin"

GCC :

cd ../
mkdir gcc-4.8.0/
cd gcc-4.8.0/

../../src/gcc-4.8.0/configure --target=arm-none-eabi --prefix=$MYTOOLS --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --with-headers=../../src/newlib-1.20.0/newlib/libc/include/ --with-system-zlib

If the above command complaints about missing MPFR/GMP etc, run the below command

../../src/gcc-4.8.0/configure --target=arm-none-eabi --prefix=$MYTOOLS --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --with-headers=../../src/newlib-1.16.0/newlib/libc/include --with-gmp --with-headers=../../src/gcc-4.8.0/gmp --with-mpfr --with-headers=../../src/gcc-4.8.0/mpfr --with-mpc --with-headers=../../src/gcc-4.8.0/mpc

Building New Lib

mkdir ARM/build/newlib-1.20.0
cd ARM/build/newlib-1.20.0
../../src/newlib-1.20.0/configure --target=arm-none-eabi --prefix=$MYTOOLS --enable-interwork --enable-multilib
make all install

Completing the Build

cd ARM/build/gcc-4.3.3
make all install

Done!!

Advertisements

Author: Shingu

Search in pursuit. Help me if you can.

1 thought on “Building the GNU ARM Toolchain for Bare Metal”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s