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.

[参考译文] MSPM0G1505:闪存读取

Guru**** 2392405 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1361175/mspm0g1505-flash-read

器件型号:MSPM0G1505

有10个 int 值、我想存储在闪存中。 这些是给定产品的用户设置。

问题是如何从闪存中读取变量、以及是否有合适的方法来决定应在闪存中的哪个位置存储数据? 现在、我获取了位置0x1000、因为我通过查看存储器分配窗口知道它是空的、但这似乎是一种粗略的方法。

代码:

int variable_flash;//全局变量

int main() {

int * ptr;

ptr=0x1000; //这是我要读取的闪存中的地址  ...此行中出现错误

variable_flash=*ptr;
这是从闪存中读取数据的正确方式吗? 这应该读取4字节、即4个连续的地址对正?
错误为:  
[6]../flashctl_multiple_size_read_verife.c:232:8:错误:从"int"分配给"int *"的整数到指针转换不兼容[- Wint-conversion]
[7] ptr=0x1000;
[8]^~~~~