This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

order of calling for static initializers



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.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]