Skip to main content
GCurz.1
Associate
May 30, 2023
Question

Cannot revert from semihosting

  • May 30, 2023
  • 1 reply
  • 1271 views

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

This topic has been closed for replies.

1 reply

AScha.3
Super User
May 30, 2023

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""."
GCurz.1
GCurz.1Author
Associate
May 30, 2023

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.