Skip to main content
AFaya.1
Associate III
May 12, 2022
Solved

During Release build code not hit main()

  • May 12, 2022
  • 3 replies
  • 2147 views

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.

This topic has been closed for replies.
Best answer by Andrew Neil

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.

3 replies

Tesla DeLorean
Guru
May 12, 2022

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 VenmoUp vote any posts that you find helpful, it shows what's working..
AFaya.1
AFaya.1Author
Associate III
May 13, 2022

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

Andrew Neil
Super User
May 13, 2022

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

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Peter BENSCH
Technical Moderator
May 12, 2022

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
Super User
May 12, 2022

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

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
AFaya.1
AFaya.1Author
Associate III
May 27, 2022

NO.

Andrew Neil
Super User
May 27, 2022

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.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.