AnsweredAssumed Answered

Loosing scope in global variables

Question asked by munoz.eduardo on Jan 8, 2015
Latest reply on Jan 8, 2015 by munoz.eduardo
I'm using STM32 CubeMX 4.3.1 generating code in Keil. 

I experienced extrange behavior with Global variables. It seems as if at some point within a function a local variable loses its contents...

But debugging the code I could see it's not that the global variable had lost its content ... (that was my first thought)

It seems like loses its scope. It is strange in a global variable right?
At the beginning of the function I can manage it properly, but later in the same function can not even compare it to a value or assign its value to another variable. Strangely, if I halt there the debug and pass the mouse over the global variable, popup values are correct. But making the next step in debug takes no effect. 

I know that the variable retains its value because if I create a dummy function call it from where it fails and doing the assignment or comparison there, works fine...

In dissasembly I can see that one of the register involved has not the correct offset, so I'm focusing in optimization levels to see if i can find out where is the problem.

Please, if anyone can help... It's a known issue??

Thank you very much in advance!