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.

Compiler/MSP430F2132: Write const data in InfoD memory at Flash time

Part Number: MSP430F2132
Other Parts Discussed in Thread: MSP-CGT,

Tool/software: TI C/C++ Compiler

Hi,

I am trying to generate an Elf file with constant data located in the INFOD MEMORY area. I am using the MSP-CGT 18.12.4.LTS compiler suite and the standard linker command file for the MSP430F2132 microcontroller provided by CCS v9.3 which defines the INFOD MEMORY area as follows:

    INFOD                   : origin = 0x1000, length = 0x0040

and the section directive:

    .infoD     : {} > INFOD

My source file contains the following instructions:

#pragma DATA_SECTION(C_initialCalibPrm,".infoD");
const t_NvmData C_initialCalibPrm = 0x0000;

At link time I get the following error message: warning: section executable.elf(.infoD) at 01000h falls in unconfigured memory (skipped), while the MEMORY area seems properly configured in the linker command file for me.

Any idea on the origin of this problem?

Thanks in advance.

  • I don't see the same symptom as you do (CCS v8), but I succeeded with either non-const or "volatile const". I wonder if the compiler is taking some liberties with the "const" attribute.

  • I tried the two proposed solutions without success:

    • Using "volatile const"  does not suppress the linker error message.
    • Supressing the "const" qualifier changes the constant data into an initialized variable. In this case the linker successfully locates the variable in INFOD MEMORY area but the produced Elf file does not contain any data to program that area: the corresponding .infoD Section is of type "SHT_NOBITS" and the corresponding Memory Segment is empty. Moreover, the map file indicates:
    .infoD     0    00001000    00000010     UNINITIALIZED

    So, the generated Elf files does not permit to program that area.

  • Hi Jerome,

    You might try replacing 

    #pragma DATA_SECTION

    with

    #pragma CODE_SECTION 

    to program the flash.  You can find more info in Section 5.11.5 in the compiler UG.

    https://www.ti.com/lit/ug/spnu151v/spnu151v.pdf?ts=1594922986245

    BR,
    Leo

  • Hi Leo,

    I tried your proposition. At compilation time I get the following warning message:

    warning: pragma CODE_SECTION can only be applied to a function definition, not "C_initialCalibPrm"

    In the generated Elf and map files, the infoD section is kept empty:

    MEMORY CONFIGURATION
    
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
    INFOD                 00001000   00000040  00000000  00000040  RWIX

    So this solution does not seem to solve the problem