Hello!
I found an interesting issue with FLASH_Erase_Sector().
Two setups, one always works the other usually doesn't.
Setup 1 - that always works:
Program starts at SECTOR_0
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
And my variables I wish to save is at SECTOR_10 (0x080C0000)
Setup 2 - That "sometimes" works:
Program starts at SECTOR_6 (2nd 128KB sector)
define symbol __ICFEDIT_intvec_start__ = 0x08040000;
define symbol __ICFEDIT_region_ROM_start__ = 0x08040000;
And my variables I wish to save is at SECTOR_[0 to 5] SECTOR_[7 to 11].
In the 2nd setup the PC will run to the end of the memory (when I stop it and look at the assembly windows).
The weird thing is that it's inconsistent, sometimes it does work..
If I try to debug it, moving step by step it *always* work, if I run it it will fail (stuck)
Looking at the project.map everything looks good..
Maybe it's something to do with timing? (sector <5 are smaller, faster to erase which is also why I prefer the 2nd setup).
Did you encounter this phenomena? What do you think?