Pre-release Compiler Build Scripts


DJWillis

Random GP32/GP2X/Wiz & Pandora Moocher
Joined
Jul 20, 2003
Messages
1,470
Age
45
Location
Bath, Somerset, UK
Website
www.distant-earth.com
All,

I figure after a bit of testing and tire kicking I should release a set of build scripts that give you a working GCC 4.0.2, gLibC 2.3.5, BinUtils 2.16 based ARM-Linux tool-chain for the GP2X if anybody who does not already have them wants to play. Call them a pre-release :D.

I am popping up the crude scripts here, I will clean them, get them working under MinGW (to do a nice DevKitArm like Windows build that does not need CygWin) and release them via Open2x soon.

They have been tested on x86 Linux, x64 Linux, CygWin and a few others boxes I had laying about. Apart from MinGW (symlink probs) all built executables that work on the real hardware.

You have to statically link EVERYTHING or the executables stand no chance of working on real hardware ;) -static etc. as the gLibC that GPH give us is ancient and may other things are less then idea in the GPH kernel/image.

I have also added a lot of hacks (nasty ABI shafting hacks ;)) to the stock ARM-Linux compiler that really make the resulting tool-chain unsuitable for ARM-Linux development on any platform other then the GP2X/MMSP2 including things like hacking in Nico Pitre's excellent ARM-ELF GCC patches to give you the hand tuned FPU ARM ASM experience we love when using GCC 4 on the GP32 rather then the really shonky kernel’s soft FPU driver you normally get with OS bound ARM-Linux GCC's.

How to use the build scripts:

These scripts are based on Crosstool after some hacking about.
They are REALLY nasty but should work.

Extract the somewhere and run ./open2x-gp2x.sh to build the tool-chain.

Unless you want the tools in /tools/open2x_gcc you will want to edit the open2x-gp2x.sh to point the output and other folders to somewhere suitable for your environment.

It will WGET all the files it needs unless you place then in the downloads folder that open2x-gp2x.sh is looking for. (Hint: CygWin users will need to grab a CygWin build of WGET 1st).

It will ONLY build a working tool-chain based on gcc-4.0.2, glibc-2.3.5 binutils-2.16 etc as I have not put the patches for any other build combo.

How to use the tool-chain:

Once build you have a full GNU tool-set built for the ARM-Open2x-Linux target so you just call the exe and folder (or path the /bin out) and use arm-open2x-linux-gcc etc. etc.

The build scripts should generate a few hello world apps in install-dir/arm-open2x-linux/tmp, the hello world “static” exes should work on the real hardware out the box so please copy them to an SD and try them to test your tool-chain before you get stuck into any code :D.

There is no need to do any elf to executable faffing like we are used to on the GP32 as the compiler will give you an ARM-Linux tagged executable off the bat. You can check this with “file output-filename” (try it on the hello world examples).

One thing worth noting is that if you do not want any debug, symbols ect. in files you generate to run on the real hardware you want to strip them with “arm-open2x-linux-strip -o outfile infile”. This will cut the file size down a LOT.

John
 
Ah, stop being modest and calling them nasty :). They work, and that's not nasty at all!

I never did get the test-hello script to work. In the end, all I did was call the compiler directly:
Code:
/opt/open2x_gcc/gcc-4.0.2-glibc-2.3.5/arm-open2x-linux/bin/arm-open2x-linux-gcc -static -c printregs.c
/opt/open2x_gcc/gcc-4.0.2-glibc-2.3.5/arm-open2x-linux/bin/arm-open2x-linux-gcc -static -o printregs printregs.o

The result was 528.6k. After stripping, it went down to 449.3k. For a real program with more code and less data, that ratio would be even better.

Thanks again!
 
Can anybody with MinGW installed try and build the tool-chain with the latest scripts linked above?

Everything has sort of turned to shit today (both computer and some real life), not the end of the world but I may not be about for a day or 2.

John
 
Back
Top