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.

[参考译文] EK-TM4C1294XL:在闪存上保存/存储结构

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/600616/ek-tm4c1294xl-save-store-struct-on-flash

器件型号:EK-TM4C1294XL

大家好、
首先,感谢社会各界人士,这是一个很好的信息来源。

我想 使用 Flash_PB 库来写入闪存、该库位于 TI 提供的 tivaware / utils 上。 我参考了一些没有结果的示例。


我使用的是 TM4C1294XL Connected launchpad、Windows 7、CCS V7和 TI 16.9.1 LTS 编译器。
我只是使用闪存来存储一些永久性参数。 我的结构非常简单:只有2个 uint32_t 变量。

当系统加电时、如果没有有效的参数块、我将初始化闪存块和变量

FlashPBInit (0x3F800、0x40000、512);

if (!pucParamBlock){ //如果没有有效的闪存参数块,则...

tFlashParams.var1=0x01;
tFlashParams.var2=0x02; //将全局结构中的所有变量初始化为其默认值

FlashPBSave ((unsigned  char*)&tFlashParams); //...并将结构写入默认值 到闪存




用户按下按钮后、此变量会增加、然后存储在闪存中:


tFlashParams.var1++;
tFlashParams.var2++;

//

FlashPBSave ((unsigned char*)&tFlashParams);  //在闪存上写入结构



然后、我得到以下值:


pucParamBlock=FlashPBGet ();
memcpy (&tFlashParams、pucParamBlock、uLen);

这不起作用、我得到的值毫无意义。 我不知道为什么。 也许我不了解如何使用闪存来存储它、我很迷路了。

谢谢!
Jordi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您的 FlashParams 结构是什么样的? 您是否为序列号和校验和保留了前两个字?