Building a GCC ARM cross-compiler for GP32

How to build a cross-compiler to run on Unix/Linux to compile code for execution on a GP32. Use the libraries available in the Dev'rs file archive, they don't include the thumb interwork stuff that makes everything so difficult otherwise..

Download binutils, gcc & newlib

Download the latest versions:

binutils
http://ftp.gnu.org/gnu/binutils/
gcc
http://ftp.gnu.org/gnu/gcc/
newlib
ftp://sources.redhat.com/pub/newlib/index.html

I used binutils-2.16, gcc-3.4.3 and newlib-1.13.0. Note that gcc-4.0.0 builds just fine, but its perfomance (on ARM, at least) doesn't seem to be as good.

Preparing to build

Unpack archives

$ gzip -dc binutils-2.16.tar.gz | tar xf -
$ gzip -dc gcc-3.4.3.tar.gz | tar xf -
$ gzip newlib-1.13.0.tar.gz | tar xf -

Prepare newlib to be built along with gcc

$ cd gcc-3.4.3
$ ln -s ../newlib-1.13.0/newlib .
$ cd ..

Build everything

If you want to store all the build stuff in its own tree, add a --prefix=/path/to/stuff option to each of the configure lines below.

Build binutils

$ mkdir binutils-2.16-arm-elf
$ cd binutils-2.16-arm-elf
$ ../binutils-2.16/configure --srcdir=../binutils-2.16 --target=arm-elf
$ make
$ su -c "make install"
$ cd ..

Build gcc

$ mkdir gcc-3.4.3-arm-elf
$ cd gcc-3.4.3-arm-elf
$ ../gcc-3.4.3/configure --srcdir=../gcc-3.4.3 --target=arm-elf \
	--with-cpu=arm9 --with-newlib --disable-threads --disable-multilib \
	--disable-nls --enable-languages=c
$ make
$ su -c "make install"
$ cd ..

You might want to try changing enable-languages to "c c++".

All done

Clear out any build directories if you want. You should now (assuming /usr/local/bin, or the bin under your own --prefix, is in your path) be able to run arm-elf-gcc, arm-elf-as, arm-elf-objcopy, etc. which should be enough for building things. You'll need b2fxec too, of course; get that from Mr. Spiv's download directory.

Updated 10 May 2005