Customizing a TDP

This section of the Tutorial will demonstrate how to use the customize input-output (I/O) communication and break-point usage in order to address a target system without standard I/O functions.

First, create a new TDP based on the one created previously.

To create a new TDP:

  1. Open the cwingccmingw.xdp TDP in the TDP Editor

  2. Select the top-level node and rename it My MinGW UserMode.

  3. From the File menu, select Save xdp As to save the new TDP as cwingccmingw2.xdp.

  4. Collapse all the nodes in the Navigation window as this section concentrates only on the Build Settings and Library Settings nodes of the TDP Editor.

Library Settings

You first need to specify the I/O user mode, which means disabling the standard I/O mode for data retrieval on the target.

By default, when executing a program compiled with Test RealTime, the test data is dumped to a file on the file system by using the standard fopen, fprintf and fclose functions. On some platforms, these primitives are not available hence the need to use a set of user-defined I/O functions that allow the TDP to access the File System.

To change Library settings:

  1. Expand Library Settings, Data retrieval and error message output and select Data retrieval to locate the RTRT_IO macro definition.

    In the combo-box for RTRT_IO you can select:

    • RTRT_NONE: No I/O available

    • RTRT_STD: Standard I/O functions (fopen, fprintf and fclose)

    • RTRT_USR: User-defined I/O. This option enables the customization tabs.

  2. Select RTRT_USR. Look at the user defined I/O primitives used to access the File System: usr_open, usr_writeln and usr_close.

    Notice that usr_writeln() contains the following statement

printf("$s",s);

  1. From the File menu, select Save and Generate.
  2. Update the Configuration in Rational® Test RealTime to use the My MinGW UserMode TDP, and Build your sample project.

This build should fail. The message console should display the following information, or similar:

Executing gcc_step1\Histo.exe ...

gcc_step1\Histo.exe

PU "Histo"

H0 "..."

O1

NT "Initialization" 0 0

DT 0

...

A32 OK RA=T

NT "Termination" 61 41

DT 0

FT 91e544c5DC 0b72d3c1

PT "Termination"

PS 0 0 0

PY 0 0 0

QT "Termination"

QS 91e544c5 7965f082

NO "2 (Max Calling Level reached)"

CI 0h

Splitting 'gcc_step1\THisto.rio' traces file...

Traces file successfully split.

No RIO instruction found.

Errors have occurred.

This message shows that:

  • ASCII character data was dumped from the program directly to the standard output of the executable through the printf directive.

  • Test data output is encoded information that only the Rational® Test RealTime Report Generator is able to understand.

  • The trace file is empty. Although the split is successful, no instructions are found and an error message is produced.

Therefore, for the build to be successful, you must provide the Report Generator with a valid trace file.

Build Settings

The Execution function is a basic command that produces an output file that redirects the standard output to $out.

To change Build settings:

  1. In the TDP Editor, expand the Build Settings and select Execution function.

    The following code is displayed:

    sub atl_exec($$$)
    {
     my ($exe,$out,$parameters) = @_;
     unlink($out);
     SystemP("$exe $parameters");
    }
  2. Change the SystemP line to:
    SystemP("$exe $parameters >$out");
  3. Save the TDP, update the Configuration in Rational® Test RealTime and Build your sample project.

This time, the execution should run smoothly and produce complete reports. If not, rework the above functions until the execution is successful.

Move on the next section: User-defined I/O Primitives