This document explains the T-Kernel 2.0 source code configuration.
For more information about the T-Kernel 2.0 functional specifications, please refer to the "T-Kernel 2.0 Specifications" released by TRON Forum, and "T-Kernel 2.0 (tef_em1d) Implementation Specification" for implementation dependencies.
The basic rules and terminology for the T-Kernel directory configuration are as follows.
Model Name
The hardware that T-Kernel runs on is described using the following <Model Name> format.
<Model Name>: <Board Name>_<CPU Name>
<Board Name> : Abbreviated name of the board type
<CPU Name> : Abbreviated name of the CPU type
The <Model Name> supported by this package is as follows.
ted_em1d :
<Board Name> : tef - T-Engine Reference Board
<CPU Name> : em1d - EMMA Mobile 1-D (ARM11 core)
Using the <Model Name> and the <CPU Name> as the subdirectory name enables support for multiple hardware platforms within one directory tree.
Source directory
This is the directory where source files are placed. As a general rule, it is named "src".
Build directory
This is the directory where the object files for each model are built. As a general rule, it is named "build/<Model Name>".
Run "make" in the build directory to build the object files.
"make" has the following targets, but you can create the build using only "make".
make The same as "make all"
make all Typical "make"
make install Copy the result to a predetermined directory
make clean Delete the result and initialize
make source Automatically generate the SVC/Extended SVC I/F source
make clean_source Delete the source generated with make source
make clean_all make clean + make clean_source
The build directory contains the Makefile and the build result object file needed to run make.
In a typical Makefile the common portions that are not dependent on the model are separated into Makefile.common and use an include. Makefile.common is placed in the source directory ("src/Makefile.common") or directly below the build directory ("build/Makefile.common").
Hardware dependent portion
This directory contains portions which are dependent on the target hardware and is named "sysdepend/<Model Name>" or "sysdepend/<CPU Name>". The latter is only used when it is CPU dependent.
Clearly separating the hardware dependent portions into a separate directory limits the necessary source confirmation/modification work when porting to new hardware, and it makes porting easier.
Application dependent portion
This is the portion which must be changed when actually developing applications and embedding them into products.
The application dependent portion must be created for each product, so a sample is provided in this package.
Kernel core
This provides the basic T-Kernel functionality which does not depend on the hardware or application.
The kernel core does not need to be changed as long as you do not modify the T-Kernel functions.
The directory configuration diagram for the entire T-Kernel source is described below.
The <Model Name> in this package is "tef_em1d", and the <CPU Name> is "em1d".
If it does not say that it is a "Hardware dependent portion" or an "Application dependent portion" then it is part of the kernel core.
Some directories contain files with the name "_dmy". These are dummy files that are included for the archiver to avoid having empty directories and are not needed after extraction.
tkernel_source
|
|-- kernel T-Kernel main part
| |-- sysinit System initialization
| | |-- src
| | `-- build
| | `-- <Model Name>
| |-- tkernel T-Kernel/OS
| | |-- src
| | `-- build
| | `-- <Model Name>
| |-- sysmgr T-Kernel/SM
| | |-- src
| | `-- build
| | `-- <Model Name>
| |-- sysmain System main
| | |-- src [Application dependent portion]
| | `-- build
| | `-- <Model Name>
| |-- sysdepend [Hardware dependent portion]
| | |-- cpu CPU dependent portion
| | | `-- <CPU Name>
| | `-- device Device dependent portion
| | `-- <Model Name>
| `-- extension Extension related portion
| |-- memory Memory management
| | `--nommu No MMU
| `-- startup Extension startup/shutdown process
| `--noext No Extension
|
|
|-- lib Library
| |-- build Object (build) directory
| | `-- <Model Name>
| |-- crt Start-up routine
| | |-- crt0 Common start-up routine
| | | |-- src
| | | | `-- sysdepend [Hardware dependent portion]
| | | | `-- <Model Name>
| | | `-- build
| | | `-- <Model Name>
| | `-- crttk T-Kernel program start-up
| | |-- src
| | | `-- sysdepend [Hardware dependent portion]
| | | `-- <Model Name>
| | `-- build
| | `-- <Model Name>
| |-- libsvc T-Kernel system call I/F library
| | |-- src
| | | `-- sysdepend [Hardware dependent portion]
| | | `-- <CPU Name>
| | `-- build
| | `-- <Model Name>
| |-- libtk T-Kernel function call library
| | |-- src
| | | `-- sysdepend [Hardware dependent portion]
| | | `-- <Model Name>
| | `-- build
| | `-- <Model Name>
| |-- libtm T-Monitor service call I/F library
| | |-- src
| | | `-- sysdepend [Hardware dependent portion]
| | | `-- <Model Name>
| | `-- build
| | `-- <Model Name>
| |-- libstr Character string operations library
| | |-- src
| | `-- build
| | `-- <Model Name>
| |-- libsys System operations library
| | |-- src
| | `-- build
| | `-- <Model Name>
| `-- libdrvif Device drivers operations library
| |-- src
| `-- build
| `-- <Model Name>
|
|
|-- include Various definition files (header files)
| |-- tk T-Kernel related definition files
| | `-- sysdepend [Hardware dependent portion]
| | `-- <Model Name>
| |-- sys Definition files for system internal information
| | |-- sysdepend [Hardware dependent portion]
| | | `-- <Model Name>
| | `-- svc System call/extended SVC definitions
| |-- tm T-Monitor related definition files
| `-- device Device driver related definition files
|
|
|-- config System configuration information files
| |-- src
| | `-- sysdepend [Hardware dependent portion]
| | `-- <Model Name>
| `-- build
| `-- <Model Name>
|
|
|-- etc make rule, various scripts
| `-- sysdepend [Hardware dependent portion]
| |-- cpu
| | `-- <CPU Name>
| `-- <Model Name>
|
|
`-- bin Execution image file
`-- <Model Name>
sysinit directory [kernel core]
Includes the source code for the T-Kernel initialization/shutdown processing routines.
The sysinit module object is created in the build directory.
tkernel directory [kernel core]
Includes the T-Kernel/OS source code.
The tkernel module object is created in the build directory.
sysmgr directory [kernel core]
This includes the T-Kernel/SM (except for the portions implemented in the library) source code.
The sysmgr module object is created in the build directory.
sysmain directory [application dependent portion]
This includes the source code for the program which is run as the T-Kernel initial task and the task generating parameters.
The process which is run as the initial task is dependent on the application, so this portion must be created for each application. A sample program is included which uses the T-Monitor service function to output the result of a simple task operation to the console. Please refer to this sample when creating your own program.
All of the necessary libraries, the kernel core, and device drivers, etc. are built together and linked in the build directory to create the final overall T-Kernel system execution image file.
sysdepend directory [Hardware dependent portion]
This includes the source code which is hardware dependent and must be modified for porting. There is no build directory.
sysdepend/cpu/<CPU Name> directory
This includes only the source code which is dependent on the hardware CPU. If the same CPU is used with different hardware, then it does not need to be changed.
sysdepend/device/<Model Name> directory
This includes the source code which is dependent on the target hardware board (except the CPU). If the CPU is the same but the hardware is different (different connections such as the bus or interrupts), then it must be changed.
extension directory
This includes the source code which must be changed when implementing the T-Kernel Extension. There is no build directory. This does not need to be changed in a standard system with no Extension.
extension/memory directory
Includes the T-Kernel memory management related source code.
In a standard system, it uses the source code which supports only the real memory without using the MMU in the "nommu" subdirectory.
To change the memory management model as an Extension for tasks such as memory protection, create a subdirectory for the Extension and then add the corresponding source code to use it.
extension/startup directory
This includes the source code to perform startup/shutdown processing for the program (subsystems and device drivers) which configures the Extension.
In a standard system, it uses the source code which supports the no Extension condition in the "noext" subdirectory.
To implement the Extension, create a subdirectory for the Extension and then add the corresponding source code to use it.
build/<Model Name> directory
This is the directory path when linking the libraries in the build directory which holds the object files of all of the libraries.
The library object file created in the build directory of each library is copied to the main build directory. At that time, the previous object file is backed up in the "!OLD" subdirectory.
The object files of all of the libraries are created together when "make" is run in the main build directory.
crt directory
This is the start-up routine used when independently linking an application program.
In a standard system, this routine cannot be used, because T-Kernel and the application program are linked together and use a dedicated start-up routine (kernel/sysdepend/device/<Model Name>/icrt0.S ).
crt/crt0 directory
This is the C language common start-up routine. The source code is written in assembly and is placed in the "src/sysdepend/<Model Name>" subdirectory as a hardware dependent portion.
The "crt0.o", "crtn.o", "crti.o", "crt1f.o", "crt1s.o", and "crtir.o" object files are created in the build directory. The linker selectively chooses and links the object files it needs.
crt/crttk directory
This is the system program start-up routine for the device drivers and subsystems. The kernel core is directly below the "src" subdirectory, and the "src/sysdepend/<Model Name>" subdirectory is the hardware dependent portion.
The "crttk.o" object file is created in the build directory.
libsvc directory
This is the T-Kernel system call/extended SVC interface library. The interface library is written in assembly and is hardware dependent (CPU dependent).
The interface library source code is automatically generated by the system call definition header file and is placed in the "src/sysdepend/<CPU Name>" subdirectory.
The libsvc.a library is created in the build directory.
libtk directory
This is the library implementation portion of the T-Kernel/SM function.
The kernel core is directly below the "src" subdirectory, and the "src/sysdepend/<Model Name>" subdirectory is the hardware dependent portion.
The libtk.a library is created in the build directory.
libtm directory
This is the T-Monitor service call interface library. The kernel core is directly below the "src" subdirectory, and the "src/sysdepend/<Model Name>" subdirectory is the hardware dependent portion.
The libtm.a library is created in the build directory.
libstr directory
This is the source code for the T-Kernel and the standard library function for memory/string operations used in the library. There are no hardware dependent portions.
The libstr.a library is created in the build directory.
libsys directory
This is the source code for the T-Kernel and the basic library function for bit and queue operations used in the library. There are no hardware dependent portions.
The libsys.a library is created in the build directory.
libdrvif directory
This is the source code for the interface library to create the T-Kernel device drivers. There are no hardware dependent portions.
Device drivers can be created by directly using the T-Kernel system call, but it is easier to create them using this library.
The libdrvif.a library is created in the build directory.
This directory only includes definition files, so no objects are generated.
Directly below the include directory
Jointly used definition files are placed directly below the include directory. All of the files directly below the include directory are the kernel core.
tk directory
These are T-Kernel related definition files.
The kernel core is directly below the "tk" directory, and the "tk/sysdepend" subdirectory is the hardware dependent portion. As a general rule, the hardware dependent definition files are included by the kernel core definition files, so they do not need to be directly referenced.
sys directory
These are the definition files related to the T-Kernel system internal information. They are used in system programs such as subsystems and libraries. They are not normally used by application programs.
The kernel core is directly below the "sys" directory, and the "sys/sysdepend" subdirectory is the hardware dependent portion. As a general rule, the hardware dependent definition files are included by the kernel core definition files, so they do not need to be directly referenced.
The T-Kernel system call/extended SVC definition files are placed in the "sys/svc" subdirectory. They are used in system programs such as subsystems. They are not normally used by application programs. These definition files are automatically generated at the same time when the source code of the T-Kernel system call/extended SVC interface library (libsvc) is automatically generated.
device directory
These are the device driver related definition files They are all hardware dependent.
tm directory
These are the T-Monitor and debug related definition files. There are no hardware dependent portions.
This directory contains the system configuration information files (rominfo, SYSCONF, DEVCONF) used by T-Kernel.
The source code is placed in the "src/sysdepend/<Model Name>" subdirectory, and it is all hardware dependent. Beware that the source file names for the system configuration information are "SYSCONF" and "DEVCONF", not "xxxx.c".
The system configuration load image file (rominfo.mot) is created in the build directory. When running a build, use "perl" to automatically convert "SYSCONF" and "DEVCONF" to "sysonf.c", "devconf.c" and then compile.
This directory contains the common commands and script files used to build T-Kernel.
It contains the common portion "makerules" which is included in every Makefile.
This directory contains the "perl" script file to automatically generate the T-Kernel system call/extended SVC interface library and definition files.
The "sysdepend/<Model Name>" and "sysdepend/cpu/<CPU Name>" subdirectories are hardware dependent.
The final execution/load image files and link maps created in the build directories below are placed in the "<Model Name>" subdirectory. At that time, the previous object file is backed up in the "!OLD" subdirectory.
kernel/sysmain/build/<Model Name> T-Kernel main part
config/build/<Model Name> System configuration information
monitor/tmmain/build/<Model Name> T-Monitor main part
kernel object
T-Kernel uses the following kernel objects.
Type | ID (Note 1) | Name | Description |
---|---|---|---|
Task | 1 | INIT | Initial task |
2 | SYSLOG | syslog task (Note 2) | |
Message | 1 | SYSLOG | For syslog receipt (size 6 KB) (Note 2) |
Buffer | 2 | DEvt | Event notification (size 1KB), can be changed with SYSCONF's TDEvtMbfSz |
Semaphore | 1 | MemMgr | Memory message lock control |
2 | DevSync | Device management synchronization control | |
Event | 1 | DevMgr | Overall device management lock control |
Flag | 2 | LibTk | Overall libtk lock control |
Subsystem
T-Kernel uses the following subsystems within the system.
Subsystem ID | Description |
---|---|
8 | T-Kernel/SM device management |
9 | T-Kernel/SM system management |
17 | Segment manager |