From c31ab99080bda38a0e3574d6b9251da59a1ad3ac Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Mon, 4 Feb 2019 16:12:24 +0200 Subject: [PATCH] [samr21] Define SETTINGS_CONFIG_PAGE_NAME with const (#3491) Currently SETTINGS_CONFIG_PAGE_NAME is defined indirectly by addresses of __d_nv_mem_start and __d_nv_mem_end. But such definition doesn't allow to perform compile time sanity check. Define this macro with const value 16. Signed-off-by: Oleksandr Grytsov --- .../platforms/samr21/openthread-core-samr21-config.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/platforms/samr21/openthread-core-samr21-config.h b/examples/platforms/samr21/openthread-core-samr21-config.h index d8eacda9e..625914930 100644 --- a/examples/platforms/samr21/openthread-core-samr21-config.h +++ b/examples/platforms/samr21/openthread-core-samr21-config.h @@ -69,8 +69,15 @@ extern uint32_t __d_nv_mem_end; * * The page number of settings. * + * This value should not exceeds: + * (((uint32_t)&__d_nv_mem_end - (uint32_t)&__d_nv_mem_start) / SETTINGS_CONFIG_PAGE_SIZE) + * + * __d_nv_mem_start and __d_nv_mem_end is defined in linker script. + * The size of NVRAM region is 4k. Page size is 256 bytes. Maximum SETTINGS_CONFIG_PAGE_NUM + * should be equal or less than 16. + * */ -#define SETTINGS_CONFIG_PAGE_NUM (((uint32_t)&__d_nv_mem_end - (uint32_t)&__d_nv_mem_start) / SETTINGS_CONFIG_PAGE_SIZE) +#define SETTINGS_CONFIG_PAGE_NUM 16 /** * @def RADIO_CONFIG_SRC_MATCH_ENTRY_NUM