Page 1 of 1

Prevent use of devkitARM's crt0.o

Posted: Wed Oct 01, 2008 9:55 am
by ArmRocks
Hi there. I'm trying to use devkitARM for my MX1 ARM920t target. I have my own crt0. Can I somehow prevent the use of the devkitARM crt0?

I have tried this in my ldscript:

Code: Select all

STARTUP(crt0.o)

SECTIONS
{
/* ... */
  . = 0x08000000;

  /* First code to execute */
  _start_crt0 : {
    *crt0.o (.text)
  }
/* ... */
However, this results in the following entries in the .map file:

Code: Select all

                0x08000000                . = 0x8000000

_start_crt0     0x08000000      0x50c
 *crt0.o(.text)
 .text          0x08000000      0x204 crt0.o
 .text          0x08000204      0x104 c:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.3.0/../../../../arm-eabi/lib/crt0.o
                0x08000204                _start
                0x08000204                start
                0x08000204                _mainCRTStartup
 .text          0x08000308      0x204 ..\Deliv\GnuArmRelease\src\crt0.o
So, if I'm reading this correctly, my crt0 is placed correctly, but it still uses the crt0 from devkitarm, and it seems like my crt0 is appended a second time?

Second problem: the _start, start and _mainCRTStartup symbols are defined in devkitARM's crt0, where I'm trying to define my start in my crt0.

Thanks!

Re: Prevent use of devkitARM's crt0.o

Posted: Thu Oct 02, 2008 3:32 am
by ingramb
I think you can set the crt0 file by making your own *.specs file, and then updating your make file to use it rather than the default.

Re: Prevent use of devkitARM's crt0.o

Posted: Thu Oct 02, 2008 9:02 am
by ArmRocks
ingramb wrote:I think you can set the crt0 file by making your own *.specs file, and then updating your make file to use it rather than the default.
Great! I actually gave that one a try already, but apparently I had the option set for compiling a single file, not for the linking stage.. I had some trouble to get only my crt0 linked, since the search path to where the compiler's built-in crt0 is located seems to be hard coded.
My link script is now changed using this:

Code: Select all

  /* First code to execute */
  _start_crt0 : {
    *Deliv*crt0.o (.text)
  }
Since my crt0 will be put in either [...]/Deliv/GnuArmDebug/[...] or [...]/Deliv/GnuArmRelease/[...]

Alas, the resulting binary still doesn't run properly.. Getting ready to warm up the debugger again :|