The semihosting mechanism
C-SPY emulated I/O is compatible with the semihosting interface provided by Arm Limited. When an application invokes a semihosting call, the execution stops at a debugger breakpoint. The debugger then handles the call, performs any necessary actions on the host computer and then resumes the execution.
There are three variants of semihosting mechanisms available:
For Cortex-M, the interface uses
BKPTinstructions to perform semihosting callsFor other Arm cores,
SVCinstructions are used for the semihosting calls in 32-bit modeIn 64-bit mode,
HLTinstructions are used for the semihosting callsUsing IAR breakpoint, which is an IAR-specific alternative to semihosting that uses SVC.
To support semihosting via SVC, the debugger must set its semihosting breakpoint on the Supervisor Call vector to catch SVC calls. If your application uses SVC calls for other purposes than semihosting, the handling of this breakpoint will cause a severe performance penalty for each such call. IAR breakpoint is a way to get around this. By using a special function call instead of an SVC instruction to perform semihosting, the semihosting breakpoint can be set on that special function instead. This means that semihosting will not interfere with other uses of the Supervisor Call vector.
Note
IAR breakpoint is an IAR-specific extension of the semihosting standard. If you link your application with libraries built with tool chains from other vendors than IAR and use IAR breakpoint, semihosting calls made from code in those libraries will not work.