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.
Tool/software:
Hello everyone,
I'm currently working with the MSP430FR5994 development board, and I plan to implement a small file system on it. I would like to store some of the file system's meta data in the FRAM of the MSP430FR5994. Specifically, considering that the FRAM has 256KB, I want to use a continuous 100KB section to store this meta data. The data needs to be accessible for reading and modification, and it should remain intact after a power loss.
However, I'm facing some significant challenges in operating the FRAM. I have gone through an official TI document: https://www.ti.com/lit/an/slaa628b/slaa628b.pdf?ts=1725178347028, and there's an example on page 6 that seems to fit my needs (see the attached image).
Unfortunately, the example is not complete, and I'm still unsure how to implement it, nor can I verify if it truly suits my requirements.
Additionally, according to the example, I need to use #pragma DATA_SECTION(a, ".Image")
every time I declare a variable, which seems inconvenient for storing large data(like 100KB). I wonder if there is a better way to manage such a large amount of meta data?
I would greatly appreciate any advice or experience you can share. Thanks in advance for your help!
1) There are some constraints (a) the MPU only provides 3 regions (b) with 1K alignment and (c) you want to write protect the interrupt vectors along with your code
2) So for a large amount of data, you probably want to use high FRAM (region FRAM2).
3) Your life will be simpler if your code all happens to fit in low FRAM (region FRAM).
4) Using your own DATA_SECTION will also simplify things. Moreover I suggest you package it in as few variables as you can--Ideally one as a structure containing everything. This will keep things from moving around.
You'll probably need to work with the linker .cmd file and the MPU editor. As I recall that document covers those topics.
Hi,
I believe Bruce gives a good explanation on the FRAM operation.
As for the complier side, I would suggest you check the user guide, and below I think could help to organize larger meta data:
You can maintain a separate file to organize the meta data, and set all the .text in this file into your specific section.
The user guide link: MSP430 Assembly Language Tools v21.6.0.LTS
B.R.
Sal
Regarding your first point:
I didn’t fully understand this part. Could you please explain it in more detail?
Regarding your second through fourth points:
I apologize for not mentioning this earlier, but I will have an external storage, possibly NAND flash memory or NOR flash memory, where the majority of the file system’s data will be stored. However, the meta data used to manage the file system will be stored in the FRAM. This is why I emphasized the need for read and write operations on the FRAM, ensuring that the data remains intact even after a power cycle. As you mentioned, I may need to partition the FRAM into two sections: one for the low FRAM (region FRAM) and the other for the high FRAM (region FRAM2). The RAM and low FRAM (region FRAM) would be used for program execution, while the high FRAM (region FRAM2) would be reserved for storing the meta data.
Your linker .cmd file already provides FRAM and FRAM2 regions, but is designed to spread out between them. What you should do first is remove all the references to FRAM2, then add the.section assignment for your DATA_SECTION as the only content of ">FRAM2".
Also you'll want to set "Project ->Properties ->Debug->MSP flash ->Erase options" to "Erase only required sections". [Approximately -- I don't have my equipment here to check.]
My point (1) above is simply observations about the hardware. Points (2) and (3) are the consequences. 3 MPU regions actually isn't very many.
From my point of view, you should follow:
1.separately manage the code region and data region for FRAM.
2.enable MPU for code region, to prevent incorrect operation tampering code area -> MPU will has the smallest alignment, please make sure you take care of this.
B.R.
Sal
**Attention** This is a public forum