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 5:aa44afa6ca35, committed 2016-09-23
- Comitter:
- mega64
- Date:
- Fri Sep 23 17:44:45 2016 +0000
- Parent:
- 4:0545cac4e5f9
- Child:
- 6:669ff12928f9
- Commit message:
- fix STM error in EE_VerifyPageFullyErased
Changed in this revision
| eeprom/eeprom.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/eeprom/eeprom.cpp Fri Sep 23 16:53:39 2016 +0000
+++ b/eeprom/eeprom.cpp Fri Sep 23 17:44:45 2016 +0000
@@ -330,9 +330,20 @@
{
uint32_t readstatus = 1;
uint16_t addressvalue = 0x5555;
+ uint32_t end_address;
+
+ if (PAGE0_BASE_ADDRESS==Address)
+ {
+ end_address = PAGE0_END_ADDRESS;
+ }
+ else
+ {
+ end_address = PAGE1_END_ADDRESS;
+ };
+
/* Check each active page address starting from end */
- while (Address <= PAGE0_END_ADDRESS)
+ while (Address <= end_address)
{
/* Get the current location content to be compared with virtual address */
addressvalue = (*(__IO uint16_t*)Address);