From 73725d080770831eabbc8f5161486d22224e8b9b Mon Sep 17 00:00:00 2001 From: armink Date: Fri, 10 Jul 2015 16:39:37 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91E?= =?UTF-8?q?nv=E7=9A=84Demo=EF=BC=8C=E4=BB=A5=E9=80=82=E9=85=8D=E6=96=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9A=84=E6=8E=89=E7=94=B5=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- .../non_os/components/easyflash/port/ef_port.c | 18 ++++++++++++++---- .../rtt/components/easyflash/port/ef_port.c | 18 ++++++++++++++---- .../components/easyflash/port/ef_port.c | 18 ++++++++++++++---- 3 files changed, 42 insertions(+), 12 deletions(-) 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