From 5cf3540f6ec162418d60f5248fe0adf1daa154a4 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 25 Feb 2019 09:26:26 -0800 Subject: [PATCH] [efr32] unify flash config around SETTINGS_CONFIG_PAGE_NUM (#3620) --- examples/platforms/efr32/flash.c | 5 +++-- examples/platforms/efr32/openthread-core-efr32-config.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/platforms/efr32/flash.c b/examples/platforms/efr32/flash.c index abc88eb3f..83ce5a46f 100644 --- a/examples/platforms/efr32/flash.c +++ b/examples/platforms/efr32/flash.c @@ -31,6 +31,8 @@ * This file implements the OpenThread platform abstraction for the non-volatile storage. */ +#include + #include #include @@ -40,9 +42,8 @@ #include "em_msc.h" // clang-format off -#define FLASH_DATA_USED_PAGES 10 #define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE) -#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * FLASH_DATA_USED_PAGES)) +#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * SETTINGS_CONFIG_PAGE_NUM)) // clang-format on static inline uint32_t mapAddress(uint32_t aAddress) diff --git a/examples/platforms/efr32/openthread-core-efr32-config.h b/examples/platforms/efr32/openthread-core-efr32-config.h index 51f2e91cd..4cf938506 100644 --- a/examples/platforms/efr32/openthread-core-efr32-config.h +++ b/examples/platforms/efr32/openthread-core-efr32-config.h @@ -32,6 +32,8 @@ * for OpenThread. */ +#include "em_msc.h" + #ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_ #define OPENTHREAD_CORE_EFR32_CONFIG_H_ @@ -90,7 +92,7 @@ * The page size of settings. * */ -#define SETTINGS_CONFIG_PAGE_SIZE 0x800 +#define SETTINGS_CONFIG_PAGE_SIZE FLASH_PAGE_SIZE /** * @def SETTINGS_CONFIG_PAGE_NUM