Purpose of startup files for ARM

Richard Earnshaw rearnsha@arm.com
Wed Oct 8 10:02:00 GMT 2003


> David Mc Kenna wrote:
> 
> >Hi folks,
> >
> >Does anyone know what the standard startup files, excluded by using the command
> >-nostartfiles, are expected to do and if they are necessary? 
> >
> >The reason I ask is that I have a chip with no ANGEL, or similar monitor, on
> >board, and the startup routines included by GCC by default includes SWI calls
> >with codes which suggest a monitor is used.
> >  
> >
> In this case, you can write your own crt0.S.  crt0.S does the following  
> work:
> initialize the hardware, e.g., the SDRAM
> set the sp register to some place in the higher memory
> initialize the .bss sections
> copy the .data section from ROM to RAM if you're writing a rom application

Almost.. You missed the following.
- run any library initialization routines
- run any constructors

> call the main function
> 

- handle main returning (call exit)

Some of this needs to be in collusion with your C library.  newlib doesn't 
require very much.

Note that newlib also has library calls that call the ANGEL SWI.  You will 
have to rewrite the relevant stubs if you want to use the calls.

R.


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list