STM32 can't enter the main function

Recently, I encountered a magical problem when debugging STM32. I used the printf function in the program. As a result, when debugging, I found that the program was stuck in the startup code and could not enter the main function.

At first I thought it was a hardware problem, I tried using software emulation and the result was the same as using hardware debugging.

Later, I checked on the Internet and said that it is because functions such as printf use semihosting mode. If the micro library is checked in the configuration options, the semihosting mode will not be used. But in fact I checked the micro library in the configuration options of the compiler.

Finally, I tried to change the version of the IDE, and the program finally entered the main function. I struggled with this problem for a day, and my heart was filled with a touch of sadness.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325582250&siteId=291194637