init: Add init system calls to micro and nano kernel init

Add the call sites for the various init levels defined by the init
system.

These call sites are noops if there is no init proceedure registered
at a given init level.

pre_app_init has been renamed to app_early_init and late_initconfig to
app_late_init to better reflect the ordering and intended use of these
init levels

Change-Id: I71e38d936a97da8fe163f4b7cf0ce6725f1c903e
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
This commit is contained in:
Dirk Brandewie 2015-06-24 08:22:56 -07:00 committed by Anas Nashif
commit ac3fdf0be1
5 changed files with 72 additions and 10 deletions

View file

@ -42,6 +42,8 @@ This module contains routines that are used to initialize the nanokernel.
#include <sections.h>
#include <toolchain.h>
#include <nano_private.h>
#include <device.h>
#include <init.h>
/* kernel build timestamp items */
@ -118,6 +120,34 @@ extern void _Ctors(void);
#define initialize_nano_timeouts() do { } while ((0))
#endif
/**********************************************************************
*
* In the nanokernel only configuration we still want to run the
* app_{early,late}_init levels to maintain the correct semantics. In
* a microkernel configuration these init levels are run in the
* microkernel initialization.
*
*/
#ifdef CONFIG_NANOKERNEL
static void _main(void)
{
_sys_device_do_config_level(NANO_EARLY);
_sys_device_do_config_level(NANO_LATE);
_sys_device_do_config_level(APP_EARLY);
_sys_device_do_config_level(APP_EARLY);
main();
}
#else
static void _main(void)
{
_sys_device_do_config_level(NANO_EARLY);
_sys_device_do_config_level(NANO_LATE);
main();
}
#endif
/*******************************************************************************
*
* nano_init - initializes nanokernel data structures
@ -169,7 +199,7 @@ static void nano_init(tCCS *dummyOutContext)
_NewContext(main_task_stack, /* pStackMem */
CONFIG_MAIN_STACK_SIZE, /* stackSize */
(_ContextEntry)main, /* pEntry */
(_ContextEntry)_main, /* pEntry */
(_ContextArg)0, /* parameter1 */
(_ContextArg)0, /* parameter2 */
(_ContextArg)0, /* parameter3 */
@ -252,6 +282,7 @@ FUNC_NORETURN void _Cstart(void)
/* perform basic hardware initialization */
_InitHardware();
_sys_device_do_config_level(PURE);
/*
* Initialize random number generator