STM32F0 eeprom emulation
I implemented the eeprom function by referring to the link above. However, there is a phenomenon that the device restarts while switching pages(Looking at the internal code, there is a problem when deleting the page.).
Here's the part I modified.
1. Increased storage space due to large idle flash space.
2. Increased storage variables to 6.
3. If you keep saving only one of the saved variables, some variables will be lost when you switch pages, so all variables are saved together when saving.
//eeprom.h
//...
#define VIRT_ADDR_VAR_A 0x00
#define VIRT_ADDR_VAR_B 0x01
#define VIRT_ADDR_VAR_C 0x02
#define VIRT_ADDR_VAR_D 0x03
#define VIRT_ADDR_VAR_E 0x04
#define VIRT_ADDR_VAR_F 0x05
//...
/* EEPROM start address in Flash */
#define EEPROM_START_ADDRESS ((uint32_t)ADDR_FLASH_PAGE_90) /* EEPROM emulation start address */
/* Pages 0 and 1 base and end addresses */
#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS))
#define PAGE0_END_ADDRESS ((uint32_t)(ADDR_FLASH_PAGE_97 + (PAGE_SIZE - 1)))
#define PAGE1_BASE_ADDRESS ((uint32_t)(ADDR_FLASH_PAGE_98))
#define PAGE1_END_ADDRESS ((uint32_t)(ADDR_FLASH_PAGE_105 + (PAGE_SIZE - 1)))
//...
/* Used Flash pages for EEPROM emulation */
#define PAGE0 ((uint16_t)0x0000)
#define PAGE1 ((uint16_t)0x0008) /* Page nb between PAGE0_BASE_ADDRESS & PAGE1_BASE_ADDRESS*/
//...
/* Variables' number */
#define NB_OF_VAR ((uint8_t)0x06)
//...I even have example code, but I don't know what kind of stupid thing it is.
