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
Where are you using your variable? debug = debug+1 isn't the same as using, if you don't have any code somewhere else that actually cares.
Have you tried changing debug into a global variable?
Wow - you guys are quick to answer...
Later in my code I have:
debug = pTC->TC_SR;
I appreciate I can view the TC_SR reg using other methods, but I want to set up a general debug methodology.
Does this line constitute me using the variable?
I will try making it global and see how far that gets me...
This is using:
if (debug > 1) do_stuff();
To use a variable, some part of the code should read the contents, and be affected by different contents.
View all questions in Keil forum