9.4 printf Output for Arm Projects
There are many ways of streaming the printf output to the PC. This section describes how you can get printf data in the MPLAB X IDE Output window through a connected debug tool. The semihosting mechanism is used to enable this. In general, semihosting enables input and output on the host PC to be controlled by the target device.
Semihosting operates by having the firmware halt on a software breakpoint whenever an interaction with the PC is required. The debug software checks periodically to see if the software is still running. If it sees that the firmware has stopped on a semihosting breakpoint, it will execute the semihost request and then resume execution on the microcontroller.