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 v5 for MSP430

Hi ,

I would like to migrate from IAR to CCSV.5 . 

On IAR i can define a buffer in non volitile memory as follows:  __no_init unsigned char buff[64];

Can somone advise how can i define this on ccs5?

Thanks 

 

 

  • Hi Aviel,

    Have you had a look at the migration section of this guide?

     

    http://students.byu.edu/~cs124ta/references/downloads/CCS/slau157k%20-%20Code%20Composer%20Studio.pdf

    Please let us know whether you find all you need there regarding the differences and migration.

    Best Regards,
    Lisa

  • Yes i did.

     

     

     

     

     

     

     

    #pragma

     

     

    int buff[32]

    Will end with an error.

    Thanks.

    DATA_SECTION(buff[64], "MYSEGMENT")

  • sorry,

    #pragma DATA_SECTION(buff[64], "MYSEGMENT")

     int buff[32];

    Ends with an error.

    Thanks,

     

     

  • Hi Aviel,

    What error do you get?  Are you trying to place the data at an absolute location?  Or into a named segment?  

    If at at an absolute location, did you make the linker command file modifications as in the migration guide? 

    I have copied the relevant section below.

    Please let us know.

    Best Regards,

    Lisa

     

    The scheme implemented in the IAR compiler using either the @ operator or the #pragma location
    directive is not supported with the CCS compiler:


    /* IAR C Code */
    __no_init char alpha @ 0x0200; /* Place ‘alpha' at address 0x200 */
    #pragma location = 0x0202
    const int beta;


    If absolute data placement is needed, this can be achieved with entries into the linker command file, and
    then declaring the variables as extern in the C code:


    /* CCS Linker Command File Entry */
    alpha = 0x200;
    beta = 0x202;
    /* CCS C Code */
    extern char alpha;
    extern int beta;


    The absolute RAM locations must be excluded from the RAM segment; otherwise, their content may be
    overwritten as the linker dynamically allocates addresses. The start address and length of the RAM block
    must be modified within the linker command file. For the previous example, the RAM start address must
    be shifted 4 bytes from 0x0200 to 0x0204, which reduces the length from 0x0080 to 0x007C (for an
    MSP430 device with 128 bytes of RAM):


    /* CCS Linker Command File Entry */
    /****************************************************************************/
    /* SPECIFY THE SYSTEM MEMORY MAP */
    /****************************************************************************/
    MEMORY /* assuming a device with 128 bytes of RAM */
    {
    ...
    RAM :origin = 0x0204, length = 0x007C /* was: origin = 0x200, length = 0x0080 */
    ...
    }
    The definitions of the peripheral register map in the linker command files (lnk_msp430xxxx.cmd) and the
    device-specific header files (msp430xxxx.h) that are supplied with CCS are an example of placing data at
    absolute locations.

    In IAR, it is possible to place variables into named segments using either the @ operator or a #pragma
    directive:


    /* IAR C Code */
    __no_init int alpha @ "MYSEGMENT"; /* Place ‘alpha' into ‘MYSEGMENT' */
    #pragma location="MYSEGMENT" /* Place ‘beta' into ‘MYSEGMENT' */
    const int beta;


    With the CCS compiler, the #pragma DATA_SECTION() directive must be used:


    /* CCS C Code */
    #pragma DATA_SECTION(alpha, "MYSEGMENT")
    int alpha;
    #pragma DATA_SECTION(beta, "MYSEGMENT")
    const int beta;

  • Aviel Sela said:

    #pragma DATA_SECTION(buff[64], "MYSEGMENT")

    The syntax should be:

    #pragma DATA_SECTION(buff, "MYSEGMENT")