From 038ede386adb26d3ea8f0e57fc242ac634cef868 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Thu, 22 Mar 2018 16:45:01 +0800 Subject: [PATCH] Fix page size in flash IAP In Mbed OS, page size is program unit, which is different than FMC definition. After fixing page size, we can pass NVSTORE test (mbed-os-features-nvstore-tests-nvstore-functionality). --- targets/TARGET_NUVOTON/TARGET_M451/flash_api.c | 3 ++- targets/TARGET_NUVOTON/TARGET_M480/flash_api.c | 3 ++- targets/TARGET_NUVOTON/TARGET_NUC472/flash_api.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M451/flash_api.c b/targets/TARGET_NUVOTON/TARGET_M451/flash_api.c index 01e19a20fd..96baa166c7 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/flash_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/flash_api.c @@ -65,7 +65,8 @@ static const sector_info_t sectors_info[] = { }; static const flash_target_config_t flash_target_config = { - .page_size = 0x800, // 2 KB + .page_size = 4, // 4 bytes + // Here page_size is program unit, which is different than FMC definition. .flash_start = 0x0, .flash_size = 0x40000, // 256 KB .sectors = sectors_info, diff --git a/targets/TARGET_NUVOTON/TARGET_M480/flash_api.c b/targets/TARGET_NUVOTON/TARGET_M480/flash_api.c index a5913d4a52..cc2eeffb08 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/flash_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/flash_api.c @@ -69,7 +69,8 @@ static const sector_info_t sectors_info[] = { }; static const flash_target_config_t flash_target_config = { - .page_size = 0x200, // 512 bytes + .page_size = 4, // 4 bytes + // Here page_size is program unit, which is different than FMC definition. .flash_start = 0x0, .flash_size = 0x80000, // 512 KB .sectors = sectors_info, diff --git a/targets/TARGET_NUVOTON/TARGET_NUC472/flash_api.c b/targets/TARGET_NUVOTON/TARGET_NUC472/flash_api.c index 0d3a74ffbb..8da24b1b29 100644 --- a/targets/TARGET_NUVOTON/TARGET_NUC472/flash_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/flash_api.c @@ -67,7 +67,8 @@ static const sector_info_t sectors_info[] = { }; static const flash_target_config_t flash_target_config = { - .page_size = 0x800, // 2 KB + .page_size = 4, // 4 bytes + // Here page_size is program unit, which is different than FMC definition. .flash_start = 0x0, .flash_size = 0x80000, // 512 KB .sectors = sectors_info,