This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Re: RedBoot initializers



Gary Thomas <gthomas@cambridge.redhat.com> writes:

> On 26-Feb-2001 Robin Farine wrote:
> > Hi,
> > 
> > I have added some custom functionalities to RedBoot that make use of the
> > 'RedBoot_init()' macro. However, I've got the following problem: if, for
> > instance, a module declares a RedBoot initialization routine 'read_config()'
> > with 'RedBoot_init(read_config, RedBoot_INIT_FIRST)', it will run *after*
> > 'net_init()' (declared with 'RedBoot_init(net_init, RedBoot_INIT_LAST)')
> > because the 'RedBoot_init()' macro uses qualified entries. To solve this
> > problem, I have changed the 'RedBoot_init()' definition
> > 
> > from:
> > 
> >   #define _RedBoot_init(_f_,_p_)               \
> >   struct init_tab_entry _init_tab_##_p_##_f_   \
> >   CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_inits,_f_) = { _f_ }; 
> > 
> > to:
> > 
> >   #define _RedBoot_init(_f_,_p_)               \
> >   struct init_tab_entry _init_tab_##_p_##_f_   \
> >   CYG_HAL_TABLE_ENTRY(RedBoot_inits) = { _f_ }; 
> > 
> > The original version of the macro uses the function name as qualifier for the
> > generated section's name; but the qualifier precedes '_init_tab_##_p_##_f_' in
> > the section's name and thus the priority does not have any effect in name
> > ordering. It seems to me that either the '_RedBoot_init()' macro should take the
> > qualifier as a third argument or it should use the non-qualifying
> > 'CYG_HAL_TABLE_ENTRY()' macro.
> > 
> > Did I miss something?
> 
> Yes and no.  The use of a qualified entry _is_ necessary in order to obtain
> priorities.  However, the priority needs to get in there somehow. I'm looking
> at how to improve this - watch here for more details.

Turns out Gary fixed this a while ago.

    2001-02-28  Gary Thomas  <gthomas@redhat.com>

	* include/redboot.h: Fix prioritization of 'init' table entries.

and the fixed version is:

#define _RedBoot_init(_f_,_p_)                                          \
struct init_tab_entry _init_tab_##_p_##_f_                              \
  CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_inits,_p_##_f_) = { _f_ }; 

in other words, the priority is a prefix on the qualification text, so it
takes precedence.

	- Huge


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