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: an easy question about Constant assignment



Tool/software: Code Composer Studio

Hi Team,

CCS6.0.0 ( DSP28035)

Now set a constant UA=0, UA does not participate in any data processing and calculation.

After running the program online, the theoretical output is 0, but the window display is 30239.

No matter how to change the UA value, UA always equals to 30239. What is the problem?

thanks!

  • Hi,

    Since the processor is running, did you actually halt the core to check if this particular variable is updated? 

    Due to internal characteristics and/or optimization, it is possible the compiler does not assign the value until it is first used, which may happen after main. If you attribute the modifier const before the declaration, you may be able to confirm this behaviour (const variables are usually assigned its values before main).

    Another possibility is to see if a rogue pointer or overrun buffer may be overwriting this memory area, which will in fact cause its value to be modified. I think that the F28x cores feature watchpoints, which allow breaking the execution in case of a read or write operation to a pre-defined address. For details on how to set this up, check section 7.4.7 of the CCS User's Guide at:

    http://software-dl.ti.com/ccs/esd/documents/users_guide/index_debug.html 

    Hope this helps,

    Rafael