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/MSP430FR5969: FRAM memory - replacing array with pointers

Part Number: MSP430FR5969

Tool/software: Code Composer Studio

Hi,

We are using MSP430FR5969. In that, I tried to write the data into FRAM memory. When I use array in the code it works fine. But when I replacing the array with pointers it doesn't work and it shows "Error: Attempted to read past the end of memory at 0xFFFFFFFF " in the expression tab for the assigned pointer variables. 

So my question is,

1. Whether we can use pointers to store the data in FRAM memory?

2. How to replace the array by pointers to store the data in FRAM location?

3. How to set the boundary for segment 1 and segment 2?

4. How to increase the length of FRAM2?

Please find the below sample,

#pragma NOINIT(crest_value_array_3)
unsigned int crest_value_array_3[60];                   // Declaration - This is what i assigned the variable to FRAM memory using array

#pragma NOINIT(crest_value_array_3)
unsigned int *crest_value_array_3;                        // Declaration - This is how i replaced the array using pointers

So, let me know whether my assignment was correct for pointers. And please respond for the above questions. Thanks

  • 1) You can use pointers to store data in FRAM, but the thing the pointer points to has to be writeable in the MPU. If you use PERSISTENT or (evidently) NOINIT the linker+startup take care of this for you.
    2) In C it's not really meaningful to "replace an array by pointers", since they're different things -- your array has 60 items, and the pointer only 1. You can create a pointer to an array, but the array has to already exist separately. You can initialize the pointer to point to the array ("unsigned *ptr = &array[0];"), but in that case you'd need to use PERSISTENT rather than NOINIT. You can also assign the pointer at runtime ("ptr = &array[0];"); your error message indicates that you're not doing that.
    It's also possible to create an "anonymous" array by using absolute addresses into FRAM ("ptr = (unsigned *)0x10000;"), but in that case you need figure out the addresses, make sure nothing else is using them, and re-program the MPU yourself; this is hazardous and cumbersome, and has little to recommend it over PERSISTENT variables.
    3) FRAM1 and FRAM2 are split to provide for the interrupt vectors, which can't be moved.
    4) FRAM2 goes to the end of (FRAM) memory, so for a given MCU device it can't be extended.

**Attention** This is a public forum