Hello,
I have an nRF52833 that receives data from another microcontroller during start-up. This is a 32-byte number, that needs to be used throughout the time the application is running. If for example the nRF crashes and performs a reset (as it's in release mode), that 32-byte number will be re-initialised to zero, as it's stored in an array (static uint8_t m_app[32]). I don't really want to have to change the other microcontrollers code, so I was thinking that when I receive this number at start-up, to store it in flash.
I was looking at the fstorage example, and it seems straightforward, where I initialise the fstorage instance, then I can write or read to flash. The end address can be obtained using the nrf5_flash_end_addr_get() function. But how can I get the start address? Keep in mind I'm using Bluetooth, as well as a bootloader to have firmware updates.
--------------------
I merged the example in my code to see what gets printed about the flash storage, and I think the nrf5_flash_end_addr_get() is getting the address where I can start writing data, so the start address and not the end address, unless I'm mixing things up. The screenshot below is what I got when merging the example in my main application. I'm not sure where the bootloader part comes into play, as to program the application I use the command line to merge the application, softdevice and settings: mergehex.exe -m APP.hex BL.hex SD.hex SETTINGS.hex -o APP+SETTINGS+BL+SD.hex
Looking more into it, I believe that the 0x7800 is where the bootloader starts and/or the end of the application memory. From the image below, my application ends at 0x38C6B. As I only am using the storage once, and only to store 32 bytes, I'm thinking just to just pick a start and end address for the size I need, within the limits. My code has no dynamic memory, so no data should get overwritten over time. If I need 32 bytes of uin8_t then I need storage for 8*32 = 0x190. Going from the top of the address space 0x78000, I could put the data in for example 0x70000 to 0x70190? Does this make sense in what I want to do, as well as the calculations?