Joe-
> I wrote a very simple C program in Code Composer
Studio 3.1 (CCS). No errors
> resulted from compiling the following code, yet when I single step through
> this code the variable watch window indicates that none of the variables
shown
> in this code actually get assigned moreover the loop does not function
properly.
>
> void main(){
>
> int c428;
> int x=2;
> int a=0;
> int n=3;
>
> cx6;
>
> for (c=0;c<=n;c++){};
>
> *(unsigned volatile int *)0x300000 = 0xffff;
> }
>
> I have no idea why this would happen and can only guess that I need to set up
the compiler in some way.
Suggest to try this way:
int c, x, a, n;
volatile int i;
void main(){
c428;
x=2;
a=0;
n=3;
cx6;
for (c=0; c<=n; c++) {
i++; /* put something here to make it easier to single step */
};
*(unsigned volatile int *)0x300000 = c; /* use value of c */
If you create temporary variables (e.g. stack or register) then using a memory
watch
window during single-step is not valid. They need to be in memory. As for the
loop,
why would the compiler bother with a null loop? You don't do anything with
the
variable c -- either during the loop or after -- so why would you worry whether
the
loop executes or not?
-Jeff