Other Parts Discussed in Thread: MSP430FR2311
I have a project using the MSP430FR2311 which has both RAM and FRAM. I'm trying to put an array into FRAM using the #pragma persistent directive as such:
#pragma PERSISTENT
uint16_t persistent_array[128];
When I compile I get a warning message:
..., line 228 (col. 10): warning #1519-D: variable "persistent_array" was declared persistent and should be explicitly initialized
This warning message is as expected, and seems to indicate the compiler understands the directive. However, the map file shows this array is still put into the .bss segment which gets placed into RAM and not FRAM:
.TI.persistent
* 0 0000f100 00000000 UNINITIALIZED
...
.bss 0 00002000 00000322 UNINITIALIZED
...
0000229e 00000080 (.common:persistent_array)
If I remove the "#pragma PERSISTENT," there is absolutely no change to the map file, but the warning does disappear.
I am using the standard unmodified linker file as generated by CCS. ".TI.persistent" is sent to FRAM and ".bss" is sent to RAM.
I also noticed a bunch of posts which give suggest a slightly different syntax:
#pragma PERSISTENT(persistent_array)
uint16_t persistent_array[128];
However, this leads to an error during compiling:
..., line 224: error #18: expected a ")"
I'm using the TI compiler.
Similar post but solution does not work:
How can I get the #pragma PERSISTENT directive to work as expected?