This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: order of calling for static initializers
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Tom Malcolmson <Tom at Malcolmson dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 27 Nov 2006 23:29:07 +0100
- Subject: Re: [ECOS] order of calling for static initializers
- References: <456B56ED.7040908@Malcolmson.com>
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.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss