Introducing the T-Monitor
Written by: Mohit Sindhwani
In the T-Engine, the T-Kernel is the main real-time operating system (RTOS). However, the T-Monitor plays an important part, providing services from boot-up to shut down. This article provides an introduction to the T-Monitor.
The T-Monitor is the layer that sits between the T-Kernel and the hardware. It is kernel-support monitor software that provides the following facilities in the T-Engine system:
- Reset and Boot: The T-Monitor manages the main functions related to initialization of the system. It initializes system devices, finds the program or kernel to load, and loads it. The T-Monitor includes support to boot the kernel from memory (RAM or flash), memory disk (RAM Disk, Flash Disk) or even external storage (such as a CF card). The T-Monitor includes basic device driver support for reading and writing from a serial port, accessing the CF card, etc. Other device drivers that are compiled with the T-Monitor may vary depending on the specific implementation.
- Interrupt & Trap Management: The T-Monitor is responsible for initializing the interrupt and trap subsystems and managing interrupt and trap entry. When an interrupt occurs, the T-Monitor gains control and calls the appropriate function to service the interrupt. When a system call trap occurs, the T-Monitor looks at the system call to decide which software module is supposed to manage the system call (T-Monitor, T-Kernel, etc.) and jumps to an appropriate function in that module to handle the call.
- Program Support Functions: The T-Monitor provides certain specific types of support to programs that run on it. These functions are accessed using T-Monitor system calls and provide support such as printing data to a console (serial port) or reading characters from the console.
- Debugging Support: The T-Monitor provides debugging support to applications and developers. The T-Monitor specifications specify a set of commands that can be used from a console. These commands allow a developer to probe the memory, set breakpoints, step through execution, probe CPU registers, etc. The console can be accessed through a number of means, including a call to the program support function tm_monitor() in an application program. The T-Monitor also provides access to a block-based file system (that could be used to construct a higher level file system, if required) on RAM or flash, and even includes modules to download data or executables from the serial port using the X-Modem protocol. The T-Monitor also includes an S-Record decoder and loader to allow developers to download files over the serial port and load them directly into memory. The specification also requires T-Monitor to support disassembly of code in the program memory!
The software stack that makes up the T-Monitor is shown in the Figure below.
Use of the T-Monitor
The T-Monitor can be used in two main ways:
- It can either be used as kernel support for the T-Kernel or some other kernel software. It can start the T-Engine board and then jump to the entry point of the specific kernel. In T-Engine terminology, such applications are called “T-Kernel Applications” and are multi-tasking real-time applications.
- On the other hand, the T-Monitor can also be used as the basic architecture to build non-multi-tasking applications, i.e., applications with just one thread of control. Such applications are called “T-Monitor applications” and run without an operating system.
In both cases, if a system is constructed properly, the T-Monitor can provide support for reset and boot, interrupt and trap management, debugging, and access to basic system services, as discussed above.
The functions of the T-Monitor, the program support API, and the console functions have been standardized by the T-Engine Forum and the specifications can be found on the CD that comes with your T-Engine. The specification for the T-Monitor has and can be downloaded from the website of the T-Engine Forum.
As you probably know, the and can be downloaded from the website of the T-Engine Forum. Unfortunately, the download does not include any code for the T-Monitor since it is felt that the T-Monitor is extremely target-specific. So, even if you download the source code for the T-Kernel, you will need a T-Monitor to get the system started. In the case of some of the processors from Renesas, you can check the SH/M32R T-Engine website for T-Monitor downloads.