program flash data?

cancel
Showing results for 
Search instead for 
Did you mean: 

program flash data?

279 Views
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 Kudos
2 Replies

12 Views
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 

12 Views
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 Kudos