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/MSP430F5435: IAR migration to CCW using #pragma

Part Number: MSP430F5435

Tool/software: Code Composer Studio

CCS 7.0.Version: 7.0.0.00043 in Win10

I have imported code from an older IAR (V5.x) and I am migrating to CCS7.  The problem I cannot seem to get past has to do with converting the #pragma statements for placing user variables in the various INFO sections.  The IAR directives look like:

#pragma location = "INFOB"
__no_init TypDefName         VarName

converting this to:

#pragma DATA_SECTION(VarName, "'infoB")

subsequent lines read:

#pragma DATA SECTION(VarName2, "infoC")

#pragma DATA_SECTION(VarName3, ".infoC")

All compiles without error until the line with VarName3 is introduced which the compiler then warns of:

Description Resource Path Location Type
#824-D pragma DATA_SECTION can only be applied to a file level symbol definition, not "Varname" (declared at line 32 of "..\foo.h") foo.c line 22 C/C++ Problem

If I move the declaration from the .h file to the .c file, it throws the same error but now points to the line in the .c file where the variable is typed.

So I switched to try using #pragma dataseg = INFOC and the compiler does not recognize the dataseg declaration.

I am really pretty frustrated with the lack of good documentation and/or good code examples to properly handle placing variables in INFO memory.

I am also frustrated understanding why it would compile without error until the third instance of a declaration is made which does not have anything to do with the second use of infoC as I did try changing that to .infoD and got the same result.

Examples using structures would also be a plus if something extra needs to be done.  Note the structures I am using are externally defined in another file.  Another wrinkle.

Any Help?

  • Looks like I will be answering my own question since I seemed to have figured out half of the answer. The use of #pragma DATA_SECTION that the compiler does not complain about is:
    #pragma DATA_SECTION( VarName, ".info[B,C,D]")
    Type_StructName VarName;
    Inside the square braces just use one letter selecting the INFO area of choice.

    The only question that remains to be answered is how to handle the __no_init that IAR had in there that CCS7 does not recognize.
  • Greg Greenwood said:
    The only question that remains to be answered is how to handle the __no_init that IAR had in there that CCS7 does not recognize.

    Does The NOINIT and PERSISTENT Pragmas answer your question?

  • That was a great help. thanks for pointing me to the SLAU1320 CCS compiler user's guide which to this point I have not stumbled on my searches. I have to point out however that the NOINIT pragma cannot be used along with the DATA_SECTION pragma. It will throw an error since the NOINIT pragma is for variables that exist in ram and the compiler cannot group NOINIT and INIT varaibles in the same flash segments. In this case the entire segment has to be set as NOINIT in the linker cmd file such as:
    .param1 : {} > PARAM1 type=NOINIT.
    Thanks for assist. It got me back on track