From 3a31e0e9b0584f601386b4c7785ccbeac1b88a94 Mon Sep 17 00:00:00 2001 From: armink Date: Mon, 23 Mar 2015 10:30:29 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91F?= =?UTF-8?q?lash=E6=93=A6=E5=86=99=E6=97=B6=E7=9A=84=E5=9D=8F=E5=9D=97?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E7=AD=96=E7=95=A5=EF=BC=8C=E9=87=87=E7=94=A8?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E4=B9=90=E8=A7=82=E7=9A=84=E7=AD=96=E7=95=A5?= =?UTF-8?q?=EF=BC=8C=E5=B0=86=E6=95=B0=E6=8D=AE=E7=A7=BB=E5=8A=A8=E5=81=8F?= =?UTF-8?q?=E7=A7=BB=E9=87=8F=E6=94=B9=E4=B8=BAFlash=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E6=93=A6=E5=86=99=E5=A4=A7=E5=B0=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- flash/inc/flash.h | 2 +- flash/src/flash_env_wl.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/flash/inc/flash.h b/flash/inc/flash.h index 9bf23b0..8552872 100644 --- a/flash/inc/flash.h +++ b/flash/inc/flash.h @@ -44,7 +44,7 @@ if (!(EXPR)) \ while (1); \ } /* EasyFlash software version number */ -#define FLASH_SW_VERSION "1.03.13" +#define FLASH_SW_VERSION "1.03.23" typedef struct _flash_env{ char *key; diff --git a/flash/src/flash_env_wl.c b/flash/src/flash_env_wl.c index 277c62d..22c7164 100644 --- a/flash/src/flash_env_wl.c +++ b/flash/src/flash_env_wl.c @@ -585,8 +585,10 @@ FlashErrCode flash_save_env(void) { case FLASH_ERASE_ERR: { FLASH_INFO("Warning: Erased environment variables fault!\n"); FLASH_INFO("Moving environment variables to next available position.\n"); - /* calculate move offset address */ - move_offset_addr = (env_detail_size / flash_erase_min_size + 1) * flash_erase_min_size; + /* Calculate move offset address. + * Current strategy is optimistic. It will offset the flash erasure minimum size. + */ + move_offset_addr = flash_erase_min_size; /* calculate and set next available data section address */ set_cur_using_data_addr(get_cur_using_data_addr() + move_offset_addr); /* calculate and set next available environment variables detail part end address */ @@ -605,8 +607,10 @@ FlashErrCode flash_save_env(void) { case FLASH_WRITE_ERR: { FLASH_INFO("Warning: Saved environment variables fault!\n"); FLASH_INFO("Moving environment variables to next available position.\n"); - /* calculate move offset address */ - move_offset_addr = (env_detail_size / flash_erase_min_size + 1) * flash_erase_min_size; + /* Calculate move offset address. + * Current strategy is optimistic. It will offset the flash erasure minimum size. + */ + move_offset_addr = flash_erase_min_size; /* calculate and set next available data section address */ set_cur_using_data_addr(get_cur_using_data_addr() + move_offset_addr); /* calculate and set next available environment variables detail part end address */