DJWillis
Random GP32/GP2X/Wiz & Pandora Moocher
All,
Just to confirm what has been said and state the situation with DevKitArm.
The solution is a lot less horrid then the examples shown above .
DevKitArm includes SPECS files to prevent just this problem for both the GamePark SDK and Mirko's/Non-SDK. –nostartfiles is a very bad idea and can lead to many, many issues when using C++ (and C under some odd circumstances) with things not being put together as you expect.
In order to use these specs you call -specs=gp32.specs or -specs=gp32_gpsdk.specs (If your using the GamePark SDK) when you link instead of calling a CRT0.O, a linker script or any other rubbish.
The correctly sets up the link order for all the start-up objects including all your C++ environment etc. etc. and passes the appropriate GP32 files from arm-elf/lib in when required.
To give an example of how this is used I have snipped this from the sample DevKitArm makefiles I hand out. It’s for the GPSDK specs but you should get the idea.
Notice the lack of a linker script and don’t forget to ditch CRT0.O from your compile setup oh and PLEASE remove –nostartfiles .
One last tip, don't link with LD directly go via your compiler .
On another note, the best tuning flag for the GP32 (with recent GCC builds) would be
-mtune=arm920t (yes, the arm920t IS a valid opt flag on GCC 3.3 and up) just resolves to -march=armv4t under the hood anyway.
I use the setup I have just described with the GP32 SDK, DevKitArm (and for that matter, all manor of hand built GCC’s) with my C++ projects, ScummVM etc. and it works very nicely.
One thing to be aware of is that the files I patched for the basis of the GP32_GPSDK.SPECS assume the start-up object to be main() not the Main() that gpstart.c files seem to be configured with (ADS handover?). The SDK pack from the DevKitArm site has a ‘good’ gpstart.c you can just compile and link if you want.
If you edit your gpstart.c you really should also set the return type of main() to be int not void as gpstart.c does.
I.e.
void Main (int arg_len, char * arg_v)
becomes
int main (int arg_len, char * arg_v)
Thats it for now .
Just to confirm what has been said and state the situation with DevKitArm.
The solution is a lot less horrid then the examples shown above .
DevKitArm includes SPECS files to prevent just this problem for both the GamePark SDK and Mirko's/Non-SDK. –nostartfiles is a very bad idea and can lead to many, many issues when using C++ (and C under some odd circumstances) with things not being put together as you expect.
In order to use these specs you call -specs=gp32.specs or -specs=gp32_gpsdk.specs (If your using the GamePark SDK) when you link instead of calling a CRT0.O, a linker script or any other rubbish.
The correctly sets up the link order for all the start-up objects including all your C++ environment etc. etc. and passes the appropriate GP32 files from arm-elf/lib in when required.
To give an example of how this is used I have snipped this from the sample DevKitArm makefiles I hand out. It’s for the GPSDK specs but you should get the idea.
Code:
LDSPECS = -specs=gp32_gpsdk.specs
LDFLAGS = $(LDSPECS) \
-Wl,-Map,$(MAPFILE) \
$(LIBDIRS) \
$(GP_LIBS) \
$(LIBS_USER)
Notice the lack of a linker script and don’t forget to ditch CRT0.O from your compile setup oh and PLEASE remove –nostartfiles .
One last tip, don't link with LD directly go via your compiler .
On another note, the best tuning flag for the GP32 (with recent GCC builds) would be
Code:
-march=armv4t
-mtune=arm920t (yes, the arm920t IS a valid opt flag on GCC 3.3 and up) just resolves to -march=armv4t under the hood anyway.
I use the setup I have just described with the GP32 SDK, DevKitArm (and for that matter, all manor of hand built GCC’s) with my C++ projects, ScummVM etc. and it works very nicely.
One thing to be aware of is that the files I patched for the basis of the GP32_GPSDK.SPECS assume the start-up object to be main() not the Main() that gpstart.c files seem to be configured with (ADS handover?). The SDK pack from the DevKitArm site has a ‘good’ gpstart.c you can just compile and link if you want.
If you edit your gpstart.c you really should also set the return type of main() to be int not void as gpstart.c does.
I.e.
void Main (int arg_len, char * arg_v)
becomes
int main (int arg_len, char * arg_v)
Thats it for now .