From a16ea0a1bead2a4d3b69ba9cf9534402d53615dc Mon Sep 17 00:00:00 2001 From: armink Date: Tue, 25 Oct 2016 23:01:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91?= =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3=E5=8F=8A?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=85=8D=E7=BD=AE=E6=B3=A8=E9=87=8A=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=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/inc/ef_cfg.h | 11 +++++------ .../components/easyflash/inc/ef_cfg.h | 11 +++++------ .../stm32f10x/rtt/components/easyflash/inc/ef_cfg.h | 11 +++++------ .../env/stm32f4xx/components/easyflash/inc/ef_cfg.h | 11 +++++------ docs/zh/port.md | 13 +++++++------ 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/demo/env/stm32f10x/non_os/components/easyflash/inc/ef_cfg.h b/demo/env/stm32f10x/non_os/components/easyflash/inc/ef_cfg.h index 433e2df..377bfd3 100644 --- a/demo/env/stm32f10x/non_os/components/easyflash/inc/ef_cfg.h +++ b/demo/env/stm32f10x/non_os/components/easyflash/inc/ef_cfg.h @@ -75,14 +75,13 @@ * 1.Normal mode: no more limitations * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode. - * 4.wear leveling and power fail safeguard mode: The system section will used an flash section. - * The data section is twice as wear leveling mode data section size. + * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode. * For example: * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define * 1.Normal mode: 1*EF_ERASE_MIN_SIZE - * 2.Wear leveling mode: 2*EF_ERASE_MIN_SIZE (It has 2 flash section to store ENV. So ENV can erase at least 200,000 times) + * 2.Wear leveling mode: 3*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times) * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE - * 4.Wear leveling and power fail safeguard mode: 5*EF_ERASE_MIN_SIZE + * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE */ /* backup area start address */ @@ -95,7 +94,7 @@ #define ENV_AREA_SIZE (1 * EF_ERASE_MIN_SIZE) /* 2K */ #else /* ENV area total bytes size in wear leveling mode. */ - #define ENV_AREA_SIZE (4 * EF_ERASE_MIN_SIZE) /* 8K */ + #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 6K */ #endif #else #ifndef EF_ENV_USING_WL_MODE @@ -103,7 +102,7 @@ #define ENV_AREA_SIZE (2 * EF_ERASE_MIN_SIZE) /* 4K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ - #define ENV_AREA_SIZE (5 * EF_ERASE_MIN_SIZE) /* 10K */ + #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 12K */ #endif #endif /* saved log area size */ diff --git a/demo/env/stm32f10x/non_os_spi_flash/components/easyflash/inc/ef_cfg.h b/demo/env/stm32f10x/non_os_spi_flash/components/easyflash/inc/ef_cfg.h index f6a7f82..7abffcf 100644 --- a/demo/env/stm32f10x/non_os_spi_flash/components/easyflash/inc/ef_cfg.h +++ b/demo/env/stm32f10x/non_os_spi_flash/components/easyflash/inc/ef_cfg.h @@ -66,14 +66,13 @@ * 1.Normal mode: no more limitations * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode. - * 4.wear leveling and power fail safeguard mode: The system section will used an flash section. - * The data section is twice as wear leveling mode data section size. + * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode. * For example: * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define * 1.Normal mode: 1*EF_ERASE_MIN_SIZE - * 2.Wear leveling mode: 2*EF_ERASE_MIN_SIZE (It has 2 flash section to store ENV. So ENV can erase at least 200,000 times) + * 2.Wear leveling mode: 3*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times) * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE - * 4.Wear leveling and power fail safeguard mode: 5*EF_ERASE_MIN_SIZE + * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE */ /* backup area start address */ @@ -86,7 +85,7 @@ #define ENV_AREA_SIZE (1 * EF_ERASE_MIN_SIZE) /* 4K */ #else /* ENV area total bytes size in wear leveling mode. */ - #define ENV_AREA_SIZE (4 * EF_ERASE_MIN_SIZE) /* 16K */ + #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 16K */ #endif #else #ifndef EF_ENV_USING_WL_MODE @@ -94,7 +93,7 @@ #define ENV_AREA_SIZE (2 * EF_ERASE_MIN_SIZE) /* 8K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ - #define ENV_AREA_SIZE (5 * EF_ERASE_MIN_SIZE) /* 20K */ + #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 20K */ #endif #endif /* saved log area size */ diff --git a/demo/env/stm32f10x/rtt/components/easyflash/inc/ef_cfg.h b/demo/env/stm32f10x/rtt/components/easyflash/inc/ef_cfg.h index 433e2df..8f06506 100644 --- a/demo/env/stm32f10x/rtt/components/easyflash/inc/ef_cfg.h +++ b/demo/env/stm32f10x/rtt/components/easyflash/inc/ef_cfg.h @@ -75,14 +75,13 @@ * 1.Normal mode: no more limitations * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode. - * 4.wear leveling and power fail safeguard mode: The system section will used an flash section. - * The data section is twice as wear leveling mode data section size. + * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode. * For example: * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define * 1.Normal mode: 1*EF_ERASE_MIN_SIZE - * 2.Wear leveling mode: 2*EF_ERASE_MIN_SIZE (It has 2 flash section to store ENV. So ENV can erase at least 200,000 times) + * 2.Wear leveling mode: 6*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times) * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE - * 4.Wear leveling and power fail safeguard mode: 5*EF_ERASE_MIN_SIZE + * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE */ /* backup area start address */ @@ -95,7 +94,7 @@ #define ENV_AREA_SIZE (1 * EF_ERASE_MIN_SIZE) /* 2K */ #else /* ENV area total bytes size in wear leveling mode. */ - #define ENV_AREA_SIZE (4 * EF_ERASE_MIN_SIZE) /* 8K */ + #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 6K */ #endif #else #ifndef EF_ENV_USING_WL_MODE @@ -103,7 +102,7 @@ #define ENV_AREA_SIZE (2 * EF_ERASE_MIN_SIZE) /* 4K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ - #define ENV_AREA_SIZE (5 * EF_ERASE_MIN_SIZE) /* 10K */ + #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 12K */ #endif #endif /* saved log area size */ diff --git a/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h b/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h index 7b309d5..dfba175 100644 --- a/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h +++ b/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h @@ -68,14 +68,13 @@ * 1.Normal mode: no more limitations * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode. - * 4.wear leveling and power fail safeguard mode: The system section will used an flash section. - * The data section is twice as wear leveling mode data section size. + * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode. * For example: * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define * 1.Normal mode: 1*EF_ERASE_MIN_SIZE - * 2.Wear leveling mode: 2*EF_ERASE_MIN_SIZE (It has 2 flash section to store ENV. So ENV can erase at least 200,000 times) + * 2.Wear leveling mode: 3*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times) * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE - * 4.Wear leveling and power fail safeguard mode: 5*EF_ERASE_MIN_SIZE + * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE */ /* backup area start address */ @@ -88,7 +87,7 @@ #define ENV_AREA_SIZE (1 * EF_ERASE_MIN_SIZE) /* 128K */ #else /* ENV area total bytes size in wear leveling mode. */ - #define ENV_AREA_SIZE (4 * EF_ERASE_MIN_SIZE) /* 512K */ + #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 384K */ #endif #else #ifndef EF_ENV_USING_WL_MODE @@ -96,7 +95,7 @@ #define ENV_AREA_SIZE (2 * EF_ERASE_MIN_SIZE) /* 256K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ - #define ENV_AREA_SIZE (5 * EF_ERASE_MIN_SIZE) /* 640K */ + #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 768K */ #endif #endif /* saved log area size */ diff --git a/docs/zh/port.md b/docs/zh/port.md index 8cb1642..2edb3e1 100644 --- a/docs/zh/port.md +++ b/docs/zh/port.md @@ -25,9 +25,10 @@ |\easyflash\src\ef_utils.c |EasyFlash常用小工具,例如:CRC32| |\easyflash\src\easyflash.c |目前只包含EasyFlash初始化方法| |\easyflash\port\ef_port.c |不同平台下的EasyFlash移植接口| -|\demo\env\stm32f10x\non_os |stm32f10x裸机的Env demo| -|\demo\env\stm32f10x\rtt |stm32f10x基于[RT-Thread](http://www.rt-thread.org/)的Env demo| -|\demo\env\stm32f4xx |stm32f4xx基于[RT-Thread](http://www.rt-thread.org/)的Env demo| +|\demo\env\stm32f10x\non_os |stm32f10x裸机片内Flash的Env demo| +|\demo\env\stm32f10x\non_os_spi_flash |stm32f10x裸机SPI Flash的Env demo| +|\demo\env\stm32f10x\rtt |stm32f10x基于[RT-Thread](http://www.rt-thread.org/)的片内Flash Env demo| +|\demo\env\stm32f4xx |stm32f4xx基于[RT-Thread](http://www.rt-thread.org/)的片内Flash Env demo| |\demo\iap\ymodem+rtt.c |使用[RT-Thread](http://www.rt-thread.org/)+[Ymodem](https://github.com/RT-Thread/rt-thread/tree/master/components/utilities/ymodem)的IAP Demo| |\demo\log\easylogger.c |基于[EasyLogger](https://github.com/armink/EasyLogger)的Log Demo| @@ -204,12 +205,12 @@ void ef_print(const char *format, ...) - 1、常规模式:没有差异; - 2、擦写平衡模式:系统区将会占用1个`EF_ERASE_MIN_SIZE`大小,数据区至少等使用2个以上Flash扇区; - 3、掉电保护模式:环境变量区将会被备份,所以总容量是常规模式的2倍; - - 4、擦写平衡+掉电保护模式:系统区将会占用1个`EF_ERASE_MIN_SIZE`大小,数据区将会是擦写平衡模式下的数据区总容量的2倍。 + - 4、擦写平衡+掉电保护模式:所需容量将会是擦写平衡模式下总容量的2倍。 - 例如:`EF_ERASE_MIN_SIZE`是128K,`ENV_USER_SETTING_SIZE`是2K,那么你可以这样定义不同模式下的环境变量总容量: - 1、常规模式:`1*EF_ERASE_MIN_SIZE`; - - 2、擦写平衡模式:`3*EF_ERASE_MIN_SIZE`(它将会有3个Flash扇区去存储环境变量,按照每个Flash扇区可被擦写10W次计算,那么当前配置至少可擦写30W次); + - 2、擦写平衡模式:`3*EF_ERASE_MIN_SIZE`(它将会有3个Flash扇区去存储环境变量,1个系统区,2个数据区,按照每个Flash扇区可被擦写10W次计算,那么当前配置至少可擦写20W次); - 3、掉电保护模式:`2*EF_ERASE_MIN_SIZE`; - - 4、擦写平衡+掉电保护模式:`5*EF_ERASE_MIN_SIZE`; + - 4、擦写平衡+掉电保护模式:`6*EF_ERASE_MIN_SIZE`; #### 5.5.1 备份区起始地址