GP32 Compiling Gcc...


JRyouK

Still Fresh
Joined
Feb 14, 2003
Messages
34
i wanna compile a gcc myself, i am using Win2k + cygwin
i've found some information on compiling gcc, one is from Mr. Mirko and the other is from Cobbleware.

they both use the same argument for compiling binutils and newlib,
but i am confused about the different argument they used when compiling gcc, for example:
, the "CFLAGS", "-pipe -s" or "-pipe 03" which is right or better?
should i used "-mthumb-interwork"? And the difference of having "-s" and without it?

anyone can clarify it? thanks in advance!



JRyouK
 
Last edited by a moderator:
The command line options are pretty simple, although there are rather a lot of them. They are documented at the gcc website. Just quickly,
  • -pipe doesn't affect code generation, it just makes the various passes of the compiler share information through pipes rather than external files, which speeds things up.
  • -s tells the compiler to strip debug information from the final output, which makes the generated files smaller.
  • -O3 (not "O3") tells the compiler to optimise the code to level 3, which is the highest level in gcc. This produces output which is generally bigger, and runs faster than -O2, -O1 etc.
-mthumb-interwork only applies to the arm version of gcc. Arm processors can run in 2 modes, "Arm" mode which uses 32-bit instructions, and "Thumb" mode which uses 16-bit instructions. Depending on what your program is doing, you can choose the best one for the task (although I always use Arm mode). A program can mix Arm and Thumb code, but if it does it needs the -mthumb-interwork switch to tell it to generate the right code for switching between modes.

Also, if you are linking to some-one else's code, all of the code needs to have the same thumb-interwork switch: if you compile some code with -mthumb-interwork and some code with -mno-thumb-interwork, the linker will complain when you try to link them together. The gamepark sdk libraries have thumb-interwork, so your programs also need it to link to the sdk libraries. I'm not sure about mr. mirko's sdk.

The final thing though, is that there's not much difference in speed or size between programs compiled with thumb-interwork or no-thumb-interwork, so just use whichever works :D
 
>, the "CFLAGS", "-pipe -s" or "-pipe 03" which is right or better?
>should i used "-mthumb-interwork"? And the difference of having "-s" and >without it?

The LFS site says, that it is unsave compiling gcc itself with -O[1-3],
it will produce a compiler, producing unstable code.

You can compile the newlib with -O3, this is save.
But the resulting code is only bigger ( about 20% ) and not faster.

Thumb interwork, will only blow up stuff, all the switching between the modes, and the resulting code produced by gcc is not faster.
Thumb code is nice, if you programm it directly in asm ...
 
JRyouK,

There is a half finished guide I started here that shows how to do a GCC 3.3.2 build under CygWin.

It’s basically the same as Rob's guide but for Win32 systems.

As for -mthumb-interwork, you will need it on if you want to use the GamePark SDK, it is very slightly slower but you would never notice. All apps that use the GamePark SDK (Not Mirko's) will need Thumb Interworking on.

Just building your own GCC 3.3.2(3 now) or higher will be a vast improvement over the old version of GCC in DevKitAdv/GP32 :D.
 
mr.mirko posted on Apr 12 2004 at 02:29 PM said:
The LFS site says, that it is unsave compiling gcc itself with -O[1-3],
it will produce a compiler, producing unstable code.
This is not only unsafe, it leads to serious errors in some cases (I remember one bug when compiling gcc with -O3 and -march=pentium4). ;)
 
Last edited by a moderator:
cause I don't have the bandwith mor the knwoledge to compile mz own up2date version of gcc, it would be nice if you could provide of zour build..
 
synkro posted on Apr 13 2004 at 02:17 PM said:
cause I don't have the bandwith mor the knwoledge to compile mz own up2date version of gcc, it would be nice if you could provide of zour build..
It’s not very easy to redistribute a hand-built GCC as it tends to be compiled to suit ‘your’ PC, ‘your’ install of CygWin and personally chosen setup infor like folders etc..

It should be possible to produce a more generic build of GCC 3.3.3 to work like DevKitAdv but that is no small job to get working (I have started to look at it but stopped due to lack of free time).
 
Last edited by a moderator:
The gcc I released with the MrMirko pack has gcc 3.4 compiled under cygwin using MrMirko's instructions.
 
Back
Top