I/O Retargeting  Version 1.2.0
User Code Templates for I/O Retargeting using ARM Compiler
Retargeting Channels and Variants

Channels for Retargeting

The software component Compiler can retarget the I/O functions into following standard I/O channels:

I/O Channel Description
File Channel for all file related operations (fscanf, fprintf, fopen, fclose, etc.)
STDERR Standard error stream of the application to output diagnostic messages.
STDIN Standard input stream going into the application (scanf etc.).
STDOUT Standard output stream of the application (printf etc.).
TTY Teletypewriter, which is the last resort for error output.

The channels are available for selection in Compiler::I/O component as shown on the figure below:

Retarget Interfaces of the Compiler component

Most retargeting channels have various Retarget Variants.

Retarget Variants

The variant selection allows you to change the target hardware interface of the I/O channel. The following variants are available:

Variant Description
File System Use the File System component for file related operations. If no File System is enabled, the validation output window will issue a related message to do so.
Breakpoint When the I/O channel is used, the application stops with BKPT instruction. No additional code is required.
ITM Use Instrumentation Trace Macrocell (ITM) for I/O communication via the debugger (only available for Cortex-M3/M4/M7 processors).
Data is exchanged using Debug (printf) Viewer.
No additional code is required to output or input data through the ITM channel. However, you have to configure the ITM channel for tracing (refer to the documentation of your debug adapter).
For example, for ULINKpro, the setup is explained here.
User Retarget I/O functions to a user defined interface (such as USART, keyboard, graphics display, or a application specific).
See Retarget Variant "User" for further details.
EVR STDIO can also be redirected using the Event Recorder (especially interesting for targets without ITM).
Refer to Retarget STDOUT via Event Recorder for an example.
Depending on the selected variant, certain #defines are set in the header file RTE_Components.h that enable the appropriate code sections in the retarget_io.c file.
Retargeting STDOUT using the EVR variant is available for all Cortex-M based devices.