cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot revert from semihosting

GCurz.1
Associate

Hello everyone,

I am building an application on a STM32H742 chip.

I can correctly enable the semihosting following this guide (How to use semihosting with STM32CubeIDE and STM32).

However, I want to be able to disable it because otherwise the code stops running as soon as I unplug the programmer (in release configuration).

I just use some printf so i expect those lines simply become uneffective when not in semihosting.

The point is that, making the steps backward (of the above guide), leaves something set on the compiler and as soon as it encounters a printf the code is trapped at _swistat().

Below the callstack of the trap:

_swistat()

_fstat_r()

__swhatbuf_r()

__swmakebuf_r()

__swsetup_r()

_vfprintf_r()

printf()

main()

Could anyone help me on this?

Thank you in advance,

Giacomo

2 REPLIES 2
AScha.3
Chief III

as long as anything uses semihosting, program runs only (!) with debug connected.

so to run without semihosting again, comment out everthing related ....

If you feel a post has answered your question, please click "Accept as Solution".

That would be definitely a possibility, but what is strange is that if i leave the printf and compile everithing in a "brendnew" project, where semihosting has not been enabled, there is no issue.