Changes between Version 9 and Version 10 of BuildSystemDev


Ignore:
Timestamp:
Dec 18, 2012, 4:20:23 PM (11 years ago)
Author:
becoulet
Comment:

init tokens stuff

Legend:

Unmodified
Added
Removed
Modified
  • BuildSystemDev

    v9 v10  
    139139Having all modules and features initialized in proper order is challenging in a modular and configurable project like MutekH.
    140140
    141 The configuration tool offers a way to specify initialization code ordering constraints and to optionally associate them to configuration tokens.
     141The configuration tool offers a way to specify initialization code ordering constraints and to 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 constraint.
     145 * It ensures initialization function invocations do not get badly reordered to satisfy a new constraint, while ignoring an older constraints.
    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 the configuration output.
     148These tokens live in a separate name space from configuration tokens and are not exported in the configuration header output.
    149149Instead 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.
    150150An error will be emitted if constraints can not be satisfied.
    151151
     152The MutekH startup process based on this tool is described in the KernelStartUp page.
     153
    152154=== Constraint tags ===
    153155
    154156For each configuration token, one may use the following tags:
    155157 `parent CONFIG_TOKEN`::
    156    When this tag is present, the initialization rules described in the block are ignored if the associated configuration token is undefined.
     158   Defines the parent configuration token associated to the initialization token. The initialization is disabled if the associated configuration token is not defined.
     159 `condition CONFIG_TOKEN_CONDITION […]`::
     160   This tag can be used to define some conditions which have to be true for the initialization to actually take place. When Multiple condition tag lines are specified, the initialization token is enabled if at least one of lines define a set of conditions which are all true.
    157161 `after INIT_TOKEN`::
    158162   This tag imposes the requirement that the code from current token be executed '''after''' the code associated with INIT_TOKEN.
     
    160164   This tag imposes the requirement that the code from current token be executed '''before''' the code associated with INIT_TOKEN.
    161165 `during INIT_TOKEN`::
    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.
     166   This tag makes the current token inherits from constraints expressed for the given INIT_TOKEN. This tag is used to define a hierarchy between initialization tokens.
     167 `function init_function_name cleanup_function_name`::
     168   This tag associates some initialization and cleanup C function names to the token. The cleanup function is optional. When this tag is not present, the token is a place holder token.
    165169 `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.
    167 
     170   This tag sets a list of arguments used as init and cleanup functions prototype. It may be used on place holder tokens so that the prototype is valid for all function provided by inheriting tokens in the hierarchy.
     171 `flags calls`::
     172   This flag specifies that C macros with names such as `token_PROTOTYPES`, `token_INIT` and `token_CLEANUP` must be generated. The generated macros contain prototypes and function calls for all enabled inheriting tokens.
     173 `flags notempty`::
     174   This flag can be used to prevent an initialization stage to be empty. When this flag is present and the token is enabled, at least one function call must be generated by an other enabled inheriting token in the hierachy.
    168175=== Example ===
    169176
     
    171178{{{
    172179%init INIT_LIBRARIES
     180  parent CONFIG_MUTEK
    173181  after INIT_SCHEDULER
    174182  before INIT_APPLICATION
     183  flags calls
    175184%init end
    176185}}}
     
    180189  during INIT_LIBRARIES
    181190  after INIT_LIBC_STDIO      # an explanation why this is needed
    182   functions great_feature_init great_feature_cleanup
     191  function great_feature_init great_feature_cleanup
    183192%init end
    184193}}}
    185194
    186 This will generate the following macros for use in MutekH source code, provided that the CONFIG_FEATURE token is defined in build configuration:
     195This will generate the following C macros for use in the kernel source code, provided that the CONFIG_FEATURE token is defined in the build configuration:
    187196
    188197{{{
     
    197206  great_feature_claenup(__VA_ARGS__); \
    198207}}}
     208
     209The BuildSystem page describes how to display active intialization tokens for a given configuration along with function calls order and tokens hierarchy.
    199210
    200211= Source tree `Makefile` syntax and rules =