Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 Benefits of Running without Windows Benefits of Running with Windows Preparing a Program for RTTarget-32 A Complete Example Running a Program on the Target Compiling and Linking with On Time RTOS-32 |
A Complete ExampleAssume you have two PCs: a host running Windows and a target. We want to run a test program compiled with Borland C++. Let's create the following test program in file Hello.c: #include <stdio.h> int main(void) { printf("Hello, RTTarget-32!\n"); return 0; } Now we can compile and link the program like this 1: bcc32 Hello.c Rtt32.lib To be able to run the program on the target, we must locate the program. For this purpose, a small configuration file must be created (Hello.cfg): Region NullPage 0 4k RAM Region LowMem 4k 636k RAM Region HighMem 1M 1M RAM Locate BootCode Biosboot.exe LowMem Locate BootData SystemData LowMem Locate DiskBuffer DiskBuffer LowMem Locate Header Hello LowMem Locate NTSection CODE HighMem Locate NTSection DATA HighMem Locate Stack Stack HighMem 16k Locate Heap Heap HighMem Now we can locate using command2: RTLoc Hello which will produce files Hello.rtb (the relocated program image) and Hello.loc (a detailed map file). Now a bootable disk with our program is created. 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-32's boot code will then initialize the PC, read your program from the diskette, switch to 32-bit protected mode, and execute the program.
Running Win32 Programs without Win32
|