2022-06-02 12:05 PM
I am using STM8 and since vector table is in flash memory I need to write to flash memory in order to create and use vector table. Since addresses of vector tables are fixed my code writes same values to same memory address of the flash on every startup. But there is no erase in the code so I thought after the first write process it won't do anything anymore. My question is would it reduce the life of flash if I write to same flash memory address on every startup/reset without erasing?
2022-06-14 05:17 AM
Hi!
I do not really understand why you write the vector table each startup, but for sure re-writing the same location every reset will dramatically reduce the flash lifetime - the max. number of re-writes also depends on device type.
When you write a memory location, if the location is not empty, erased, it will automatically erase it before the write, except for fast block programming - are you using this method?
STM8 is not AVR. Maybe you come with the AVR experience, where if you don't erase the location and perform a simple write (not atomic write) the result is the logic and operation between current content and newly written.