Allow to redefine nRF's PSTORAGE_NUM_OF_PAGES outside of the mbed-os source

By default the number of pstorage pages is set 1 and all addresses are
calculated in the pstorage module accordingly. Nordic recommends
changing this macro to whatever number is suitable for the app (see
https://devzone.nordicsemi.com/question/53066/what-will-be-the-starting-
address-of-pstorage-page-how-we-can-change-it/?answer=53085#post-id-5308
5) which is not quite elegant given that pstorage_platform.h is part of
the mbed-os repo. With this modification you can e.g. define
PSTORAGE_NUM_OF_PAGES on the command line, however note that you should
rebuild mbed-os with this setting as it affects pstorage_platform.c.
pull/3836/head
Hovik Melikyan 2017-02-24 11:24:24 +00:00
parent 371aaa53c3
commit c4a979ef72
2 changed files with 6 additions and 0 deletions

View File

@ -66,7 +66,10 @@ static __INLINE uint32_t pstorage_flash_page_end()
#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end()
#ifndef PSTORAGE_NUM_OF_PAGES
#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */
#endif
#define PSTORAGE_MIN_BLOCK_SIZE 0x0010 /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */
#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \

View File

@ -67,7 +67,10 @@ static __INLINE uint32_t pstorage_flash_page_end()
#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end()
#ifndef PSTORAGE_NUM_OF_PAGES
#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */
#endif
#define PSTORAGE_MIN_BLOCK_SIZE 0x0010 /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */
#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \