florisla / stm32loader

Flash firmware to STM32 microcontrollers using Python.
GNU General Public License v3.0
111 stars 55 forks source link

How to limit flash erased? #56

Closed tomvarghese closed 1 year ago

tomvarghese commented 2 years ago

Is there a way to limit how much of the flash is erased. In my particular case I have some configuration information for the device stored at the end of flash and my program is much smaller than the full flash.

I would prefer not to lose the configuration when I update the firmware.

Anyone done a fork of this that has addressed this?

I'm using the STM32L0xx processors only at the moment.

florisla commented 2 years ago

The command line does not offer this option currently.

But the erase_memory() method does allow you to specify the addresses of individual pages which need to be erased.

florisla commented 1 year ago

The next release will support --erase in combination with --address and --length like this:

stm32loader --erase --address 0x08000000 --length 0x2000 --port /dev/cu.usbserial-A5XK3RJT