cancel
Showing results for 
Search instead for 
Did you mean: 

program stuck in if(true) condition

montagnanigiovanni
Associate II
Posted on September 22, 2014 at 20:36

hi all,

i work with stm32f4 and keil uv5

my program seems stuck in if condition

my code is

while(1)

        {

            if(i==0)

            {

                break;

            }

        }

and my debugger says that the program stops in the if despite i is zero!

have you experienced something like that?

do you know a possible explanation?

thank you

gio
1 REPLY 1
Posted on September 22, 2014 at 21:19

Check optimization settings, and the volatility of variable.

There is often not the perceived one-to-one linear source to assembler relationship. Step the assembler view, and understand exactly what the flow really is, and look at or review the code generated.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..