GP2X Gph Toolchain For Linux With Gcc 4.0.3 And Gp2x Kernel 2.1.x


Kalimerou

Still Fresh
Joined
Jan 27, 2007
Messages
88
Hi folks !

I'm new to this forum and since I've had a GP2x for only 3 days, I'm also new to GP2x programming.

Actually, I was quite wondering : why does nobody discuss about GPH toolchain ?

Trying to build that toolchain on a Linux Ubuntu, I didn't even figure out that they were other ones. So whatever, I started building this one.
The building process aborted more than once because of compilation errors, but I fixed these errors and it finally succeeded. In my way, I also modified the install script so that it would use the GP2x 2.1.x kernel instead of the old 1.4.0 one.
I thought my fixes could be useful to other developers, so I put them online. You can get them here :
http://unismetz.free.fr/buildgp2xtools.sh
http://unismetz.free.fr/gcc-4.0.3-glibc-2.3.6.patch
Just get the standard GPH SDK from http://dev.gp2x.com/sdk/gp2xsdk_linux.tar.gz, unpack it and overwrite the two files.

Please let me now if it also worked for you ! gp32_console

Edit : I noticed that one of the patches I added could'nt be applied. So please consider downloading this one instead and also this file. Extract the SDK archive in a directory, then add these two files in the same directory. Don't forget to replace gcc-4.0.3-glibc-2.3.6.patch with my own and let it rock !
 
It's very useful for a building a dynamic linking toolchain, but I use devkitgp2x for static linking.
 
I'm trying to munge together a gcc-4.1.1 with glibc-2.2.5 toolchain using Crosstool. Nothing yet, perhaps someone can help me with this confusing glibc stuff.

edit: Your buildscript is giving me ideas :)
 
Actually, I was quite wondering : why does nobody discuss about GPH toolchain ?
Because it isn't very good.
Could you develop, maybe tell me why "it isn't very good" ?





It's very useful for a building a dynamic linking toolchain, but I use devkitgp2x for static linking.

As far as I seen, dynamic linking is not the best solution because it considers that the user installed himself the required libraries.
But looking at devkitgp2x install script, I'm dubitative : I'm surely wrong but it looks like it should be called devkitarm rather than devkitgp2x, because it doesn't seem to care about the GP2x kernel. Could you give me an example of an application running on GP2x, which was build with devkitgp2x ?
 
Last edited by a moderator:
I'm trying to munge together a gcc-4.1.1 with glibc-2.2.5 toolchain using Crosstool. Nothing yet, perhaps someone can help me with this confusing glibc stuff.

edit: Your buildscript is giving me ideas :)

Well, I think that you could easily build a toolchain using gcc-4.1.1. But rather with glibc-2.3.6 than glibc-2.2.5 ! the trouble is all these patches the SDK comes with... it will be necessary to update them to gcc-4.1.1.
 
Last edited by a moderator:
Could you develop, maybe tell me why "it isn't very good" ?
Because it doesn't come with anywhere near the number of libraries that other toolchains have, it used to be built with HW floating point (probably not the case now) and GPH made it ;) There isn't really any advantage to using it if they've started using a newer version of glibc - dynamic linking is much better than static, but if they've updated it, that advantage is gone :S You can't build the kernel with anything later than gcc 3.4 either.
 
Last edited by a moderator:
Could you develop, maybe tell me why "it isn't very good" ?
Because it doesn't come with anywhere near the number of libraries that other toolchains have, it used to be built with HW floating point (probably not the case now) and GPH made it ;) There isn't really any advantage to using it if they've started using a newer version of glibc - dynamic linking is much better than static, but if they've updated it, that advantage is gone :S You can't build the kernel with anything later than gcc 3.4 either.

The one that I have seems to provide static and dynamics libs for SDL, Vorbis, pthreads, png, jpeg. I currently haven't tested these libs, but they're located in /gp2xsdk/Tools/arm-gp2x-linux/libs.
By the way, why is it better to use the old glibc ?

I believe that it is impossible to build the kernel until we have version.h and autoconf.h files. These ones aren't present in the 2.0.0 or 2.1.x source branches you can find on http://svn.gp2x.com/gp2x/tag/kernel/. But they're in the 1.4.0 branch, and simply taking them from here allowed me to compile the SDK with the 2.1.x kernel includes and gcc 4.0.3.

I'll tell you if I manage to do something with all that ;)
 
Last edited by a moderator:
I'm trying to munge together a gcc-4.1.1 with glibc-2.2.5 toolchain using Crosstool. Nothing yet, perhaps someone can help me with this confusing glibc stuff.

edit: Your buildscript is giving me ideas :)

Well, I think that you could easily build a toolchain using gcc-4.1.1. But rather with glibc-2.3.6 than glibc-2.2.5 ! the trouble is all these patches the SDK comes with... it will be necessary to update them to gcc-4.1.1.

I'm trying to build a toolchain that is more compatible to GPH's firmware so that you can use dynamic linking. Add scratchbox and porting becomes easy.

Knowing GPH, they probably didn't update glibc.

edit: I just check it, it IS 2.2.5.
 
Last edited by a moderator:
I generally use dynamic linking now, unless I need a feature that is only provided in glibc 2.3. You can just include libraries the GP2X doesn't have by default with the program and it works fine.
 
GCC-3.4.5 softfloat arm + glibc 2.3.6 built. Hello World compiles and runs on GP2X (dynamically linked, I doubt that everything in glibc 2.3.6 works though).
 
I managed to cross-compile my first app using the GPH toolchain I compiled.
It's bzip2, take it here if you like. But now, since it's a console app, I have a question : how to see the default help message appear on my GP2x screen ?

I believe that it worked, because I got back to the GP2x menu after the execution. Il tried to add a "sleep 10" command after lauchning bzip2 but nothing appeared... :unsure:
 
Last edited by a moderator:
Have you tried using STerm / or via a ssh-conection - it should be the tool of choice to debug console apps

Thanks for the advice, I'll try this evening to see what happens. Indeed, I didn't even know STerm :ph34r:
and I wondered why Midnight Commander was crashing my handheld...
 
Last edited by a moderator:
GCC-3.4.5 softfloat arm + glibc 2.3.6 built. Hello World compiles and runs on GP2X (dynamically linked, I doubt that everything in glibc 2.3.6 works though).

How do you compile GCC with softfloat ? I would be interested... You're using softfloat because it's to be faster than GP2X hardfloat, am I wrong ?
 
Last edited by a moderator:
I don't know exactly how its configured, at the moment I'm just hacking around with Crosstool trying to get a higher gcc with a lower glibc and a higher binutils going, step by step until I get gcc 4.1.1 + glibc 2.2.5 + binutils 2.17 + Linux headers 2.4.25 working.

The hope is to get a cutting-edge toolchain that is compatible with GPH firmware.

According to the arm-softfloat.dat the following options are used for every compiler built with the arm-softfloat.sh script (other things like gcc/glibc versions are set elsewhere):

TARGET=arm-softfloat-linux-gnu
TARGET_CFLAGS="-O"
GCC_EXTRA_CONFIG="--with-float=soft"
GLIBC_EXTRA_CONFIG="--without-fp"

Hardware float was supported by few ARM chips and nowadays I think there are no more that do. Hardware floating point operations cause an invalid opcode exception, the kernel handles this exception and emulates the opcodes, but the software implementation in gcc is faster.
 
If you get that toolchain working, I'd love to get a copy of it... but I'm pretty sure gcc4 and glibc 2.2.5 don't play nice.
 
Back
Top