This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS Debugging issue with a static variable - "Expressions" pane reports data at wrong address

Hi all,

This question is with respect to using CCS 6.1.2.00014, TI compiler v5.2.7 for MSP432.

I've attached two screenshots to illustrate what is going on.

In the first screen shot, you can see I've created a static variable called tb_u8 inside a particular function. 

  • The variable is not being explicitly initialized here, but my understading is that, in C, statics always auto initialize to 0. 
  • You can't see it, but I've run up to a breakpoint which stops execution just after tb_u8 is set to 3.  
  • In the expressions pane at the top you can see that tb_u8 is reported as having a value of 14, and an address of 0x144 (that is the start of the text section!).   14 is the value at 0x144 but that is plainly an invalid address for a variable.
  • In the.map file you can see that tb_u8 is actually at 0x20002541
  • Looking at 0x20002541 in the memory browser you can see my variable has actually been set to 3 despite what the Expressions pane is reporting.

In the second screen shot the only change I have made is to explicitly initialize the tb_u8 rather than relying on auto initialize.

  • Run up to the same breakpoint - expect tb_u8 = 3
  • This time the expressions pane is giving a valid address for tb_u8 and is correctly reporting a value of 3.
  • My variable no longer appears in the .map file, but the address given in the expressions pane checks out in the memory browser.

I can easily switch back and forth between these two cases by adding/removing the explicit initialization.

Its only this particular static variable that is causing me problems (though a college of mine working on the same codebase had the same issue occur on another variable). 

Any ideas what I might need to do differently to avoid this problem?

Cheers

Julian

Screenshot 1

Screenshot 2