From 00458fdd3f890b862d48faa7890ba8b366683cde Mon Sep 17 00:00:00 2001 From: armink Date: Fri, 18 Sep 2015 18:31:55 +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 --- .../stm32f10x/components/easyflash/inc/easyflash.h | 2 +- .../rt-thread/stm32f10x/components/easyflash/src/ef_log.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 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 0daedcb..dff426f 100644 --- a/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h @@ -67,7 +67,7 @@ if (!(EXPR)) \ while (1); \ } /* EasyFlash software version number */ -#define EF_SW_VERSION "1.09.12" +#define EF_SW_VERSION "1.09.16" typedef struct _eflash_env{ char *key; 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 187df82..088af3f 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 @@ -173,7 +173,12 @@ static void find_start_and_end_addr(void) { log_start_addr = log_area_start_addr; cur_using_sec_addr = log_area_start_addr + cur_size; } else { - /* state 1 or 2*/ + /* like state 2 when the sector is the last one */ + if (cur_size + EF_ERASE_MIN_SIZE >= LOG_AREA_SIZE) { + cur_log_sec_state = 2; + log_start_addr = log_area_start_addr + cur_size; + cur_using_sec_addr = log_area_start_addr + cur_size - EF_ERASE_MIN_SIZE; + } } break; case FLASH_SECTOR_FULL: