Long story short:
when I debug, the MCU is able to run.
Then I terminate the debug session, remove the debugger probe, perform a power cycle and the MCU is not able to run.
Is there some command to remove the debugging probe and terminate the debug session leaving the MCU in free running mode from MCU Xpresso?
The easiest way to "disable" semihosting printf's is to reconfigure your project to link against a "nohost" variant of the C library. For SDK based projects, you can also reconfigure output in many cases so it is sent over a UART rather than the debug probe.
But alternatively, MCUXpresso IDE v10.1 allows projects which contain a hard fault handler that can trap and "recover" from a semihosted operation taking place when the debugger is not connected.
For more information please see chapter 13, "C/C++ Library Support" of the MCUXpresso IDE v10.1 User Guide.
MCUXpresso IDE Support
Actually, yes. I 'll remove then and come back to the post!
BTW is there some smart way to remove the semihosting calls, like undef from the preprocessor windows in settings menu?