Getting the GP32 Toolchain up and running was fairly straight forward, but had a few oddities and set backs.
Currently, I’m using a self-compiled toolchain created using the guide from cobbleware; which shall be repeated more or less here for safe keeping. Original content here: http://www.cobbleware.com/gp32/gp32toolchain.html
I’m aiming to get back to using devkitARM as I much prefer their setup… just need time to figure out what went wrong.
Anyway, to get the toolchain up and running from scratch, you effectively need to build GCC, binutils and newlib.
On newer systems, this can be easier said than done when you’re targeting older hardware with older toolchains.
Cobbleware was targeting GCC 3.3 series, so I followed suite.
Running Debian Squeeze 64bit on my main box, I pulled in the Lenny repos and grabbed GCC 3.4 which allowed me to compiled GCC 3.3.6 without issue, so it’s wise to acquire that through your distribution’s package system first.
So, I grabbed GCC-3.3.6, binutils 2.14, and newlib 1.11.0 from the mirror.ac.uk repository of the GNU project. Mirrors available here: http://gcc.gnu.org/mirrors.html
I extracted all of that to a temporary folder and built binutils first with the following commands:
tar -xvjf binutils-2.14.tar.bz2 cd binutils-2.14 mkdir build cd build export CC=gcc-3.4 ../configure --prefix=/opt/toolchains/gp32 --target=arm-elf make su <... enter root password ...> make install exit
You can delete binutils now at this point.
Cobbleware created a handy script to compile GCC and newlib together, which I’ve effectively recreated below, modifying the path from /usr to /opt/toolchains/gp32
#!/bin/sh make clean CFLAGS="-O3 -pipe" ../configure --prefix=/opt/toolchains/gp32 --target=arm-elf --enable-languages=c,c++ --with-newlib --disable-multilib --with-gnu-ld --with-gnu-as make all \ CFLAGS_FOR_TARGET="-DTAG_CFLAGS_FOR_TARGET -march=armv4t -marm -msoft-float -ffast-math -fshort-enums -mstructure-size-boundary=8 -mthumb-interwork -O2" \ CXXFLAGS_FOR_TARGET="-DTAG_CXXFLAGS_FOR_TARGET -march=armv4t -marm -msoft-float -ffast-math -fshort-enums -mstructure-size-boundary=8 -mthumb-interwork -O -fno-implicit-templates" \ LIBCFLAGS_FOR_TARGET="-DTAG_LIBCFLAGS_FOR_TARGET -march=armv4t -marm -msoft-float -ffast-math -fshort-enums -mstructure-size-boundary=8 -mthumb-interwork -O2" \ LIBGCC2_CFLAGS="-DIN_GCC -DCROSS_COMPILE -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -Dinhibit_libc -fno-inline -DTAG_LIBGCC_FLAGS -march=armv4t -marm -msoft-float -mthumb-interwork -O2 -ffast-math -fshort-enums -mstructure-size-boundary=8"
With this saved in the same folder as the tarballs and made executable, I then compiled GCC:
tar -xvzf newlib-1.11.0.tar.gz tar -xvjf gcc-3.3.2.tar.bz2 cd gcc-3.3.2 ln -s ../newlib-1.11.0/newlib . mkdir build cd build ../../bgcc su <... enter root password ...> make install exit
You can wipe out the temp folder now.
Now, SDL4GP32 seems to be a better set of libraries than Cobbleware’s as they don’t seem to overload bits of the core libraries, but I’m sure both of them have their place, so I just installed them both into separate folders. These went directly into /opt/toolchains/gp32 as sdl4gp32 and gp32libs. I then created a bash script to fix up the paths and exports which ran like this:
#!/bin/bash export PATH=$PWD/bin:$PATH export SDL4GP32=$PWD/sdl4gp32 export GP32LIBS=$PWD/gp32libs /bin/bash
I could then modify the make files of the examples to point to the right export path and they all compiled and worked without issue.
I’ll write up another little guide on getting stuff running on the GP32 and some gotchas I found, soon.