simple test EEPROM emulation (STM algorithm described in the application notes: AN4061, AN3969, AN2594, AN3390, AN4056) for STM32F091
Description in AN4061 from STM.
Changed (compared with the original code AN4061):
- possibility of a larger size of emulated EEPROM (using multiple Flash pages)
- dummy variables prevent overwrite code in Flash by algorithm of EEPROM emulation
Macro PAGE_NB_PVP (in eeprom.h) defines the size of the virtual page.
Eg. For F091 where Flash page are 2kB value 4 gives 8kB.
Size 8kB virtual page gives you the ability to use max. approx. 2k of 16-bit variables.
Revision 4:0545cac4e5f9, committed 2016-09-23
- Comitter:
- mega64
- Date:
- Fri Sep 23 16:53:39 2016 +0000
- Parent:
- 3:a51a1737b55d
- Child:
- 5:aa44afa6ca35
- Commit message:
- Bug fix for not consecutive areas of pages PAGE 0, PAGE 1.
Changed in this revision
| eeprom/eeprom.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/eeprom/eeprom.cpp Thu Sep 22 03:13:23 2016 +0000
+++ b/eeprom/eeprom.cpp Fri Sep 23 16:53:39 2016 +0000
@@ -47,8 +47,9 @@
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
-/* Dummy variable to protect eeprom pages if code size is bigger than 32kb, needed in Mbed online compiler to avoid conflict with linker (N.S.) */
-const uint8_t Eeprom_area[2 * PAGE_SIZE] __attribute__((at(EEPROM_START_ADDRESS),used))={ [0 ... (2 * PAGE_SIZE-1)] = 0xFF };
+/* Dummy variables to protect eeprom pages if code size is bigger than 32kb, needed in Mbed online compiler to avoid conflict with linker (N.S.) */
+const uint8_t Eeprom_area0[PAGE_SIZE] __attribute__((at(PAGE0_BASE_ADDRESS),used))={ [0 ... (PAGE_SIZE-1)] = 0xFF };
+const uint8_t Eeprom_area1[PAGE_SIZE] __attribute__((at(PAGE1_BASE_ADDRESS),used))={ [0 ... (PAGE_SIZE-1)] = 0xFF };
/* Global variable used to store variable value in read sequence */