This chapter describes what you need to do before starting the port.
Knowledge and experience with the target operating system is key to a successful port. This knowledge should extend to development environment and target hardware. The type of knowledge required includes such details as synchronization mechanisms, thread creation, memory management, timing, device drivers, board support packages, memory maps, TCP/IP support, priority and scheduling schemes, and so forth. See "OS capabilities" on page 25 for a list of OS capabilities required by the
TargetRTS.
Experience with porting the TargetRTS to other platforms will aid greatly as the ports tend to follow a pattern. For each development environment and operating system there are bound to be a few surprises. See "Common problems and pitfalls" on page 99.
A functioning development environment must be in place before porting can begin. This includes the correct installation of tools such as linkers, compilers, assemblers and debuggers. To build the
TargetRTS you must have working version of Perl for your development host (version 5.002 or greater). Perl is used extensively in the makefiles for the TargetRTS.
It is also important to initialize environment variables for inclusion of header files and location of library files. An easy way to test this is the creation of simple program, such as "Hello World", which is compiled and run on the target. This step is described in "Simple non-ObjecTime program on target" on page 27.
The target operating system must have a set of services that satisfy the requirements of the TargetRTS. In general, most commercial real-time operating systems (RTOS) have these services. Before starting a port, check for these basic capabilities in the target RTOS. Table 1 lists the TargetRTS feature and its corresponding RTOS service.
An easy way to test the tool chain functionality is to create a simple program that prints out "Hello World" on the console.
This program should not use any TargetRTS code or libraries. Compile, link, and download the program to the target. If it executes successfully, then your development environment is ready.
Further testing is strongly recommended. This would include some basic RTOS services such as thread creation in the program. Again, no TargetRTS code or libraries should be used. Many RTOS provide example programs to compile and run. Try these out and verify the functionality. If you are using a source-level debugger, verify that you can step through the source code and examine variables. If the debugger is aware of operating system data structures, then check to see if this functions. Another important test for C++ compilers is to include a static constructor in the test program. This will ensure that proper initialization is performed. The purpose of this testing to ensure that all of the required operating system features are operational and understood before attempting the port of the TargetRTS.
In order to support target observability for the new port, the target operating system must provide a compatible TCP/IP stack. In general, the TCP/IP layer must support BSD sockets interface, that is, the creation and deletion of sockets, functions such as open(), connect(), bind(), listen(), select(), and so forth. Typically, RTOSs try to provide a BSD-compliant TCP/IP stack. This is a common source of problems with new ports. See "Common problems and pitfalls" on page 99.
If a TCP/IP stack is not provided, then you must implement one, which requires significant effort. The lack of ethernet hardware may require the use of SLIP or PPP over a serial port, although this will severely affect the performance of target observability.
Some of the C++ TargetRTS classes (for example, RTReal) require the use of floating point operations. Investigate the support for floating point on your target system. It is possible to configure the support for RTReal from the TargetRTS via configuration options. For more information, see "Customizing the Target Services Library" on page 47 of the C++ Target Guide.
The TargetRTS needs standard input and output to a console for log messages, panic messages, and debugger input/output. This may already be provided by the target development or operating system. Some embedded RTOS and development tools may not provide standard input and output. This requires the addition of serial port device drivers to the board support package. The use of TCP/IP or UDP/IP to provided standard input/output is also an option.
The use of a source-level debugger that provides some sort of operating system awareness is the best development tool for the port. This is the easiest way to examine source code, memory, variables, registers, stacks, and so forth.
Training is an important component of a successful port. ObjecTime offers training courses to help users understand, use, and port the TargetRTS. Your RTOS vendor may also offer training and this is recommended as well.
The following steps should be followed before calling ObjecTime support for help with a custom port of the TargetRTS.
gethostbyname() and gethostbyaddr() must be functioning.