This section explains the T-Kernel 2.0 startup processing.
Please refer to the "Implementation Specifications" for each model regarding hardware and implementation specific processing.
When the system resets, T-Monitor will start first and then run the following processes.
(1) Reset initialization process
This process performs initialization processes such as hardware initialization and exception/interrupt vectors. The specific processes depend on the hardware and implementation.
The resetinit program is run if the resetinit address of the ROM information (rominfo) is valid.
(2) Loading the T-Kernel program
If a bootable disk exists
The boot program on the disk is loaded into RAM and executed. The boot program loads the required T-Kernel program from disk into RAM, jumps to the T-Kernel start address and launches T-Kernel.
If a bootable disk does not exist
If the kernel address of the ROM information (rominfo) is valid, it jumps to the kernel address and launches T-Kernel.
If the kernel address is not valid, then it waits for T-Monitor command input.
(3) Launching T-Kernel
The state of the CPU and hardware when jumping from T-Monitor or the boot program to the T-Kernel start address depends on the implementation, but in principle the CPU operates in privileged mode and all interrupts are prohibited.
After T-Kernel starts up, T-Monitor is not used except in the following cases.
System shutdown
tm_exit service call
Monitor is called when an abnormality occurs
tm_monitor service call
Console output for debugging
tm_putstring, tm_putchar service call
Exception or interrupt occurs
T-Kernel just set the handler's vector address in the vector table determined by the system. The T-Monitor exception/interruption processing routines perform the handler calls.
The following information must exist in memory when T-Kernel is launched.
(1) ROM information ( rominfo )
This is the system startup information allocated to a fixed ROM address. This is accessed by both T-Monitor and T-Kernel.
This information depends on the hardware and implementation.
(2) System shared information ( SysCommonInfo )
This is the shared information allocated to a fixed RAM address. This is set by T-Monitor during the system startup, and T-Kernel also sets a portion of the data when it launches. Following that, this information is accessed by both T-Monitor and T-Kernel.
This information depends on the hardware and implementation.
When control shifts to the T-Kernel start address "_start", T-Kernel/OS initialization processing is run with the following procedure.
[ xxxxx
] is the relative path name from the source program's "kernel/" of existing functions.
"<EXT_STUP>
" and "<EXT_MEM>
" are set to "noext" and "nommu" when there is no T-Kernel Extension. When Extension is used, they are set to a name corresponding to the Extension.
(1) _start - C initialization routine [ sysdepend/device/<Model Name>/icrt0.S
]
This performs the pre-processing to run programs such as initializing registers, cache, and variable areas.
The ROM_startup [ sysdepend/device/<Model Name>/devinit.c
] initialization routine is called when starting from the ROM.
This routine depends on the hardware and implementation.
(2) main - Kernel main routine [ sysinit/src/sysinit_main.c
]
Starts the T-Kernel/OS launch processing. This process calls the kernel main process ( t_kernel_main
) after calling the kernel initialization process ( init_system
).
It does not return from the kernel main process.
(3) init_system - kernel initialization process [ sysinit/src/sysstartup.c
]
This calls each routine of the kernel initialization process with the following procedure. T-Kernel is not running at this stage, so the T-Kernel system call cannot be used.
The initialization processes performed here initialize the functions required to launch T-Kernel/OS such as the kernel memory management.
(a) init_device - device initialization [ sysdepend/device/<Model Name>/devinit.c
]
(b) init_subsystems - subsystem initialization [ extension/startup/<EXT_STUP>/subsystem.c
]
(c) init_segmgr - segment management initialization [ extension/memory/<EXT_MEM>/segmgr.c
]
(d) init_memmgr - memory management initialization [ extension/memory/<EXT_MEM>/memmgr.c
]
(e) init_Imalloc - kernel management initialization [ sysmgr/src/imalloc.c
]
(4) t_kernel_main - Kernel main process [ tkernel/src/tkstart.c
]
Called after the init_system by the aforementioned main. Each of the T-Kernel/OS functions are initialized. Finally, the initial tasks are generated and it launches. All of the T-Kernel/OS functions are valid when the initial tasks are generated.
The T-Kernel/OS startup process shuts down when the initial tasks launch.
(a) cpu_initialize - CPU related initialization process [ sysdepend/cpu/<Model Name>/cpu_init.c
]
Runs the initialization processes that depend on the CPU such as registering the exception handler used in the kernel and the coprocessor related settings.
(b) tkdev_initialize - Device related initialization process [ sysdepend/device/<Model Name>/tkdev_init.c
]
Runs the initialization processes that depend on non-CPU hardware such as disabling interrupts for each device.
(c) Initialization of each function module
Initialization routines for the function modules are run in the following order.
tkernel/src/task.c
]tkernel/src/semaphore.c
]tkernel/src/eventflag.c
]tkernel/src/mailbox.c
]tkernel/src/messagebuf.c
]tkernel/src/rendezvous.c
]tkernel/src/utex.c
]tkernel/src/mempool.c
]tkernel/src/mempfix.c
]tkernel/src/time_calls.c
]tkernel/src/time_calls.c
]tkernel/src/subsystem.c
]tkernel/src/subsystem.c
]tkernel/src/timer.c
](d) init_task_startup - Initial task generation/startup [ tkernel/src/tkstart.c
]
Generate and start initial tasks.
The initial task init_task [ sysinit/sysinit_main.c
] transfers execution to processes defined by the user after running higher-level systems such as T-Kernel/SM and T-Kernel Extension startup processing in the following procedure.
(1) start_system - Higher-level system start up [ sysinit/src/sysstartup.c
]
Higher-level systems such as T-Kernel/SM and device driver startup processes are run with the following procedure. The T-Kernel initialization/startup process shuts down with this process.
(a) start_segmgr - Segment management startup [ extension/memory/<EXT_MEM>/segmgr.c
]
(b) start_memmgr - Memory management startup [ extension/memory/<EXT_MEM>/memmgr.c
]
(c) SystemManager - T-Kernel/SM startup [ sysmgr/src/smmain.c
]
Starts up the T-Kernel/SM. Following that, the T-Kernel/SM functions can be used.
(d) _InitLibtk - Library( libtk ) initialization [ ../lib/libtk/src/libinit.c
]
Initialize the libtk library. Following that, the libtk library functions can be used.
(e) start_device - Device driver startup [ sysdepend/device/<Model Name>/devinit.c
]
Starts and registers the device drivers.
(f) start_subsystem - Subsystem start up [ extension/startup/<EXT_STUP>/subsystem.c
]
Registers and starts the subsystems. When the T-Kernel Extension is in use, this registers and starts the subsystems and device drivers used by the Extension.
(2) init_task_main - Initial task main process [ sysmain/src/init_task_main.c
]
Processing of user-defined applications is executed with the following procedure.
(a) userinit - User-defined initialization process
The userinit program is run if the userinit address of the ROM information (rominfo) is valid.
(b) usermain - User-defined initial task main process [ sysmain/src/usermain.c
]
This is the main process of a user-defined initial task. Shutting down this process shuts down the initial task, runs the T-Kernel shutdown process, and shuts down the system.