I was working on an application using UART FIFO receive interrupts with CCS 5.1 and StarterWare_02_00_00_04 . Once I had the problem that the code ran to the Abort/Undefined-Instruction Handler. After doing some debugging, I found that a parameter passed to a function call was not the correct value in the UART ISR. By stepping through the assembly codes of ISR, one line of code was “MOV R0, R6”. R6 held the correct value I intended to pass to the function. But once executing this line of code, R0 remains its original value, not the value in R6. Later R0’s value was passed to the function and caused wrong behavior in the function.
I have following questions:
- Is there any “protection mode” that prevents the changes of register values?
- While stepping through the assembly codes, can I trust the register values shown by CCS between executing every instructions?
- By changing one local variable in the ISR to “volatile” (which is unrelated to the problematic function call) and compiling the project again, the compiler re-arranged the variables and the above line of code was changed to “MOV R0, R7”. This time R0 changed to value of R7 and the function got the right parameter. So why “MOV R0, R7” worked but “MOV R0, R6” didn’t?
Any help is greatly appreciated.
--Yanli