A Complete Example
Lets assume you have a host PC running DOS or Windows and a target PC that is supposed to boot the On Time Win32 RTOS and you want to run a test program compiled with Borland C++.
First, create the following test program in HELLO.C:
#include <stdio.h>
int main(void)
{
printf("Hello, RTTarget-32!\n");
return 0;
}
Compile and link the program with bcc32 hello.c rtt32.lib. To be able to run the program on the target, you must locate the program. For this purpose, a small configuration file must be created (HELLO.CFG):
// Define memory layout
Region NullPage 0 4k RAM
Region LowMem 4k 636k RAM
Region HighMem 1M 1M RAM
// Locate boot code and associated data
Locate BootCode DISKBOOT.EXE LowMem
Locate BootData SystemData LowMem
Locate DiskBuffer DiskBuffer LowMem
Locate Header Hello LowMem
// Locate program entities
Locate Section CODE HighMem
Locate Section DATA HighMem
Locate Stack Stack HighMem 16k
Locate Heap Heap HighMem
Now you can locate using RTLoc hello, which produces files HELLO.RTB (the relocated program image) and HELLO. LOC (a detailed map file).
To create a bootable disk, insert an empty formatted disk in drive A and type bootdisk hello a:. Place the disk in the drive of the target computer and reboot it. RTTarget-32s boot code initializes the PC, reads the program from the diskette, switches to 32-bit protected mode, and executes the program.