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.

CCSv5.4 MSP430 debug can't view static variables anymore

Earlier version of the CCS debugger for the MSP430 allowed setting a watch expression on a static variable and it could be viewed when at a breakpoint.  With v5.4.0.00091 this feature does not work anymore.  I can still right-click in the Expression window, and choose Add Global Variable.  Module level static variables are there and can be added to the watch window, but when debugging and stopped at a breakpoint, the watch window indicates the value as "Error:identifier not found: VariableName"  is this a known issue change to the debugger?

  • Hi Bruce,

    what ccs version are you using?  (can I confirm v5.4)  Can you provide steps/a test case to reproduce this?

    I suspect you might be hitting a known issue but just would like to double check and verify.

    Best Regards,
    Lisa 

  • Lisa,

    My code composer version is v5.4.0.00091.  Here is an example of this issue.

    static  unsigned char var1;

    void myFn(unsigned char var2)

    {

    if(var1 > var2)

       // do something

    else

      // do something else

    }

    If I add var1 to the watch window as a global variable, the error I described shows up.

  • Hi Bruce,

    can you try defining as volatile?   I am also wondering whether the variable could be being optimized out.

    Best Regards,

    Lisa

  • Lisa,

    I left out the details of my actual code, but I'm sure the variable is not optimized out.  In fact, if I remove the static from in front and make it truly global, the debugger can see it in the watch window fine.  I did notice one other difference.  The earlier version of CCS (either 5.2 or 5.3) would show the module name when you right-clicked and chose Add Global Variable.  Now there is just a list of variable names.

    Regards,

    Bruce

  • Hi Bruce,

    i just ran a test in v5.4 and found indeed the variable was being optimized out.  Could you try with optimization off?  Project->properties->Build->map430 compiler->optimization and make sure "off" is selected.

    Best Regards,

    Lisa

  • Hi Bruce,

    another thing is to try to switch to using the expressions view.

    Best Regards,

    Lisa

  • Lisa,

    This issue does seem to be related to optimization.  My test project allows the static variable to be viewed except at optimization level 4.  I'm still a little unclear about how things are "optimized out", since the static variables in question are used and definitely are available to my program at runtime.  It seems like this is more of a symbol table optimization issue than the removal of unused variables.  The best hint I have is that in the expression view, when you right-click and add a global variable, the module name shows up along with the variable name for the static variable at all optimization levels except 4.  However, the variable name is there to choose from the list in all cases.

    Unfortunately the final product firmware for me does not fit into the target device without using optimization level 4.  I may be incorrect, but it seems to me that this is a new issue, and earlier versions of either the MSP430 compiler or the debugger allowed static variable to be watched at all optimization levels.

  • Hi Bruce,

    would you be able to send a test project for us to run through here?  My experience defining var1 as per your post was

    - same problem with optimization

    - could view the variable with optimization off

    It would be good to have an exact case for us to investigate this.

    Best Regards,

    Lisa

  • Hi Bruce,

    just wanted to check for any updates with your enquiry.

    Best Regards,
    Lisa 

  • Lisa,

    I won't have time to put together a test case for you until Wed or so.  I've gotten past my immediate issue, but I still would like to follow up later this week.