gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > devkitARM with DevKit Advance's crtls?

#16881 - tepples - Thu Feb 26, 2004 8:23 am

I'm tired of slow compiled code and want to try out the new -fnew-ra register allocator, which is said to help GCC's ARM7 code generator greatly. How would I go about replacing the GCC 3.2.2 in DevKit Advance R5b3 (for Windows 2000) with a newer GCC? Or, how would I extract the crt0 and linker script from DKA R5b3 and install it into, say, Wintermute's devkitARM?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#19566 - wintermute - Thu Apr 22, 2004 2:07 am

tepples wrote:
I'm tired of slow compiled code and want to try out the new -fnew-ra register allocator, which is said to help GCC's ARM7 code generator greatly. How would I go about replacing the GCC 3.2.2 in DevKit Advance R5b3 (for Windows 2000) with a newer GCC? Or, how would I extract the crt0 and linker script from DKA R5b3 and install it into, say, Wintermute's devkitARM?


the short answer is that the crtls from devkitadvance won't work with devkitARM. The latest version of binutils won't deal with the conditional elements in the linkscript unfortunately. I'm reverting to binutils 2.14 for the next release ( which will be gcc 3.4) for that reason.

If I'm honest, I have to say that I dislike the 'standard' crtls intensely for a number of reasons. The linker script itself actually skips a few sections which are necessary when using standard library functions. The crt0, when you sit down and figure out the conditional elements, has a ridiculous number of variations. DMA used for clearing/copying or not, 3 flavours of interrupt support (in IWRAM or ROM), multiboot header section, and 2 potential names for the main function. Combined with the conditional elements of the linkscript which can put the heap in ewram or iwram and select a multiboot or cartridge image you then have a total of 128 possible configurations before you write a single line of code, none of which have working global constructors in C++ (or C using the gcc extensions).

What I've done with devkitARM is to strip back the crt0 to a basic configuration and relegate interrupt support to libgba. This currently only supports single interrupts but I'm planning to make nested interrupts the default configuration - the nitty gritty can be found in single_ints.s and interrupt.c within the libgba source. The code there also supports the BIOS interrupt functions which is not the case with the devkitadvance implementation.

I've tried to keep the headers in libgba as generic and standard as possible - the register names and function prototypes are based on the no$ documentation along with various helper macros I've found useful. With a bit of luck most current GBA code should be easily converted to make use of this set of headers and hopefully provide a framework for would be GBA developers.

I understand that a lot of people have their own libraries which are more comfortable through familiarity. Ideally I'd like to see more people make use of libgba, especially where tutorial sites and example code are concerned but I won't hold my breath :)

If you have any specific difficulties with devkitARM please feel free to join the mailing list found at http://groups.yahoo.com/group/devkitARM/ - you can also just send a blank mail to devkitARM-subscribe@yahoogroups.com which avoids having to set up a Yahoo account if you don't have one already.