cancel
Showing results for 
Search instead for 
Did you mean: 

preserving internal EEPROM when flashing

Schmid.M.
Senior
Posted on January 10, 2018 at 12:16

Hello,

I changed my linker file for flashing some initial values to the internal EEPROM of my stm32l0.

MEMORY

{

...

EEPROM (rw)      : ORIGIN = 0x80803E8, LENGTH = 1044

}

/* Define output sections */

SECTIONS

{

  .eepromAPN :

  {

    /*. = ALIGN(4);*/

    KEEP(*(.eepromAPN.number)) /* numberofApns */

    KEEP(*(.eepromAPN*)) /* APNs */

    /*. = ALIGN(4);*/

  } >EEPROM

...

}

this is implemented and working nicely. but:

whenever I reflash the controller, all other EEPROM parts (between 0x8080000 and 0x80803E8) are erased.

they were not reset before these changes to the linker file.

how can I prevent this? I have some important calibration data in the EEPROM, which MUST be unchanged when flashing.

Thanks,

Michael

#stm32l0 #linker
4 REPLIES 4
Schmid.M.
Senior
Posted on January 10, 2018 at 13:27

apart from this, also the st-link utility can't flash the .bin anymore, because it is 'bigger than flash memory size'. With segger j-link it flashes perfectly... what is the difference?

Posted on January 10, 2018 at 16:30

Does it work with a .HEX file? Those at least can be sparse, so that the .BIN in fact doesn't look bigger than the FLASH when considered without regard to the EEPROM size.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on January 12, 2018 at 11:43

Thank you. using .hex format, it flashes successfully.

Still I have the problem with erased EEPROM Memory.

in the .hex file, 0x8080000 to 0x80803E8 are not defined, I checked that. still they are erase when I flash.

If I check the 'skip erase' option in st-link Utility, it does not erase anything (which is not the best way to do it as well).

Also other flashing tools like Segger J-link seem to erase the whole memory before flashing th .hex

Are there some linker file commands which can tell the flashing tool not to erase certain parts of EEPROM?

Posted on January 12, 2018 at 13:49

I changed the adresses of my linker file to the second EEPROM bank and it is not erasing the unused part in bank1 anymore.