1) Semihosting calls are extremely slow. They halt the processor until the debug probe polls the target, notices that it's stopped at a semihosting breakpoint, handles that, and resumes it. This can take tens to hundreds of milliseconds per call.
2) You technically need to initialize the semihosting file descriptors with an open() call before using them. Many debuggers will allow you to use the descriptors without initialization, but not all will.
Another fun trick: route all semihosting calls through this function in RAM:
BX LR
BX LR
Then when you connect the debugger, overwrite with `BKPT 0xAB` to enable semihosting like so: BKPT 0xAB
BX LR
This saves the overhead of an interrupt when not in use. You can still have the hardfault handler ignore it in case you uncleanly disconnect the debugger.
embeng4096•2h ago