Rebecca Lovelace wrote:
> Next question, where can I get the correct copy of crtbegin.o? It's not in
> my distribution, I tried DL-ing the c and c++ versions just in case and it
> was in neither.
You can probably get it in DevKitAdvance.
> What does crtbegin.o do? What was it compiled from?
I believe it is used for C++ constructor setup, etc.
> Finally, what is the story with crt0.s? It seems to set things up and
> branch to your C code, so is it required in all GCC projects?
I've added another FAQ below.
http://www.devrs.com/gba/files/gbadevfaqs.php#StartUp
Q: What are crt0.S/lnkscript (GCC) and start.s (SDT/ADS) used for in a project?
A: crt0.S and start.s (sometimes start.asm) both have similar functions.
-They are mainly designed to execute assembly code that occurs before
-user compiled code is executed; usually for initialization purposes.
-(Sometimes these files will contain other assembly code as well like
-interrupt support, etc.) The most common usage is to set uninitialized
-global variable RAM to 0 and to copy initialized global variables from
-ROM to RAM. A bare minimum crt0.S or start.s file must at least contain
-a branch to the start of compiled code, even if it contains nothing else.
-(The S of crt0.s is often capitalized because the GCC docs
-mention that it must be this way if you ever wish to run the GCC
-preprocessor on this file.)
-
-lnkscript is a linker script used by GCC that tells the linker where to
-put various sections (.text/.data/.rodata/.iwram/etc..) in the GBA
-memory map. Often a particular crt0.s and lnkscript may be designed
-to work together so they are often distributed together. Some GCC
-compilers (i.e. DevKitAdvance) may include a default lnkscript
-compiled into the compiler itself which will be used if the user
-doesn't specify a lnkscript file.
Jeff