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/MSP430FR5994: Assign a fixed address for an array variable in FRAM

Part Number: MSP430FR5994
Other Parts Discussed in Thread: UNIFLASH, BOOSTXL-AUDIO

Tool/software: Code Composer Studio

Hi, 

I am playing with the example code of BOOSTXL-AUDIO_430BOOST-SHARPLCD_FFT_FIR_LEA_MSP430FR5994 in CCS. I want to define a new array to log the result of FFT in FRAM. I need to read the memory out by UniFlash later when the experiment is done, so I must assign a fixed address to the variable "FFT_result".

#pragma LOCATION(FFT_result, 0x149cc);
#pragma PERSISTENT(FFT_result);
uint16_t FFT_result[100] = {0};
uint16_t Counter = 0;

However, the FFT_result array can not be written. I even tried "FFT_result[Counter++] = 1" and the array still kept unchanged(I watched it by entering CCS debug mode). Then I tried to remove the address-assign line "#pragma LOCATION(FFT_result, 0x149cc);"  then it works fine. The FFT_result  array can be re-written. I know there is an MPU(FRAM memory protection unit) setting which I have to uncheck. I have already unchecked it. And as I mentioned, when I remove the address-assign line "#pragma LOCATION(FFT_result, 0x149cc);", the FFT_result can be re-written. So the MPU should not be the reason here. 

Do you have any idea what causes this issue? Is it because the address "0x149cc" is not right? I also tried "0x10000" and it does not work either.

Thanks,

Yubo

  • You mentioned "unchecking" in the MPU screen, but not "checking" anything.

    You need to provide "W"rite access to Segment 3 where your variable is.

    Also, since you're (presumably) using the "large" model, you need to give "X"ecute access, since the linker will preferentially put your code there.

  • Hi Bruce,

    After you uncheck the "Enable Memory Protection Unit(MPU)", the panel below will be frozen, which means you can not provide "W"rite access to any segment. Those settings can only done when you check the MPU.

    Thanks,

    Yubo

  • I see what you're saying now. I was thinking of "Let compiler handle..". 

    I un-checked the Enable box and I can still write to that variable with both a program and the debugger.

    The program is a copy of Example msp430fr599x_LPM3_02 into which I pasted your code above. I ran it on a Launchpad, and checked the results with the debugger. I'm not sure what we're doing differently.

**Attention** This is a public forum