program flash data?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

program flash data?

874 次查看
zengxianke
Contributor II

I have two global variables.

int a = 123;

int F_a = 789;

my ld script is :

e.g.

.asec

{

.data.a

} > myram; // no load address, only reserve spaces in ram.

.Fsec

{

.data.F_a

} > myflash; // only load data 789 to FLASH

after boot then main then...init:   copy F_a data in flash to .data.a 's ram address. now  a value is 789.

 

then calibrate a to 790 for example through can or sci or something else, and then PROGRAM 790 to F_a in the flash for next power up and init a with 790.

but CAN NOT ERASE & PROGRAM Success!   WHY?

0 项奖励
2 回复数

607 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

which MCU are you using - S32K144? 

For calibration data and S32K144 is better idea use FlexNVM configured as EEEROM. With direct write into pflash you have to erase at least one sector then program it and verify. With EEEROM you only call FLASH_DRV_EEEWrite() fucntion. 

You can look at flash_partitioning_s32k144 S32DS Example. 

Jiri 

607 次查看
zengxianke
Contributor II

Thank you. It is a good suggestion. In fact, the flash content changed, but the debugger not update. I guess it read the data from elf file once. I use some array for check my program flash action, it is correct. Maybe debugger find that the ld script say the range is data initial value, so it doesn't update the viewer from flash volatilely. Thank you so much.

0 项奖励