2020-06-17 07:57 PM
Hi. I'm using an STM8 MCU. I'd like to reliably write to and read from a block of EEPROM/FLASH memory (about 1k) that will never be overwritten either by the MCU or by programming/debugging via SWIM, but can be read and written from code. I'm writing RFID tag codes that should always be preserved on power off and then reliably read and written during operation.
I was following the FLASH peripheral example (FLASH_ByteReadWriteOperation) literally (starting at 0x9000), which seemed to work. But then I was forced to change from disabling compiler optimizations to minimizing code size in order to avoid a "segment .text size overflow" compiler error at which point that area started getting overwritten.
If I'm not planning to rearrange the basic memory structure of the device manually beyond changing optimizations (or alternatively I can do so if advised, for example using MASS), can someone suggest how (or where) in memory to do this safely? Thanks.