User-defined I/O primitives

This section demonstrates how to define your our own I/O primitives for the dump phase.

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

To create a new TDP:

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

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

  3. Save the current TDP as cwingccmingw3.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.

To set up user-defined I/O primitives:

  1. Expand Build Settings and select the Execution function.

  2. Delete the >$out parameter that was added to the SystemP statement:

  SystemP("$exe $parameters");

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

  2. Select the RTRT_USR entry.

  3. On the Settings tab, in RTRT_FILE_TYPE, change int to FILE*.

  4. Add your own code for the usr_open function, such as:

printf("...Opening file...\n");


  1. Add your own code for the usr_init function:


  1. Add your own code for the usr_writeln function:

printf("...Dumping : %s\n",s);


  1. Add your own code for the usr_close function:

printf("...Closing file...\n");


  1. Save the TDP, update the Configuration in OneTest Embedded and Build the add.c example.

The examples described here make no sense in real life as they are functionally identical the standard I/O mechanism. However, they show how easy it is to map user-defined I/O primitives to the data retrieval mechanism implemented by the TDP.