cancel
Showing results for 
Search instead for 
Did you mean: 

Flash as eeprom

juanjo
Associate II
Posted on April 12, 2015 at 21:22

Hi,

I have a page to use as data in the flash programme memory. I can read, write values and all this task works find.

But I need to write an initial value at programming time. I mean, to write for exemple 0x00 when the MCU is flashed. This value can't rewrite at MCU reset.

It can be done in the options -- Linker, (IAR project oconfiguration) because if I put that in code every time that the MCU restart will be rewritten.

I'm sure that must be easy but I can't find how to do it.

Thanks in advance.

Regards.

#stm32-flash-data
3 REPLIES 3
Posted on April 12, 2015 at 22:34

Create a small section of .HEX file with your specific data and merge it with that of the application code?

Alternatively code your app so that it recognizes that the initial is set, or not, and only set it when required.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
juanjo
Associate II
Posted on April 13, 2015 at 11:53

Thanks clive, always is a pleasure to count with your opinion.

To merge hex files seems dificult to maintain.

I thoug about the second one, but my impression is that should be some directive or something like that to do it, but maybe it is not posible.

For example with pic you can write: 

#rom 0x2100 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

And that initialize the EEPROM to cero in the indicated  positions.

Thanks again.

Posted on April 13, 2015 at 15:23

Ok, and you can't do that with ''static const'' data and direct it into a FLASH section assigned to the ''EEPROM''. Via linker script, or .ICF file.

If you want it to be maintainable out of the linker put the appropriate functionality in the source code. Our process is to package and sign firmware images in post link steps, and that seems maintainable for us.

Is the data actually zero, or serial number or calibration data? Are there known defaults? Can the application have a test/config mode run during final test that can write default/specific data? Can the application recognize the erased state (0xFFFFFFFF), or a checksum on the configuration data, and write default settings?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..