[ECOS] order of calling for static initializers

Andrew Lunn andrew@lunn.ch
Mon Nov 27 22:29:00 GMT 2006

On Mon, Nov 27, 2006 at 04:21:49PM -0500, Tom Malcolmson wrote:
> The '#define' statements that control the order in which statics get 
> called at startup (as defined in cyg_type.h) looks reasonable to me:
> #define CYG_INIT_HAL                    10000
> #define CYG_INIT_SCHEDULER              11000
> #define CYG_INIT_INTERRUPTS             12000
> #define CYG_INIT_DRIVERS                13000
> #define CYG_INIT_CLOCK                  14000
> #define CYG_INIT_IDLE_THREAD            15000
> etc.
> The list is populated in the linker script with SORT.  Fine.  But the
> code that calls them (for the platforms I looked at) goes thru the list
> in reverse order.

Correct. SORT put them into reverse order, at least it does for synth,
which i just look at the output from ld with gdb.

> I am using a different compiler (Code Sorcery) and had to compensate
> accordingly, so my problem probably starts there, but I don't understand
> what I am doing wrong.  It looks like things are being initialized in
> the reverse order on purpose.  I tried simply reversing the order in
> which things were called, but that caused other problems.

You probably need to unsure all SORTed symbols are in reverse order.


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list