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.

volatile with DATA_SECTION pragma not enough

Hi,

We are working on C6678 using CCSV6 . We had an array of 30000 int defined as volatile int in global section of the code, and we used a DATA_SECTION pragma to place this array in different areas of C66x memory.

However, we could not find the array variable in our map file until we used "dummy" code that touches on the array in C66x code.

The purpose of this array is for external device communication, and we don't want the C66x to access the array in any way. Why isn't the volatile keyword working? Is there anything else we need to do in addition to volatile?

Thanks!

Sarvani Chadalapaka

Signalogic

  • Hi,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com).

    From my understanding, it is the expected behavior.  You shall work with compiler optimization level.

    This is keystone device forum so device/peripheral/MCSDK related queries and issues are addressed here.Please post your compiler related queries to Compiler forum and Code Composer Studio related queries to CCS Forum.

    Thank you.

     

  • Hi,

    The volatile keyword has a complete different meaning. It regards the way the generated code access the data (read/write) but has no effect on the linker and if you don't access them at all.

    The C6x linker by default remove all unused section. To force the inclusion, you have to use the "--retain" linker option (see CCS linker settings). Note that the array should have global visibility, that is it cannot be declared "static", otherwise the compiler remove it (it is not passed to the linker stage).

    You can also use the compiler #pragma RETAIN.