Changes between Version 7 and Version 8 of Developer/Projects/SequencedInitialization


Ignore:
Timestamp:
May 11, 2010, 12:56:19 PM (9 years ago)
Author:
Sh
Comment:

/* Implementation Alternatives */

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Projects/SequencedInitialization

    v7 v8  
    3535
    3636Code and data size measurements should be made before and after the implementation is done on the sparc/sis and arm/rtl22xx_t BSPs.  These BSPs are used for code size analysis across releases.
    37 = Implementation Alternatives =
     37= Implementation Details =
    3838
    3939= Definitions =
     
    7474 *  [CON] Depends on GNU linker feature.
    7575 *  [CON] Order information must be derived from the place in the linker set.  It is impossible to derive the order value specified at compile time.
     76
     77Linker command file example:
     78 .rtems : {
     79         . = ALIGN(8);
     80         rtems_sysinit_begin = .;
     81         *(SORT(.rtems.sysinit.*))
     82         rtems_sysinit_end = .;
     83 }
     84
     85Header file example:
     86 #define RTEMS_SYSINIT_MAKE_STRING(str) #str
     87 
     88 #define RTEMS_SYSINIT(group, func) \
     89         static const uintptr_t \
     90         rtems_sysinit_ ## func \
     91         __attribute__((section(".rtems.sysinit." RTEMS_SYSINIT_MAKE_STRING(group)))) \
     92         __attribute__((used)) \
     93         = (uintptr_t) &func
     94 
     95 extern uintptr_t rtems_sysinit_begin [];
     96 
     97 extern uintptr_t rtems_sysinit_end [];
     98= Initialization and Termination =
     99
     100
     101The sequenced initialization can be used also for termination. We have two alternatives here:
     102
     103# Add a second linker set for termination items.
     104# Use the initialization linker set and pass a state parameter to the initialization function.  The initialization functions should be called in reversed initialization order for termination.
     105
     106We should use the second approach.  This is more flexible and reduces the code inside the linker command files.  Linker command files are hard to maintain.
     107
     108Proposed API:
     109 typedef enum {
     110        RTEMS_SYSINIT_STARTUP,
     111        RTEMS_SYSINIT_TERMINATE
     112 } rtems_sysinit_state;
     113 
     114 typedef void (*rtems_sysinit_function)(rtems_sysinit_state state);
    76115= Open Projects =
    77116