Build gcc for ARM Cortex processor

I have lately built several versions of the Linux GCC tool chain for the ARM Cortex processor. But the generated tools do not work properly with floating point, issuing errors about floating point inconsistencies. One option is of course to download a free version of a commercial tool, like the one from But I didn’t want to give up on this. Today I gave it a new try using the script by Uwe Hermann /blog/building-an-arm-cross-toolchain\ -with-binutils-gcc-newlib-and-gdb-from-source with options from esden:\
The resulting script file:

#!/bin/sh# Written by Uwe Hermann, released as public domain.

TARGET=arm-none-eabi    # Or: TARGET=arm-none-eabi
PREFIX=/opt/arm-cortex # Install location of your final toolchain
PARALLEL="-j 2"    # Or: PARALLEL=""


export PATH="$PATH:$PREFIX/bin"

mkdir build

wget -c$BINUTILS.tar.bz2
tar xfvj $BINUTILS.tar.bz2
cd build
../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
--enable-multilib --with-gnu-as --with-gnu-ld --disable-nlsmake $PARALLEL
make install
cd ..
rm -rf build/*

wget -c$GCC/$GCC.tar.bz2
tar xfvj $GCC.tar.bz2
cd build
../$GCC/configure --with-libiconv-prefix=/opt/local --target=$TARGET --prefix=$PREFIX \
--enable-interwork --enable-multilib --enable-languages="c" --with-newlib \
--without-headers --disable-shared --with-gnu-as --with-gnu-ld --with-gmp=/opt/local \
make $PARALLEL all-gccmake install-gcc
cd ..
rm -rf build/*

wget -c$NEWLIB.tar.gz
tar xfvz $NEWLIB.tar.gz
cd build
../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
--enable-multilib  --with-gnu-as --with-gnu-ld --disable-nlsmake $PARALLEL
make install
cd ..
rm -rf build/*

# Yes, you need to build gcc again!
cd build
../$GCC/configure --with-libiconv-prefix=/opt/local --target=$TARGET \
--prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c" \
--with-newlib --disable-shared --with-gnu-as --with-gnu-ld--with-gmp=/opt/local \
--with-mpfr=/opt/localmake $PARALLEL
make install
cd ..
rm -rf build/*

Before running this script you may

sudo mkdir /opt/arm-cortex
sudo mkdir /opt/local
sudo chmod a+rwx /opt/arm-cortex
sudo chmod a+rwx /opt/local

Then the tools will be installed while running the script as a common user. After installation you may of course chmod the directories and files recurcively to reasonable values. Now I can compile the Luminary Stellaris source code without any error message.

1 Response to “Build gcc for ARM Cortex processor”

  • Thanks for this – came in very handy to help me start working with Stellaris on Ubuntu.

Leave a Reply