AN4989 Rev 3
79/118
AN4989
Printf debugging
117
Figure 57. Enable ITM stimulus Port 0 in STM32CubeIDE
Click on “Start Trace” button
Figure 58. Start Trace button in STM32CubeIDE
Press “Resume” button, and your printf message is printed in SWV ITM Data Console.
7.4 Semihosting
Semihosting is a mechanism that enables code running on an Arm
®
target to communicate
and use the Input/Output facilities on a host computer that is running a debugger.
Examples of these facilities include keyboard input, screen output, and disk I/O. For
example, this mechanism can be used to enable functions in the C library, such as
printf()
and
scanf()
. It can also allow to use the screen and keyboard of the host
instead of having a screen and keyboard on the target system.
This is useful because development hardware often does not have all the input and output
facilities of the final system. Semihosting enables the host computer to provide these
facilities.
However, the user has to be aware of the following drawbacks:
•
Semihosting only works during a debug session. Otherwise, the program gets stuck in
the first
printf()
routine reached.
•
Since semihosting uses breakpoint instruction and host dependent code, it has
significant and unpredictable impact on performance.