Simple debugger problem...
Hi,
I’m preparing a student class, and I’m facing a debugger behavior that I don’t understand.
I’m running a very simple code on the NucleoF072 :
int main(void)
{
uint8_t i;
i=0;
while(1)
{
i++;
}
}
The variable “i” is located at adress 0x20003ff3 (see example #1). When I step into the assembly code, at line 1b8 the “strb” instruction should store the content of r2 into the memory at 0x20003ff3 (actually, the adress defined by r3+#0). But nothing shows up in the memory view... It keeps reporting zeroes.
Althrough, I suspect that memory has been correctly written because if I reset r2 before line 1b2, the “ldrb” instruction correctly restore r2 at the current value of “i”.
Then, if I declare “i” as a global variable (i.e. before main()), the variable “i” is located at adress 0x20000444 and everything behaves as expected (see example #2).
Is there someone here that understand why is that ? The compiler optimization is O0, but as long as instruction is in the assembly code, I guess that it has nothing to do with optimization stuff...
Thanks,
L.