T-Kernel 2.0 Startup Process



1. Introduction

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.

2. Reset/T-Monitor Startup Processing

When the system resets, T-Monitor will start first and then run the following processes.

  1. (1) Reset initialization process

  2. (2) Loading the T-Kernel program

    1. The processes which are run depend on the hardware and implementation but are basically as follows.
  3. (3) Launching T-Kernel

    1. 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.

    2. After T-Kernel starts up, T-Monitor is not used except in the following cases.

3. System Startup Information

The following information must exist in memory when T-Kernel is launched.

  1. (1) ROM information ( rominfo )

    1. This is the system startup information allocated to a fixed ROM address. This is accessed by both T-Monitor and T-Kernel.

    2. This information depends on the hardware and implementation.

  2. (2) System shared information ( SysCommonInfo )

    1. 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.

    2. This information depends on the hardware and implementation.

4. T-Kernel/OS Initialization Processing

When control shifts to the T-Kernel start address "_start", T-Kernel/OS initialization processing is run with the following procedure.

  1. (1) _start - C initialization routine [ sysdepend/device/<Model Name>/icrt0.S ]

    1. This performs the pre-processing to run programs such as initializing registers, cache, and variable areas.

    2. The ROM_startup [ sysdepend/device/<Model Name>/devinit.c ] initialization routine is called when starting from the ROM.

    3. This routine depends on the hardware and implementation.

  2. (2) main - Kernel main routine [ sysinit/src/sysinit_main.c ]

    1. 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 ).

    2. It does not return from the kernel main process.

  3. (3) init_system - kernel initialization process [ sysinit/src/sysstartup.c ]

    1. 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.

    2. The initialization processes performed here initialize the functions required to launch T-Kernel/OS such as the kernel memory management.

    1. (a) init_device - device initialization [ sysdepend/device/<Model Name>/devinit.c ]

    2. (b) init_subsystems - subsystem initialization [ extension/startup/<EXT_STUP>/subsystem.c ]

    3. (c) init_segmgr - segment management initialization [ extension/memory/<EXT_MEM>/segmgr.c ]

    4. (d) init_memmgr - memory management initialization [ extension/memory/<EXT_MEM>/memmgr.c ]

    5. (e) init_Imalloc - kernel management initialization [ sysmgr/src/imalloc.c ]

  4. (4) t_kernel_main - Kernel main process [ tkernel/src/tkstart.c ]

    1. 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.

    2. The T-Kernel/OS startup process shuts down when the initial tasks launch.

    1. (a) cpu_initialize - CPU related initialization process [ sysdepend/cpu/<Model Name>/cpu_init.c ]

      1. Runs the initialization processes that depend on the CPU such as registering the exception handler used in the kernel and the coprocessor related settings.

    2. (b) tkdev_initialize - Device related initialization process [ sysdepend/device/<Model Name>/tkdev_init.c ]

      1. Runs the initialization processes that depend on non-CPU hardware such as disabling interrupts for each device.

    3. (c) Initialization of each function module

      1. Initialization routines for the function modules are run in the following order.

        • task_initialize - Task function [ tkernel/src/task.c ]
        • semaphore_initialize - Semaphore function [ tkernel/src/semaphore.c ]
        • eventflag_initialize - Event flag function [ tkernel/src/eventflag.c ]
        • mailbox_initialize - Mailbox function [ tkernel/src/mailbox.c ]
        • messagebuffer_initialize - Message buffer function [ tkernel/src/messagebuf.c ]
        • rendezvous_initialize - Rendezvous function [ tkernel/src/rendezvous.c ]
        • mutex_initialize - Mutex function [ tkernel/src/utex.c ]
        • memorypool_initialize - Variable length memory pool function [ tkernel/src/mempool.c ]
        • fix_memorypool_initialize - Fixed length memory pool function [ tkernel/src/mempfix.c ]
        • cyclichandler_initialize - Periodic handler function [ tkernel/src/time_calls.c ]
        • alarmhandler_initialize - Alarm handler function [ tkernel/src/time_calls.c ]
        • subsystem_initialize - Subsystem function [ tkernel/src/subsystem.c ]
        • resource_group_initialize - Resource group management [ tkernel/src/subsystem.c ]
        • timer_initialize - System timer [ tkernel/src/timer.c ]
    4. (d) init_task_startup - Initial task generation/startup [ tkernel/src/tkstart.c ]

      1. Generate and start initial tasks.

5. Startup Processing by 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. (1) start_system - Higher-level system start up [ sysinit/src/sysstartup.c ]

    1. 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.

    1. (a) start_segmgr - Segment management startup [ extension/memory/<EXT_MEM>/segmgr.c ]

    2. (b) start_memmgr - Memory management startup [ extension/memory/<EXT_MEM>/memmgr.c ]

    3. (c) SystemManager - T-Kernel/SM startup [ sysmgr/src/smmain.c ]

      1. Starts up the T-Kernel/SM. Following that, the T-Kernel/SM functions can be used.

    4. (d) _InitLibtk - Library( libtk ) initialization [ ../lib/libtk/src/libinit.c ]

      1. Initialize the libtk library. Following that, the libtk library functions can be used.

    5. (e) start_device - Device driver startup [ sysdepend/device/<Model Name>/devinit.c ]

      1. Starts and registers the device drivers.

    6. (f) start_subsystem - Subsystem start up [ extension/startup/<EXT_STUP>/subsystem.c ]

      1. 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. (2) init_task_main - Initial task main process [ sysmain/src/init_task_main.c ]

    1. Processing of user-defined applications is executed with the following procedure.

    1. (a) userinit - User-defined initialization process

      1. The userinit program is run if the userinit address of the ROM information (rominfo) is valid.

    2. (b) usermain - User-defined initial task main process [ sysmain/src/usermain.c ]

      1. 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.