Skip to content

Commit 843b8af

Browse files
author
Owen L - SFE
committed
prevent crashes from writes to high EEPROM addresses
writing to 8176 and above seems likely to cause a crash with 32 and 64-bit wide data types. restricting the size of EEPROM a little bit seems to nearly eliminate these problems. while this is not a true solution or a good fix it is good enough for now
1 parent 4b035e6 commit 843b8af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/EEPROM/src/EEPROM.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060

6161
#define AP3_FLASH_EEPROM_START 0xFE000
6262
#define AP3_FLASH_PAGE_SIZE 8192
63-
#define AP3_EEPROM_MAX_LENGTH AP3_FLASH_PAGE_SIZE
63+
#define AP3_EEPROM_MAX_LENGTH (AP3_FLASH_PAGE_SIZE - 16)
6464

6565
#if AP3_FLASH_EEPROM_START % AP3_FLASH_PAGE_SIZE
6666
Error : EEPROM start address must be divisble by 8192
6767
#endif
6868

69-
//The size of the EEPROM may be (ptionally) user-configured using the EEPROM.setLength()
69+
//The size of the EEPROM may be (optionally) user-configured using the EEPROM.setLength()
7070
//method. Valid values are in the range [0, AP3_EEPROM_MAX_LENGTH]. Reducing the size of
7171
//EEPROM will cause data stored in the higher addresses to be lost. The default size is
7272
//set below. See Example2_AllFunctions for a usage example.

0 commit comments

Comments
 (0)