diff --git a/demo/env/stm32f10x/non_os/components/easyflash/port/ef_port.c b/demo/env/stm32f10x/non_os/components/easyflash/port/ef_port.c index 160db1c..65d360e 100644 --- a/demo/env/stm32f10x/non_os/components/easyflash/port/ef_port.c +++ b/demo/env/stm32f10x/non_os/components/easyflash/port/ef_port.c @@ -43,12 +43,22 @@ #define ENV_START_ADDR (FLASH_BASE + 100 * 1024) /* from the chip position: 100KB */ /* the minimum size of flash erasure */ #define ERASE_MIN_SIZE PAGE_SIZE /* it is one page for STM32 */ -#ifdef EF_ENV_USING_WL_MODE +#ifndef EF_ENV_USING_PFS_MODE +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal mode. */ +#define ENV_SECTION_SIZE (ERASE_MIN_SIZE) +#else /* ENV section total bytes size in wear leveling mode. */ -#define ENV_SECTION_SIZE (4 * ERASE_MIN_SIZE) /* 8K */ +#define ENV_SECTION_SIZE (4 * ERASE_MIN_SIZE) +#endif #else -/* ENV section total bytes size in normal mode. It's equal with FLASH_USER_SETTING_ENV_SIZE */ -#define ENV_SECTION_SIZE (EF_USER_SETTING_ENV_SIZE) +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (2 * ERASE_MIN_SIZE) +#else +/* ENV section total bytes size in wear leveling and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (5 * ERASE_MIN_SIZE) +#endif #endif /* print debug information of flash */ #define PRINT_DEBUG diff --git a/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c b/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c index 58915b5..12305f0 100644 --- a/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c +++ b/demo/env/stm32f10x/rtt/components/easyflash/port/ef_port.c @@ -42,12 +42,22 @@ #define ENV_START_ADDR (FLASH_BASE + 100 * 1024) /* from the chip position: 100KB */ /* the minimum size of flash erasure */ #define ERASE_MIN_SIZE PAGE_SIZE /* it is one page for STM32 */ -#ifdef EF_ENV_USING_WL_MODE +#ifndef EF_ENV_USING_PFS_MODE +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal mode. */ +#define ENV_SECTION_SIZE (ERASE_MIN_SIZE) +#else /* ENV section total bytes size in wear leveling mode. */ -#define ENV_SECTION_SIZE (4 * ERASE_MIN_SIZE) /* 8K */ +#define ENV_SECTION_SIZE (4 * ERASE_MIN_SIZE) +#endif #else -/* ENV section total bytes size in normal mode. It's equal with FLASH_USER_SETTING_ENV_SIZE */ -#define ENV_SECTION_SIZE (EF_USER_SETTING_ENV_SIZE) +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (2 * ERASE_MIN_SIZE) +#else +/* ENV section total bytes size in wear leveling and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (5 * ERASE_MIN_SIZE) +#endif #endif /* print debug information of flash */ #define PRINT_DEBUG diff --git a/demo/env/stm32f4xx/components/easyflash/port/ef_port.c b/demo/env/stm32f4xx/components/easyflash/port/ef_port.c index cb56a3a..04cfd8d 100644 --- a/demo/env/stm32f4xx/components/easyflash/port/ef_port.c +++ b/demo/env/stm32f4xx/components/easyflash/port/ef_port.c @@ -32,15 +32,25 @@ #include /* ENV start address */ -#define ENV_START_ADDR (FLASH_BASE + 256 * 1024) /* on the chip position: 256KB */ +#define ENV_START_ADDR (FLASH_BASE + 128 * 1024) /* on the chip position: 128KB */ /* the minimum size of flash erasure */ #define ERASE_MIN_SIZE (128 * 1024) /* it is 128K for compatibility */ -#ifdef EF_ENV_USING_WL_MODE +#ifndef EF_ENV_USING_PFS_MODE +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal mode. */ +#define ENV_SECTION_SIZE (ERASE_MIN_SIZE) /* 128K */ +#else /* ENV section total bytes size in wear leveling mode. */ #define ENV_SECTION_SIZE (4 * ERASE_MIN_SIZE) /* 512K */ +#endif #else -/* ENV section total bytes size in normal mode. It's equal with EF_USER_SETTING_ENV_SIZE */ -#define ENV_SECTION_SIZE (EF_USER_SETTING_ENV_SIZE) +#ifndef EF_ENV_USING_WL_MODE +/* ENV section total bytes size in normal and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (2 * ERASE_MIN_SIZE) /* 256K */ +#else +/* ENV section total bytes size in wear leveling and power fail safeguard mode. */ +#define ENV_SECTION_SIZE (5 * ERASE_MIN_SIZE) /* 640K */ +#endif #endif /* print debug information of flash */ #define PRINT_DEBUG