Difference between revisions of "Embedded Studio Library IO"

From SEGGER Wiki
Jump to: navigation, search
(STD)
(One intermediate revision by one other user not shown)
Line 8: Line 8:
 
=== RTT ===
 
=== RTT ===
   
Use SEGGER Real-Time Transfer (RTT), which enables super fast output without halting the system.
+
Use [https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/ SEGGER Real-Time Transfer (RTT)], which enables super fast output without halting the system.
 
The target application writes the output string to a buffer in RAM. The J-Link reads the buffer while the target is running.
 
The target application writes the output string to a buffer in RAM. The J-Link reads the buffer while the target is running.
  +
  +
Suitable for applications with real-time requirements.
  +
  +
Available on all Cortex-M based systems.
  +
  +
=== SWO ===
  +
The target application writes the output string to the ITM stimulus ports. The J-Link reads the SWO pin while the target is running.
   
 
Suitable for applications with real-time requirements.
 
Suitable for applications with real-time requirements.

Revision as of 09:44, 7 January 2021

The debugger and the Runtime Library of Embedded Studio support different mechanisms for debug input and output. The mechanism to be used in a project can easily be selected in the project options at Library -> Library I/O and does not require any additional file or configuration.

Library I/O Mechanisms

There are different mechanisms for different application requirements.

RTT

Use SEGGER Real-Time Transfer (RTT), which enables super fast output without halting the system. The target application writes the output string to a buffer in RAM. The J-Link reads the buffer while the target is running.

Suitable for applications with real-time requirements.

Available on all Cortex-M based systems.

SWO

The target application writes the output string to the ITM stimulus ports. The J-Link reads the SWO pin while the target is running.

Suitable for applications with real-time requirements.

Available on all Cortex-M based systems.

SEMIHOST

Halt the target CPU for I/O operations. On halt, the debugger reads and executes the operation command and parameters.

Available on all targets (Cortex-M, Cortex-A, Cortex-R, RISC-V)

SEMIHOST host-formatted

With host formatting printf output is processed by the debugger instead of on the target. The debugger reads the format string and the parameters from the target and feeds it to its formatter to be printed. No code for formatting is required on the target, saving 1 - 3 kiloBytes of ROM.

Recommended for minimum size.

SEMIHOST buffered

Output is written to a small buffer in target RAM and flushed to the debugger via semihosting when the buffer is filled or on end of output.

SEMIHOST unbufferd

Output is immediately flushed to the debugger instead of buffered, which requires less RAM but is slower because the target is halted for every output operation.

STD

Use user-supplied I/O mechanisms, such as output on a UART.

When STD is selected as Library I/O, the user has to supply an implementation of int __SEGGER_RTL_stdout_putc(int c); which can be used to route character output to any resource, such as a UART or other terminal.