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.

MSP430FR5738, FRAM variables, NOINIT not working

Other Parts Discussed in Thread: MSP430FR5738

I am trying to put a variable in FRAM on a mspfr5738 and have it not overwritten when I reprogram or when I reboot.

I have followed Ti's notes for doing that at processors.wiki.ti.com/index.php/Creating_MSP430_FRAM_Variables_Using_CCS.

I have CCS5, TI compiler version v4.1.2, and have set the tools to use EABI(elf) format.

my code has the variable declared as follows:

#pragma NOINIT(my_addr)
int my_addr;

I am using the TI supplied linker command file.

It keeps putting this variable in RAM at about location 0x1c00, but the FRAM (as defined in the linker file) is at location 0xc200, length 0x3d80

I have also tried the PERSISTENT pragma, same result.

Any ideas on what I could be missing??

  • Using 5.3.0.00090 and MSP430 compiler v4.1.5 get the same result that using #pragma NOINIT or #pragma PERSISTENT results in the variables being placed in the RAM rather than FRAM by the linker.

    Found that #pragma NOINIT causes the variable to be placed in the .TI.noinit section, and #pragma PERSISTENT causes the variable to to be placed in the .TI.persistent section by the compiler.

    The lnk_msp430fr5738.cmd that is supplied with CCS 5.3 doesn't contain any entries for the .TI.noinit or TI.persistent sections, so the linker, without any warning generated, places the sections in RAM.

    To get the sections placed in FRAM you can add them to the READ_WRITE_MEMORY group in the linker command file:

      GROUP(READ_WRITE_MEMORY): ALIGN(0x0200) RUN_START(fram_rw_start)
        {
          .cio : {} /* C I/O BUFFER */
          .sysmem : {} /* DYNAMIC MEMORY ALLOCATION AREA */
          .TI.persistent:{}
          .TI.noinit:{}
        }

    With this addition to the linker command file, inspecting the linker map shows variables with a  #pragma NOINIT or #pragma PERSISTENT get placed in FRAM, bit I haven't had a chance to test the resulting program.

  • 1000 Thanks, that solved the problem.

    I wonder why TI went to the trouble of telling people how to do this with the NOINIT pragma, but didn't bother with the telling anyone that the linker command file needed mods.

**Attention** This is a public forum