Changes between Version 8 and Version 9 of BuildSystemDev


Ignore:
Timestamp:
Oct 11, 2012, 4:19:51 PM (12 years ago)
Author:
becoulet
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BuildSystemDev

    v8 v9  
    137137
    138138Initialization order of different software components at system start needs close attention.
    139 Having all modules and features initialized in proper order is challenging in modular and configurable projects like MutekH.
    140 
    141 The configuration tools offers a way to specify initialization code ordering constraints and to optionally associate them to configuration tokens.
     139Having all modules and features initialized in proper order is challenging in a modular and configurable project like MutekH.
     140
     141The configuration tool offers a way to specify initialization code ordering constraints and to optionally associate them to configuration tokens.
    142142This has several advantages:
    143143 * It allows inserting external modules initialization code in the right place without patching the main tree.
    144144 * It avoids the burdensome work of maintaining initialization function calls and associated `#ifdef` directives.
    145  * It ensures initialization function invocations do not get badly reordered to satisfy a new constraint, while ignoring an older one.
     145 * It ensures initialization function invocations do not get badly reordered to satisfy a new constraint, while ignoring an older constraint.
    146146
    147147Initialization tokens can be declared for that purpose, each specifying a different stage in the MutekH initialization process.
    148 These tokens live in a separate name space from configuration tokens and are not exported in configuration output.
    149 
    150 A C source file will be automatically generated with initialization code from active tokens, respecting ordering constraints and current configuration.
     148These tokens live in a separate name space from configuration tokens and are not exported in the configuration output.
     149Instead a set of function prototypes and properly ordered function calls code are written as C macros which can then be invoked at the right place in the kernel code.
    151150An error will be emitted if constraints can not be satisfied.
    152151
     
    161160   This tag imposes the requirement that the code from current token be executed '''before''' the code associated with INIT_TOKEN.
    162161 `during INIT_TOKEN`::
    163    This tag makes the current token inherits from constraints expressed for the given INIT_TOKEN. The given token must be a place holder token and can not have associated code.
    164  `code C code here`::
    165    This tag associates some initialization C code to the token. This tag may be used multiple times to add more code lines.
     162   This tag makes the current token inherits from constraints expressed for the given INIT_TOKEN. This token must be a place holder token and can not have associated functions.
     163 `functions init_function_name cleanup_function_name`::
     164   This tag associates some initialization and cleanup C function names to the token. The cleanup function is optional.
     165 `prototype type arg0, type *arg1`::
     166   This tag sets a list of arguments used in init and cleanup functions prototypes. It must be used on the root place holder tokens so that the prototype is valid for all functions of children tokens.
    166167
    167168=== Example ===
     
    179180  during INIT_LIBRARIES
    180181  after INIT_LIBC_STDIO      # an explanation why this is needed
    181   code great_feature_init();
     182  functions great_feature_init great_feature_cleanup
    182183%init end
     184}}}
     185
     186This will generate the following macros for use in MutekH source code, provided that the CONFIG_FEATURE token is defined in build configuration:
     187
     188{{{
     189#define INIT_LIBRARIES_PROTOTYPES \
     190  void great_feature_init(); \
     191  void great_feature_cleanup();
     192
     193#define INIT_LIBRARIES_INIT(...) \
     194  great_feature_init(__VA_ARGS__); \
     195
     196#define INIT_LIBRARIES_CLEANUP(...) \
     197  great_feature_claenup(__VA_ARGS__); \
    183198}}}
    184199