The T-Kernel initialization sequence is partitioned into four deterministic phases:
The core kernel startup function tkstart() performs internal data structure setup and spawns the initial system task:
/* System Main Entry Task Configuration */
LOCAL const T_CTSK c_sysmain_task = {
.exinf = NULL,
.tskatr = TA_HLNG | TA_ACT,
.task = (FP)sysmain,
.itskpri = 1, /* Highest System Priority */
.stksz = 8192, /* System Task Stack Size */
};
/* Core Entry Point Called from Low-Level Reset Routine */
EXPORT ER tkstart( void ) {
/* Initialize Kernel Data Structures & Ready Queues */
knl_init();
/* Initialize System Tick Timer */
timer_initialize();
/* Initialize VirtIO Drivers & Subsystems */
virtio_driver_init_all();
/* Start Scheduling & Spawn System Main Task */
return tk_cre_tsk(&c_sysmain_task);
}
The sysmain function serves as the top-level application initialization task:
EXPORT INT sysmain( INT argc, CHAR *argv[] ) {
printf("[T-KERNEL] System Main Task started successfully.\n");
/* Launch BTRON Window Manager & Accessories */
btron_kernel_init(1);
return 0;
}