I want to look at some registers using the variable 'debug'. However, the variable does not appear in the Locals window.
Reading other posts, they say I need to use the variable otherwise the compiler has 'optimises it out'. Very cute...
However, I have declared it and used it and still it does not appear in the locals window. Not so cute...
here is how I am declaring and using it:
unsigned int n; unsigned int debug; unsigned int junk; volatile AT91PS_PIO pPIOA = AT91C_BASE_PIOA; /* pointer to Parallel I/O */ volatile AT91PS_RTTC pRTTC = AT91C_BASE_RTTC; /* pointer to RTTC */ volatile AT91PS_TC pTC = AT91C_BASE_TC0; /* use TC0 only*/ initialise_PIOA(); intialise_TC0(); debug = 1; debug = debug + 1;
I have also tried declaring it as volatile with no success.
What am I doing wrong....?
Please let me know
Thanks
A simple variable reading the TC_SR register would solve this problem.
Then you'll have to qualifay that variable as "volatile". That's how you tell the compiler you want every access to that variable to take place exactly as it's spelled out in the source --- no optimizations, no reuse of the variable's space for other temporary values, nothing.