Hi, I'm trying to develope an application with the
STM32F4-Discovery Board, but I'm having problems when
debugging. I don't know why I cannot see local variables, the y
appear always as <not in scope>.
Does anyone knows what's happening?
And is that because they are, indeed, not in
I'm having trouble to post my answer
I'm still having trouble to post, so I posted here http://pastebin.com/mnnKdy1k
Please, be more specific.
Local variables can not be seen (because they do not exist) before
you step to the point of their creation. Static variables, on the
other hand, have static linkage and exist forever (but they
can be seen only in the scope of their function).
<some code>; // <-- all static variables from this function are already visible
static int a; // <-- despite the fact they are created on this line
<some code alse>;
int b; // <-- local variable b start its existence only from this line
// and can be seen only from here
If that's the case than it's completely normal.
Thank you for your answer. When you ask me the optimization level
I was using, I started checking and reading about it and realised
that there was the problem. I'm using now level 0 o level 1 for
Add "volatile" on local variable declaration. It is better than
AddZulkifli Sulton volatile is not "better" than static,
it's just a completely different keyword with completely different
I guess he meant "a better solution to this problem". Using static will semantically change the code in ways that may change the behaviour of the code, while volatile will not. It is not however clear that volatile will solve the problem.
The problem has quite certainly become non-existant at some point during the 5 years that have passed since this thread went to sleep...
And that's assuming that there ever was an actual problem to speak of, rather than a lack of understanding of the language.
View all questions in Keil forum