Skip to content

Commit c4a979e

Browse files
committed
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.
1 parent 371aaa5 commit c4a979e

File tree

2 files changed

+6
-0
lines changed
  • features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/pstorage/config
  • targets/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/pstorage/config

2 files changed

+6
-0
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/pstorage/config/pstorage_platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ static __INLINE uint32_t pstorage_flash_page_end()
6666

6767
#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end()
6868

69+
#ifndef PSTORAGE_NUM_OF_PAGES
6970
#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */
71+
#endif
72+
7073
#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. */
7174

7275
#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \

targets/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/pstorage/config/pstorage_platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ static __INLINE uint32_t pstorage_flash_page_end()
6767

6868
#define PSTORAGE_FLASH_PAGE_END pstorage_flash_page_end()
6969

70+
#ifndef PSTORAGE_NUM_OF_PAGES
7071
#define PSTORAGE_NUM_OF_PAGES 1 /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */
72+
#endif
73+
7174
#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. */
7275

7376
#define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \

0 commit comments

Comments
 (0)