How do I share variable data from my nRF52 application to the bootloader code?
Check the update to this question after first comment by @HungBui
There is some short-data which needs to be shared from the application scope to bootloader across a reset. This data is variable (changes across each reset).
These are my constraints:
- Using
SoftDevice 5.1
withSDK 14.2
- The data is variable across resets so UICR is not suitable for this purpose.
- (would require ERASEUICR)
- The nRF52 application already uses FDS for persistent storage.
- I could have used this persistent storage to share data with bootloader code but I can't get FDS to work in bootloader scope (nrf_dfu_flash already has a fstorage instance that conflicts with my FDS attempt there).
I guess, the requirement is to be able to reserve a flash page at a well-known-memory-address to which the application can write safely and the bootloader code can simply read it off with C pointers.
Updated question after Hung Bui's comment:
I am trying to use fstorage while FDS is initialized (and therefore nrf_fstorage_sd is being used).
Infocenter fstorage notes suggest that I can use two instances of fstorage initialized on different pages as long as I don't do multi-threaded accesses.
While, this seems feasible in theory, when I try to code a second fstorage instance besides m_fs
of FDS, its init (nrf_fstorage_sd.c:init()
) does not seem to work. There are a bunch of other globals (like m_flags
, m_flash_info
, m_fifo
) that don't seem to work correctly with this approach.
The init
for example, fails to setup p_flash_info
in my nrf_fstorage_t
instance.
Am I missing something here?