Updating the T-Engine Flash Memory
Written by: Fauzi Abbas (CHiPES, NTU) and Mohit Sindhwani (TE@Onghu)
The T-Engine has Flash Memory (ROM) that allows developers to store their finalized codes on the T-Engine itself. Storing the executable in the flash memory of the T-Engine allows the developers to use the PC Card slot and the USB host for devices other than program storage. This also allows the developer to automatically start up the user’s application on boot up. In this article, we discuss two different techniques to store the program into the flash memory of the T-Engine development kit.
For the sake of this article, we assume that you are using the SH7727 T-Engine from Personal Media Corporation. We have tried the following steps only on the SH7727 T-Engine. If you try it out on another T-Engine, please let us know so that we can include the information on this page. Also, if the procedure does not work for you and you make some changes, do let us know so that we can make the information available to other users.
For the sake of this article, we assume that you are using the T-Engine from Personal Media Corporation. We have tried the following steps only on the SH7727 T-Engine. If you try it out on another T-Engine, please let us know so that we can include the information on this page. Also, if the procedure does not work for you and you make some changes, do let us know so that we can make the information available to other users.
Background
The physical ROM size in the SH7727 T-Engine is 8MB and it includes the T-Monitor, configuration data, ROM user programs, etc. The organization of the data in the memory is as shown below.

The T-Monitor is stored at the boot address (0×8000 0000) and is allocated 64KB of space. The next 64KB are reserved for configuration information – ROMInfo occupies 128 bytes and the remaining area is reserved for System and Device Configuration (SYSCONF and DEVCONF). The remaining area (8064KB) is the “User Area” and can be used by the developer, and may be organized either as memory or as a ROMDisk.
There are two methods that are discussed in this article:
- Serial/Console -> ROM: The first method uses the T-Monitor to completely overwrite the 8MB of space with the contents of an S-Record file (i.e., an image file with the address structure as shown above) transferred over the serial port. This method should be used when there is a need to reset the contents of the flash memory to a known state. This method is used when the T-Monitor also needs to be replaced, for example when PMC releases a new version of the software and you want to replace all the data in the ROM disk with the new version.
- PC Card -> ROM: The second method only overwrites the User Area of the flash memory. As shown in the picture above, this includes everything except the T-Monitor and the configuration area. Since this area is 8064KB in size, everything that needs to be put into the flash memory must be smaller than 8064KB. This includes the data files, user application, T-Kernel, etc. In this case, the data to be copied to flash memory comes from a bootable PC Card that has a 7MB partition. All the contents to be stored in the flash memory must first be downloaded to the card and then transferred to the flash memory using the procedure discussed here.
T-Engine Booting Procedure
When the system is started, the T-Monitor is the first program to execute out of the ROM Disk (internal flash memory). It initializes the system and starts the T-Kernel. Depending on the configuration, it can boot the kernel from flash memory, or from a Compact Flash Card. Upon starting up, the T-Monitor reads PBOOT from the ROM Disk (rda) and can continue to boot from Compact Flash if a bootable Compact Flash Card is plugged into the PC Card slot. If a bootable CF Card is plugged into the PC Card slot, the system will always continue to boot from the PC Card (irrespective of other settings).
If not, the T-Monitor will also read the following files from the ROM: SBOOT, KERNEL.SYS, SYSCONF, DEVCONF, STARTUP.CMD, and chgsys. At this point, the T-Kernel has been loaded and contains the drivers that provide the support to read from the USB port. Now, it will continue to read the remaining files from the USB storage if a bootable disk is plugged in to the USB port. This is because the T-Monitor itself does not support the USB mass storage – this support is provided by the “upper OS”.
For more details about the booting and startup procedure of the T-Engine, refer to the latest manuals from PMC. Our main reference was Section 2.4 for from the T-Engine/SH7727 Development Kit Manual 1.A0.06 (January 2005).
Method 1 – Using an Image File (Serial/ Console -> ROM)
Find the image file that you want to write to the flash memory. Such a file should be part of the T-Engine Development Kit that you obtained from PMC (or downloaded from their support website). Ensure that you select the correct image file – in the case of some T-Engine kits, there are two or more files depending on the LCD installed on the board. In that case, selecting the wrong file may make the T-Engine useless, and you will need to find another way to restore the earlier image (such as using a debug board).
Usually, the file will be called romimage.mot and is on the development kit CD. Use a terminal software to connect to the T-Engine and perform the following steps.
1. Start the T-Monitor either by resetting the T-Engine by pushing the reset switch (SW–2) with pressing NMI switch (SW–3), or by using the ‘#’ command at the “/SYS>” prompt.
[/SYS]% #
2. Input FlashLoad (FLLO) command. You can use either FlashLoad or fllo in this step (they are the same)
TM> FlashLoad
3. The following prompt appears.
Copy Flash ROM Image to RAM Area
> Load S-Format Data of Flash ROM
4. When prompted as above, send the appropriate romimage.mot file from the terminal software to the console as normal text.
Loaded: 80000000 -> 801AFFFF
Writing Flash ROM at 80000000 [27 blks] ... wait
Update Monitor Area, Restart System after Writing.
5. After the file is transferred, it is written on the flash memory automatically, and the system will restart automatically.
**PMC T-Kernel/SH7727 + Extension Version 1.1.03
Copyright (C) 2002-2005 by Personal Media Corporation
** SegmentMgr OK
** ProcessMgr OK
** MemoryMgr OK
... and so on
Method 2 – Using an Image File (PC Card -> ROM)
This procedure requires a compact flash card to be plugged into the PC Card slot. Start up the T-Engine and follow the steps below.
1. Create a boot disk on the PC-Card. As mentioned earlier, the largest size of the boot partition must be less than 8064KB. This involves the usual steps of partitioning and formatting the disk. Also, you need to make the partition bootable. All the steps are shown below.
[/SYS]%
[/SYS]% hdpart pca
pca [C:977 H:8 S:32 B:250368 (122 MB)]
No System Boot StartCHS End CHS SecNo SecCnt MB
1 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Quit ? c
Create PartNo (1-4) ? 1
Size [MB] (<123MB) ? 7
No System Boot StartCHS End CHS SecNo SecCnt MB
1 13 BTRON 00 0: 1: 1 56: 7:32 32 14560 7
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Update/Quit ? bBoot PartNo (1-4) ? 1
No System Boot StartCHS End CHS SecNo SecCnt MB
1 13 BTRON 80 0: 1: 1 56: 7:32 32 14560 7
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Update/Quit ? u
** pca: Updated Master Boot Block
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% format -b pca0 WORK
Format pca0 [STD] WORK
Logical Formatting...
Writing BootCode...
Disk Format Success.
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% att pca0 A
pca0 -> A
[/SYS]%
[/SYS]% cp -b -v -r * /A
copied: SBOOT
copied: KERNEL.SYS
copied: SYSCONF
copied: DEVCONF
copied: STARTUP.CMD
copied: STARTUP.CLI
copied: chgsys
copied: screen
copied: kbpd
copied: lowkbpd
copied: rsdrv
copied: scrtst
copied: unixemu
copied: cli
copied: .xcli
copied: bin
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS rda 2160 1268 41% 1024 768 TE-SH7727
/A pca0 7280 6373 12% 1024 2560 WORK
[/SYS]%
[/SYS]%
[/SYS]% #
TM>
TM> bd pca0
PMC T-Kernel/SH7727 + Extension Version 1.1.02
Copyright (C) 2002-2004 by Personal Media Corporation
** SegmentMgr OK
** ProcessMgr OK
** MemoryMgr OK
** MessageMgr OK
** TaskCommMgr OK
** GNameMgr OK
** DeviceMgr OK
** ClockMgr OK
** EventMgr OK
** FileMgr OK
** CardMgr OK
** UsbMgr OK
** ClockDrv OK
** SysDiskDrv OK
<<<< IMS >>>>
[IMS]% $chgsys uda rda
pid = 2 (pri = -1)
[IMS]% lodspg kbpd !30
SYSPRG kbpd [1] 40211000 - 4021c000
[IMS]% lodspg lowkbpd !28
SYSPRG lowkbpd [2] 40208000 - 4020f000
[IMS]% lodspg rsdrv !26
SYSPRG rsdrv [3] 4021c000 - 40221000
[IMS]% lodspg screen !35
SYSPRG screen [4] 40204000 - 40208000
[IMS]% lodspg scrtst
Can't start /SYS/scrtst [-327680]
[IMS]% lodspg unixemu
SYSPRG unixemu [5] 40273000 - 402a5000
[IMS]% $cli STARTUP.CLI !224
pid = 3 (pri = 224)
<< START CLI >>
2022/2/4(‹à) 3:13:05
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS pca0 7280 6373 12% 1024 2560 WORK
[/SYS]%
[/SYS]%
2. Once the above steps have been completed, you should be able to boot the T-Engine using the PC Card. Add, remove or replace any of the files from this partition if you want. You may now download your application onto the PC Card and modify the startup.cli file to allow your application to automatically execute when the system is started. Try booting it from the PC card once to ensure the application boots up correctly before proceeding to the next step.
3. Remove the PC Card and reboot the system so that it starts from the ROM (rda), and enter the T-Monitor.
[/SYS]%
[/SYS]% hdpart pca
pca [C:977 H:8 S:32 B:250368 (122 MB)]
No System Boot StartCHS End CHS SecNo SecCnt MB
1 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Quit ? c
Create PartNo (1-4) ? 1
Size [MB] (<123MB) ? 7
No System Boot StartCHS End CHS SecNo SecCnt MB
1 13 BTRON 00 0: 1: 1 56: 7:32 32 14560 7
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Update/Quit ? bBoot PartNo (1-4) ? 1
No System Boot StartCHS End CHS SecNo SecCnt MB
1 13 BTRON 80 0: 1: 1 56: 7:32 32 14560 7
2 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
3 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
4 00 ------ 00 0: 0: 0 0: 0: 0 0 0 0
** Create/Delete/Boot/Edit/Update/Quit ? u
** pca: Updated Master Boot Block
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% format -b pca0 WORK
Format pca0 [STD] WORK
Logical Formatting...
Writing BootCode...
Disk Format Success.
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% att pca0 A
pca0 -> A
[/SYS]%
[/SYS]% cp -b -v -r * /A
copied: SBOOT
copied: KERNEL.SYS
copied: SYSCONF
copied: DEVCONF
copied: STARTUP.CMD
copied: STARTUP.CLI
copied: chgsys
copied: screen
copied: kbpd
copied: lowkbpd
copied: rsdrv
copied: scrtst
copied: unixemu
copied: cli
copied: .xcli
copied: bin
[/SYS]%
[/SYS]%
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS rda 2160 1268 41% 1024 768 TE-SH7727
/A pca0 7280 6373 12% 1024 2560 WORK
[/SYS]%
[/SYS]%
[/SYS]% #
TM>
TM> bd pca0
PMC T-Kernel/SH7727 + Extension Version 1.1.02
Copyright (C) 2002-2004 by Personal Media Corporation
** SegmentMgr OK
** ProcessMgr OK
** MemoryMgr OK
** MessageMgr OK
** TaskCommMgr OK
** GNameMgr OK
** DeviceMgr OK
** ClockMgr OK
** EventMgr OK
** FileMgr OK
** CardMgr OK
** UsbMgr OK
** ClockDrv OK
** SysDiskDrv OK
<<<< IMS >>>>
[IMS]% $chgsys uda rda
pid = 2 (pri = -1)
[IMS]% lodspg kbpd !30
SYSPRG kbpd [1] 40211000 - 4021c000
[IMS]% lodspg lowkbpd !28
SYSPRG lowkbpd [2] 40208000 - 4020f000
[IMS]% lodspg rsdrv !26
SYSPRG rsdrv [3] 4021c000 - 40221000
[IMS]% lodspg screen !35
SYSPRG screen [4] 40204000 - 40208000
[IMS]% lodspg scrtst
Can't start /SYS/scrtst [-327680]
[IMS]% lodspg unixemu
SYSPRG unixemu [5] 40273000 - 402a5000
[IMS]% $cli STARTUP.CLI !224
pid = 3 (pri = 224)
<< START CLI >>
2022/2/4(‹à) 3:13:05
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS pca0 7280 6373 12% 1024 2560 WORK
[/SYS]%
[/SYS]%
2. Once the above steps have been completed, you should be able to boot the T-Engine using the PC Card. Add, remove or replace any of the files from this partition if you want. You may now download your application onto the PC Card and modify the startup.cli file to allow your application to automatically execute when the system is started. Try booting it from the PC card once to ensure the application boots up correctly before proceeding to the next step.
3. Remove the PC Card and reboot the system so that it starts from the ROM (rda), and enter the T-Monitor.
PMC T-Kernel/SH7727 + Extension Version 1.1.02
Copyright (C) 2002-2004 by Personal Media Corporation
** SegmentMgr OK
** ProcessMgr OK
** MemoryMgr OK
** MessageMgr OK
** TaskCommMgr OK
** GNameMgr OK
** DeviceMgr OK
** ClockMgr OK
** EventMgr OK
** FileMgr OK
** CardMgr OK
** UsbMgr OK
** ClockDrv OK
** SysDiskDrv OK
<<<< IMS >>>>
[IMS]% $chgsys uda rda
pid = 2 (pri = -1)
[IMS]% lodspg kbpd !30
SYSPRG kbpd [1] 40211000 - 4021c000
[IMS]% lodspg lowkbpd !28
SYSPRG lowkbpd [2] 40208000 - 4020f000
[IMS]% lodspg rsdrv !26
SYSPRG rsdrv [3] 4021c000 - 40221000
[IMS]% lodspg screen !35
SYSPRG screen [4] 40204000 - 40208000
[IMS]% lodspg scrtst
Can't start /SYS/scrtst [-327680]
[IMS]% lodspg unixemu
SYSPRG unixemu [5] 40273000 - 402a5000
[IMS]% $cli STARTUP.CLI !224
pid = 3 (pri = 224)
<< START CLI >>
2022/2/4(‹à) 3:13:05
[/SYS]% #
4. Input WriteRda (WRDA) command with the name of the source partition on the PC-Card from which the flash will be over-written. In our case, we are using pca0 since that is the partition which we created in the first step. Any other valid partition (less than 8MB, bootable and with all the files on it) can be used.
TM>
TM> WriteRda pca0
Write rda [14560 blks] OK (y/n)? y
Read from pca0 [14560 blks] ... wait
Write to rda [14560 blks (7280 KB)] ... wait
TM>
TM> exit
** System Power Off
5. The contents of the boot disk on PC-Card are read and written to ROM disk on flash memory. After the ROM disk is updated, reboot the system.
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS rda 7280 6373 12% 1024 2560 WORK
[/SYS]%
PMC T-Kernel/SH7727 + Extension Version 1.1.02
Copyright (C) 2002-2004 by Personal Media Corporation
** SegmentMgr OK
** ProcessMgr OK
** MemoryMgr OK
** MessageMgr OK
** TaskCommMgr OK
** GNameMgr OK
** DeviceMgr OK
** ClockMgr OK
** EventMgr OK
** FileMgr OK
** CardMgr OK
** UsbMgr OK
** ClockDrv OK
** SysDiskDrv OK
<<<< IMS >>>>
[IMS]% $chgsys uda rda
pid = 2 (pri = -1)
[IMS]% lodspg kbpd !30
SYSPRG kbpd [1] 40211000 - 4021c000
[IMS]% lodspg lowkbpd !28
SYSPRG lowkbpd [2] 40208000 - 4020f000
[IMS]% lodspg rsdrv !26
SYSPRG rsdrv [3] 4021c000 - 40221000
[IMS]% lodspg screen !35
SYSPRG screen [4] 40204000 - 40208000
[IMS]% lodspg scrtst
Can't start /SYS/scrtst [-327680]
[IMS]% lodspg unixemu
SYSPRG unixemu [5] 40273000 - 402a5000
[IMS]% $cli STARTUP.CLI !224
pid = 3 (pri = 224)
<< START CLI >>
2022/2/4(‹à) 3:13:05
[/SYS]% #
4. Input WriteRda (WRDA) command with the name of the source partition on the PC-Card from which the flash will be over-written. In our case, we are using pca0 since that is the partition which we created in the first step. Any other valid partition (less than 8MB, bootable and with all the files on it) can be used.
TM>
TM> WriteRda pca0
Write rda [14560 blks] OK (y/n)? y
Read from pca0 [14560 blks] ... wait
Write to rda [14560 blks (7280 KB)] ... wait
TM>
TM> exit
** System Power Off
5. The contents of the boot disk on PC-Card are read and written to ROM disk on flash memory. After the ROM disk is updated, reboot the system.
[/SYS]%
[/SYS]% df
PATH DEV TOTAL FREE USED UNIT MAXFILE NAME
/SYS rda 7280 6373 12% 1024 2560 WORK
[/SYS]%
Notice that the name of the ROMDisk has been updated to WORK. This means that you cannot now attach a PC-CARD or any other partition with the name “WORK” on this system as the ROM Disk partition (rda) is now named “WORK”. You will need to update the partition on the CF card by formatting it again. Alternatively, if you prefer the ROM Disk to be called something else, you should use that as the name of the CF Card partition when you create the partition from which the ROMDisk will be updated.
There are a few things that you should be aware of:
- This procedure uses the T-Monitor for carrying out the work. Since the T-Monitor does not include drivers for the USB host, this procedure can only be carried out from the PC Card and not from a USB storage device.
- The format command in the T-Engine asks for the size of the partition, but it asks for the number of Mega Bytes. This means that you cannot create it to be 8064KB (as we want it to be). You can only create it as 7MB or 8MB – since the size must be smaller than 8064KB, we need to create it as 7MB.
Note:
(1) This article has been contributed to TE@Onghu by the Centre for High Performance Embedded Systems, and has been used by permission.
© Centre for High Performance Embedded Systems, Nanyang Technological University, Singapore & Mohit Sindhwani, 2005.