Game developers do not generally need to understand all the details of initialization. However, this may be of interest to system developers.
Here is a rough outline of the steps taken to initialize the FreeWPC environment:
main
function is called (on real hardware,
this is called from the RESET handler; in simulation, this is called
by the OS like any other executable). main
is a platform-dependent
function. It can be thought of as the continuation of low-level
initialization, except written in C.
main
calls into freewpc_init
, where the common
initialization begins. This is defined in kernel/init.c.
init
event is thrown
here, so any new subsystems added just need to catch this event to initialize
themselves. It is important that modules do not interact with each other during
this phase, because the order of init calls is not guaranteed.
init_ok
event is thrown to allow modules to perform a final
initialization, which may require interaction with each other. Modules can
return FALSE if a factory reset is required. In that case, the system will
reboot after performing the factory reset.
init_complete
event is thrown, to signal that all modules are
ready.