I/O Retargeting  Version 1.2.0
User Code Templates for I/O Retargeting using ARM Compiler
 All Files Macros Pages
Retarget Variant "User"

If you select the Compiler component variant User in the Manage Run-Time Environment, user code templates are available that help you to implement your own functionality. You can import the templates into a project using the context menu Add New Item to Group from the Project window. Depending on your selection, you get templates that support retargeting via display, USART, or keyboard. Also, a template for a custom implementation is available.

retarget_addTemplates.png
Retargeting Code Templates

Output via Display

You may use the Graphics component or write your own output routines. The following user code templates are available:

Component Name File Name
I/O:STDOUTSTDOUT via Display stdout_display.c
I/O:STERR STDERR via Display stderr_display.c
Note
To have the full flexibility for retargeting different channels to different target hardware, each display user code template contains a function to initialize the display. When using the same hardware for multiple channels, remove the initialization function from one template and call the other function during the initialization of the device's peripherals.

Input/Output via USART

You may use a CMSIS-Driver USART or write your own output routines. The following user code templates are available:

Component Name File Name
I/O:STDOUTSTDOUT via USART stdout_USART.c
I/O:STDIN STDIN via USART stdin_USART.c
I/O:STERR STDERR via USART stderr_USART.c
Note
To have the full flexibility for retargeting different channels to different target hardware, each USART user code template contains a function to initialize the USART. When using the same hardware for multiple channels, the initialization functions need to be merged in one single function. Call this function during the initialization of the device's peripherals.

Input via Keyboard

You may use software components that support the keyboard functionality or write you own routines. For example, you may use the HID class of the USB Host component to read data from a USB keyboard. The following user code template is available:

Component Name File Name
I/O:STDIN STDIN via Keyboard stdin_keyboard.c

Input/Output via Template

Use these templates for custom interfaces that are not mentioned above. The following user code templates are available:

Component Name File Name
I/O:STDOUTSTDOUT User template stdout_user.c
I/O:STDIN STDIN User template stdin_user.c
I/O:STERR STDERR User template stderr_user.c
I/O:TTY TTY User template tty_user.c