diff --git a/armsrc/spiffs_config.h b/armsrc/spiffs_config.h index 4f8a5dd26..d0d4eb1d7 100644 --- a/armsrc/spiffs_config.h +++ b/armsrc/spiffs_config.h @@ -28,6 +28,7 @@ #include "printf.h" #include "string.h" #include "flashmem.h" +#include "pmflash.h" //#include //#include @@ -236,7 +237,7 @@ typedef uint8_t u8_t; // Instead of giving parameters in config struct, singleton build must // give parameters in defines below. #ifndef SPIFFS_CFG_PHYS_SZ -#define SPIFFS_CFG_PHYS_SZ(ignore) (1024 * 64 * (spi_flash_pages64k - 1)) +#define SPIFFS_CFG_PHYS_SZ(ignore) ((1024 * 64 * spi_flash_pages64k) - (1024 * 4 * (FLASH_RESERVED_TRAILING_4K_SECTORS + 1))) #endif #ifndef SPIFFS_CFG_PHYS_ERASE_SZ #define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (4*1024) diff --git a/include/pmflash.h b/include/pmflash.h index 8f9f9c741..3a6b361b6 100644 --- a/include/pmflash.h +++ b/include/pmflash.h @@ -48,6 +48,8 @@ # define FLASH_MEM_MAX_4K_SECTOR_P(p64k) (FLASH_MEM_MAX_SIZE_P(p64k) - 4096) #endif +#define FLASH_RESERVED_TRAILING_4K_SECTORS 10 + #ifndef FLASH_MEM_ID_LEN # define FLASH_MEM_ID_LEN 8 #endif