cancel
Showing results for 
Search instead for 
Did you mean: 

During Release build code not hit main()

AFaya.1
Associate III

Hi,

I am using STM32f413zh i build the code in release mode. After that i put break points on inside the code some places, None of the break point is hit. But i flash the binary file the code was running. Please give guidance for hit the code on main() or inside the code.

Thankyou.

1 ACCEPTED SOLUTION

Accepted Solutions

So the debugger won't know what code addresses correspond to which source lines - as discussed above.

If you want to be able to do source-level debug, then you need to enable the debug info.

View solution in original post

8 REPLIES 8

Uncheck "run to main​", and walk in from Reset_Handler.

Instrument Error_Handler () and HardFault_Handler ()

Make sure BOOT0 is pulled LOW.

Press STOP in the Debugger, observe where the MCU is stuck, or whatever.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Peter BENSCH
ST Employee

One reason for this could be that the release mode uses a different code optimisation, so that the lines with the break points have been optimised away. They are then still in the source code, but no longer play a role for the code execution.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Andrew Neil
Evangelist III

If you're in Release mode, is debug information being created?

Yes, I pause the code while running that was not reach any error handlers, The code was running properly i am also able to see the led indications also perfectly run as per logic.

While i debug the code i am able to see the below screen. I don't know why that was not hit in inside main().

0693W00000NptfhQAB.png

again, If you're in Release mode, is debug information being created?

NO.

So the debugger won't know what code addresses correspond to which source lines - as discussed above.

If you want to be able to do source-level debug, then you need to enable the debug info.

Thankyou