Hello,
I am having a very strange problem. I am using CCSv5.3.0.00090 on Windows 8. I am testing the same environment on MSP430F5529 (no problem with this), and on MSP430FR5729 (this is where I get the problem).
The problem is that on Debug view, with Disassembly view enabled (Window -> Show View -> Disassembly), the memory gets corrupted (for static variables).
To replicate the problem do as follow:
1. Create a new project for MSP430FR5729 (I used the blink example with some modifications).
The code I am running is the following:
#include <msp430.h>
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
for(;;) {
static volatile unsigned int i; // volatile to prevent optimization NOTICE HERE STATIC VARIABLE
i = 10000; // SW Delay
do
i--; // INSERT BREAKPOINT HERE
while(i != 0);
}
return 0;
}
2. Debug the code, when it stops in the first line of main,
3. Insert breakpoint at line "i--"
4. Open Disassembly View (Window -> Show View -> Disassembly) and leave it visible (the tab must not be hidden).
5. Add the variable i to the Expressions view (just to see the problem)
6. Resume (F8). Execution will stop at line "i--"
Now you can Resume, or single step (Step Into or Step Over), and you can see that the value of "i" in the expressions does not change (actually it changes, but changes back on next instruction) -- so it never reaches 0 (even after 10000 steps).
Now if you close Disassembly view (or just hide it, say by opening the Memory Browser or anything else on top of it), you can step and see the value in the expressions view decrementing.
I think this is a problem with CCS thinking that this memory address is not writable, as if it were on the FLASH series. Also, if you don't declare the variable as static, the problem does not happen. So maybe because CCS knows that the stack is volatile.
I think this is a bug with CCS. Please let me know if you need more information on that. I am going to test it on another computer, but I think the problem will be the same.
Regards
-- Marco Casaroli