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.

Pragma DATA_SECTION ignored in EABI Format

Other Parts Discussed in Thread: MSP430G2452, MSP430G2432

Hi,

We have developed an application using MSP430G2452 and we
need to place some constant data into INFO D memory.

using "DATA_SECTION" pragma like below, we are not able to place the Constant data
into the Info memory.

#pragma DATA_SECTION(data, ".infoD")
const unsigned int data = 0x12;

It works fine when the "Output Format" is changed to "Legacy COFF".

But since our whole project is developed under "EABI" Output Format,
the application doesn't work properly if we change the output format to "Legacy COFF".

Please let us know if there is any way to store constant data(INFO memory)
retaining "EABI" format.

Regards.
Paddu

  • Hi,

    i could use the pragma DATA_SECTION without any problem with the EABI format.

    Please refer to the attached code:

    4530.TEST_BLINK.zip

    Another option, if you are using CCS v5.x (with compiler version v4.x), is to use the pragma LOCATION, please refer to chapter 5.10 of the compiler documentation here

    http://www.ti.com/litv/pdf/slau132g

  • Hi Leo,

    Thank you so much for the reply.

    I tried the "pragma LOCATION" but was unsuccessful.
    I have attached my project file, which is simple sample code with "pragma DATA_SECTION"
    added at the begining.

    Regarding your code TEST_BLINK.zip, it works fine,
    but it doesn't work if you comment out the "P1DIR |= data;" line.
    Could you please have a look.

    Best Regards.
    Paddu

    5102.msp430g2xx2_1.zip

  • paddu1 said:
    I tried the "pragma LOCATION" but was unsuccessful.
    I have attached my project file, which is simple sample code with "pragma DATA_SECTION"
    added at the begining.

    The attached msp430g2xx2_1.map shows:

    1) The linker has placed the code in RAM rather than FLASH, which means the program won't run. The project contains a msp430g2432.cmd file for "Linker Command File for defintions in the header file", rather than the lnk_msp430g2452.cmd file for "LINKER COMMAND FILE FOR LINKING MSP430G2452 PROGRAMS" I would expect in a CCS 5 project. How was the project created? Were any warnings reported by the linker?

    2) The data symbol for the info D segment isn't in the linker map. I think the linker has optimised out the symbol since there was no references to it from the code.

    From memory there is a "RETAIN" directive which forces the linker to include a symbol / section that isn't referenced.

    paddu1 said:
    Regarding your code TEST_BLINK.zip, it works fine,
    but it doesn't work if you comment out the "P1DIR |= data;" line.
    Could you please have a look.

    Do you mean that when the  "P1DIR |= data;" line is commented out, that the data symbol is no longer place in the Info D segment? (probably for the same reason as 2 above)

  • Thank you....Solved the problem, the linker has optimized out the symbol since there was no references to it from the code.

**Attention** This is a public forum