From 0e4690405391464fa6507fe80c50e12c61d153c1 Mon Sep 17 00:00:00 2001 From: armink Date: Sat, 12 Sep 2015 09:00:14 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91s?= =?UTF-8?q?tm32f10x=E5=B9=B3=E5=8F=B0Demo=E4=BD=BF=E7=94=A8=E7=9A=84EasyFl?= =?UTF-8?q?ash=E5=BA=93=E8=87=B3=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- .../rt-thread/stm32f10x/components/easyflash/inc/easyflash.h | 4 ++-- .../rt-thread/stm32f10x/components/easyflash/src/easyflash.c | 4 ++-- .../os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c | 2 +- .../rt-thread/stm32f10x/components/easyflash/src/ef_utils.c | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h index cc7f374..0daedcb 100644 --- a/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h @@ -51,7 +51,7 @@ extern "C" { #error "Please configure backup area start address (in ef_cfg.h)" #endif -#if !defined(EF_USING_ENV) +#if !defined(EF_ERASE_MIN_SIZE) #error "Please configure minimum size of flash erasure (in ef_cfg.h)" #endif @@ -67,7 +67,7 @@ if (!(EXPR)) \ while (1); \ } /* EasyFlash software version number */ -#define EF_SW_VERSION "1.07.29" +#define EF_SW_VERSION "1.09.12" typedef struct _eflash_env{ char *key; diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c index c4fdfd5..62ba994 100644 --- a/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c @@ -31,8 +31,8 @@ * This all Backup Area Flash storage index. All used flash area configure is under here. * |----------------------------| Storage Size * | Environment variables area | ENV area size @see ENV_AREA_SIZE - * | 1.system section | ENV_SYSTEM_SIZE - * | 2:data section | ENV_AREA_SIZE - ENV_SYSTEM_SIZE + * | 1.system section | ENV system section size + * | 2:data section | ENV_AREA_SIZE - ENV system section size * |----------------------------| * | Saved log area | Log area size @see LOG_AREA_SIZE * |----------------------------| diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c index 44f00c8..187df82 100644 --- a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c @@ -73,7 +73,7 @@ EfErrCode ef_log_init(void) { * Find the log store start address and end address. * It's like a ring buffer which implement by flash. * The flash log area has two state when find start address and end address. - * state 1 state 2 + * state 1 state 2 * |============| |============| * log area start--> |############| <-- start address |############| <-- end address * |############| | empty | diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c index 7a12a56..da26f63 100644 --- a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c @@ -142,11 +142,16 @@ uint32_t ef_find_sec_using_end_addr(uint32_t addr, size_t sec_size) { } /* all sector counts finish */ if (continue_ff == sec_size - start) { + /* must be word alignment */ + if (start % 4 != 0) { + start = (start / 4 + 1) * 4; + } break; } } } } + /* calculate current flash sector using end address */ if ((start == 0) && (continue_ff == sec_size)) { /* from 0 to sec_size all sector is 0xFF, so the sector is empty */ return addr;