I declare a array, and set the value. ubyte i,ubData[3]; for(i=0;i<3;i++) ubData[i]=i; I debug this program ,the value of array element is correct. But when i download the program into flash,I find the value of array element is 0xff. The value of element is error. For example , the value of ubData[1] is 0xff,not 1. So i modify the program like this: ubData[0]=0; ubData[1]=1; ubData[2]=2; I download the program into flash again,run it. The value of array element is correct. The value of ubData[1] is 1. If I set the array element value like : i=0; ubData[0]=i; The real value of ubData[0] is 0xff,but not 0. Why? I can't explain this.
Look through the disassembly listing to see the generated code. The reason for such strange behaviour could be anything: 1) a bug in the compiler (unlikely), 2) faults in target hardware, 3) something else. - Mike
I found it's possible that the memory config incorrectly.The variable shoud be located in Iram or RAM,but really in ROM. Somebody knowhow to config the MCB167 net evalution board memory address. The MCB167 net board has 1MB external ROM and 1MB external RAM. How do I locate the Internal RAM ,external ROM and external RAM address range.
Find out what the location of "i" is. During execution, the program may not access this location properly.