Typical message

"main.c", line 36 (col. 5): error #1521: variable "fram_variable" cannot be noinit and also have DATA_SECTION pragma. Without DATA_SECTION pragma, "fram_variable" will be in section .TI.noinit:fram_variable. With only DATA_SECTION pragma, you must mark the section noinit in the linker cmd file.
1 error detected in the compilation of "main.c".

What it means

The code being compiled has a global variable that has the DATA_SECTION pragma as well as either NOINIT or PERSISTENT pragma (or attributes).

#pragma DATA_SECTION(fram_variable, ".infoA")
#pragma NOINIT(fram_variable)
int fram_variable;

Why is it happening

The linker only supports marking an entire memory section in the command linker file as NOINIT or non-NOINIT. NOINIT and non-NOINIT variables may not be mixed within the same command linker file memory section. The NOINIT mechanism is used by both #pragma NOINIT and PERSISTENT. The linker then creates special sections .TI.noinit and .TI.persistent which are marked as NOINIT, ensuring it does not mix NOINIT and non-NOINIT.

However, if the same variable also has the #pragma DATA_SECTION applied, then the compiler cannot ensure that that section will only be NOINIT. The linker will not allow combining NOINIT and non-NOINIT data in the same memory section.

Remedy

Specify NOINIT type which will make the variables residing in the memory section not being initialized inside the C-start-up function.

SECTIONS
{
    .............
    .infoA     : {} > INFOA type=NOINIT              /* MSP430 INFO FRAM  MEMORY SEGMENTS */
    .............
}

For more information on specifying a new memory segment with NOINIT, see below article: |processors.wiki.ti.com/index.php/Creating_MSP430_FRAM_Variables_Using_CCS

Risks, Severity

An executable cannot be created until this error is resolved.

E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Compiler/diagnostic messages/MSP430/1521 here.