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/MSP432P401R:如何将初始化的变量移动到闪存?

Guru**** 2583445 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/614913/ccs-msp432p401r-how-can-i-move-initialized-variable-to-flash

部件号:MSP432P401R

工具/软件:Code Composer Studio

如何  将初始化的变量移动到闪存?

我要将SRAM变量移动到闪存。

1.如何   将.DATA或.BSS (SRAM)中的变量移动到闪存? 不 存储 已在闪存中的数据。

当 我 执行此代码时,

#pragma data_section (var1,".MyData");

#pragma data_align(var1,2);

Int var1 = 5;

void main (void){

printf ("var1 =%d\n",var1);

}

然后,var1的地址在Flash中,但var1的值不是5。它的值只是垃圾。(如-1)

如何将变量完美地移动到Flash?

2.另外,如何  将“局部变量”移至Flash? 如果没有,如何  将其从SRAM复制到闪存?

void main (void){

间隔2 = 10;

printf ("var2 =%d\n",var2);

}

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

    您好,

    您必须使用闪存控制器API擦除和写入闪存。 请查看此处提供的闪存程序内存示例代码: dev.ti.com/.../

    希望这能有所帮助。

    David