2017-09-14 02:02 AM
HI.Now I'm trying to debug code with break pointers in STM32F4 kit.
As you can see the below code, I put some break point in my code.
But problem is taht FSM go broken.
At the line 437, I go next step (F11),
But it goes to 442 line. It's a absolutely different state.
Even it does not go break statement.
I guess that compiled assembler code and C code are different working.
But I can't understand it, does this make sense..? what am I supposed to do to resolve
2017-09-14 02:15 AM
If I understood correctly, this is normal behaviour, when you have compiled your code with optimizations.
Switching your optimization flag (-O, if this is gcc) to zero (-O0) should make the compiled code more debug-friendly.
2017-09-14 04:19 AM
Thanks let me check more to figure out
2017-09-14 08:18 AM
With gcc, -Og may be more helpful than -O0.
2017-09-14 10:47 AM
There is a one-to-many relationship between C lines and assembler lines, the debug data doesn't fully decode this and there can be code reordering, replication or removal. For a more linear flow turn off optimization.