[ECOS] static initialization order - looks backwards to me??

Tom Malcolmson Tom@Malcolmson.com
Tue Nov 14 17:46:00 GMT 2006


The order in which the static constructors are called (as defined in 
cyg_type.h) looks right 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.

So, in my code, the idle thread gets initialized before the scheduler.  
This means that set_idle_thread sets the idle thread in the scheduler, 
but then this gets lost when the scheduler initializes.  This must be wrong.

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.

Thanks,
Tom.

-- 
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