This chapter leads you through the steps required to create a simple, single-threaded, executable. Source code will most likely not need modification as this process primarily focuses on setting up compiler flags, link options, and creating your first C TargetRTS library. Print this chapter so that you capture the information you will need to reference.
ex: Use the Windows NT Control Panel to create an environment variable called USR_MRI.
Note that %RTS_HOME%
is a conceptual and internal environment variable that is used in this document. It does not need to be formally created as an operating system environment variable.
To find the value of %OBJECTIME_HOME% on Windows NT, open an ObjecTime Developer command prompt and type "set OB".
Install and configure the target OS software on both the host and target platforms.
For more information see "Simple non-ObjecTime program on target" on page 27.
For more information, see "Target name" on page 32.
Note: By ObjecTime convention, `S' denotes a single-threaded executable while `T' denotes a multi-threaded executable. For more information about multi-threaded run-time systems see "Threaded phase" on page 15.
For more information, see "Libset name" on page 33.
For more information, see "Choose a platform name" on page 31.
For more information, see "Create a setup script" on page 33.
If the compiler does not have options that correspond to the regular -L and -l options, it will probably be necessary to copy and then modify ld.pl
from %RTS_HOME%\libset\x86-VisualC++-5.0
to %RTS_HOME%\libset\<LibsetName>
.
In addition, if your system does not provide a suitable ar command copy ar.pl
from %RTS_HOME%\tools
to %RTS_HOME%\libset\<LibsetName>
and modify as necessary.
For more information, see "TargetRTS makefiles" on page 34.
For more information, see "Config makefile" on page 39.
For more information, see "Libset makefile" on page 39.
For more information, see "Target makefile" on page 38.
For the simple model execution phase, disable Multi-threading (RSLMULTITHREADED), Target Observability (RSLTO) and Debugging (RSLDEBUG).
If there is a need to override a portion of the standard code for the port, contained in the $RTS_HOME/src
directory, copy the file that you want to override to the corresponding directory in $RTS_HOME/src/target
.
$RTS_HOME/src/target/<TargetBaseName>/MAIN/main.c
Then when the compilation of the libraries is performed, the Perl scripts will choose the target specific source file rather than the standard source file.
To override include files, such as RT_Time.h
, contained in the $RTS_HOME/src/include
directory, copy them to $RTS_HOME/src/target/<TargetBaseName>
and then modify them.
%PWD%\C_HelloWorld\build\<TargetName>_config\HelloST.exe
.
hello.c
on the target.
C_HelloWorld-v1.0-OT5.2x-started:
Hello World
C_HelloWorld v1.0-OT5.2x-finished!
Compilation of the update is usually performed by compiling an actor in the ObjecTime toolset; however, an update can also be compiled from the $UPDATE_DIR
by issuing the make
command.
The sections that follow provide detail on additional procedures to create threaded executables, as well as more complex areas such as debugging, target observability, compiler/linker error parsing and timers.
Note: Perl needs to be installed or the use of Perl disabled to avoid compilation failure in this simple model execution phase. For more information, please refer to section "If the compilation platform does not have Perl" on page 165.
Essentially, you will be completing most of the steps from the "Simple model execution phase" on page 3; however, you will be choosing a multi-threaded target. To save time, the steps you need to redo are included below.
The majority of the concepts involved in this section are explained in detail in "Modifying the error parser" on page 91. Using the concepts from that section, you should do the following:
If the compilation platform does not have Perl, the following solutions are available:
(Both the following solutions disable the use of Perl for the compilation phase, and consequently, error parsing. You will, however, be able to compile without getting a fatal error indicating Perl is not present.)
Solution 1: Make use of a make overrides file, as described in the chapter "Makefiles" in the C Language Guide. Set the following variables to nil within that file:
OTCOMPILE_CMD =
OTLINK_CMD =
Solution 2: Modify the $RTS_HOME/target/<TargetName>/target.mk
file to set the following variables to nil:
OTCOMPILE_CMD =
OTLINK_CMD =
Download and compile Perl for the compilation platform.
The majority of the concepts involved in this section are explained in "Implementing timer services in the C TargetRTS" on page 77.
Using the concepts from this section, you should decide what type of timers you want to implement local timers or actor timers. It is suggested that for RTOS applications, local timers be used; otherwise, actor timers can be used.