Initialize data section in arm/crt0.S

Pilhofer, Frank
Tue Jul 15 15:30:00 GMT 2014


my motivation was to not replace crt0.S, and to use as much of the existing infrastructure and glue code as possible.

I have now solved my problem using a hand-written entry point (used as reset vector) that, as Richard suggested, initializes data and BSS. After that, it jumps to _mainCRTStartup() as supplied by libgloss, which does the rest (calling hardware_init_hook(), software_init_hook(), __libc_init_array(), and eventually main()). That seems reasonable.

One thing I haven't figured out yet is the common naming convention for the linker-provided symbols for the start and end addresses of the data section, if there is one.


-----Original Message-----
From: David Fernandez [] 
Sent: Dienstag, 15. Juli 2014 17:18
To: David Paterson; Pilhofer, Frank
Cc: Richard Earnshaw;
Subject: Re: Re: Initialize data section in arm/crt0.S

Not sure if newlib supports that but, aside from replacing crt0.S with your own special version, the linker scripts usually allow to have the code that you want in a .init<N> code section that gets merged into the final initialization code... That way your system can provide code for that initialization when producing the final binary.

Some newlib maintainer might comment about that.

David F.

More information about the Newlib mailing list