This page is available in: en

HOWTO: Load an Application at System Startup

Written by: Mukul Sharma, Centre for High Performance Embedded Systems , NTU Singapore
Edited by: Mohit Sindhwani, TE@Onghu

In a system, it is a common need to load certain types of applications or system modules when the system starts. The T-Engine allows applications to be loaded using the Command Line Interface (CLI). In addition, it is possible to request the T-Engine to load certain drivers, middleware or applications when the system starts. In this how-to article, we show the procedure for getting the system to automatically load your application, driver or middleware when it starts.

Step 1 – Finding your friends (the files)

The procedure is simple. When the Initial Monitor System (IMS) starts up, it looks for a file and runs the script found in it. This file is called STARTUP.CMD and is usually located in ”/” (root) directory and can also be found in ”/SYS” when booting from a Flash Card. The file is a plain text file that contains a list of commands to be run during startup.

The format of this file is shown below:

*       @(#)STARTUP.CMD (T-Engine/SH7727)
*       システム起動用 IMS 初期コマンドスクリプト
*       Copyright (C) 2002-2004 by Personal Media Corporation
$chgsys uda rda
lodspg  kbpd            !30
lodspg  lowkbpd         !28
lodspg  rsdrv           !26
lodspg  screen          !35
lodspg  unixemu
$cli    STARTUP.CLI     !224
exit    1

Step 2 – Adding your Entry

The lines that we need to observe are the lines that look like this:

lodspg  lowkbpd         !28

This line basically tells the system to load the system program called ‘lowkbpd’ with a task priority of ‘28’.

Similarly, you need to edit STARTUP.CMD to add an entry for your application, middleware or driver. We can add any number of commands that we would like to run. The system will run all of these in the sequence in which they appear in the file. For example, you could get the system to load your application, program or middleware at piority 76 by adding this to the file:

lodspg  my_driver_or_app_or_mw         !76

It’s important to remember that this is the method to load T-Kernel-based programs (not programs that are based on TK/SE), i.e., task-based programs (not process-based programs).

Also, note the line called $cli STARTUP.CLI !224 – it starts the command line interface (CLI) as a process and runs commands from the file STARTUP.CLI. If we are starting device drivers and middleware, typically, we would add our commands before this line.

That’s all there is to it – the next time you restart the T-Engine, it will run your application also.

More Information: For further information, refer to the T-Engine Development Kit Manual that comes with your T-Engine. It explains the commands that can be used in the STARTUP.CMD and the STARTUP.CLI files.