TMS320F28P650DK: CODE COMPOSER STUDIO: Watch expression for a function-scope static variable

Part Number: TMS320F28P650DK


Hi,

The new system makes it unclear how to post this directly to the Code Composer forum. My question is, how do I specify a specific function-scope static variable within the Watch window?

I'm currently using CCS v20.2.0. For a file-scope variable called myVAR in a file called my_file.c, I would input this as the expression:

'my_file.c'::myVar

Since multiple functions can have static variables with the same name, how can you specify which one to view?

  • Hi Derrick,

    Can you attach a small test case? It could be simple project with one source file. Or perhaps just the source file and your optimization level you are using.

    Thanks

    ki

  • For example, in a source file called my_file.c:

    void function1(void)
    {
        static char s_var;
    }
    
    void function2(void)
    {
        static char s_var;
    }

    And then in the "Watch" window of CCS, I input the expression:

    'my_file.c'::s_var

    The expression will display the values from the static variable defined in function1. My question is, how do I direct CCS to display the static variable from function2?

  • Thanks for the details. I'll have engineering respond.

  • Hi Derrik,

    I suspect these function-scoped static variables are treated as local by the debugger and would be only visible when halted inside the function.

    Regards,
    Oliver 

  • In my example, it does work. The static variable in function1 is visible even when the debugger is not halted inside the function. The only problem is that the expression is ambiguous when there are multiple variables with the same name. In this case, it defaulted to the variable definition in function1, but I'd also like to watch the static variable in function2.

    It's starting to sound like it's a limitation of the IDE?