Skip to main content
Carter Lee
Associate III
September 14, 2017
Question

FSM bug in STM32 ?

  • September 14, 2017
  • 2 replies
  • 729 views
Posted on September 14, 2017 at 11:02

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),

0690X00000608DbQAI.png

But it goes to 442 line. It's a absolutely different state.

Even it does not go break statement.

0690X00000607FIQAY.png

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

    This topic has been closed for replies.

    2 replies

    kraiskil
    Associate III
    September 14, 2017
    Posted on September 14, 2017 at 11:15

    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.

    Carter Lee
    Associate III
    September 14, 2017
    Posted on September 14, 2017 at 11:19

    Thanks let me check more to figure out 

    Tesla DeLorean
    Guru
    September 14, 2017
    Posted on September 14, 2017 at 19:47

    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.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..