nrf52840 dongle reserve flash memory

Hi,

I am working on an application that needs to store data in flash memory and runs on the nrf52840 dongle. The application is running on an operating system with possibly multiple applications accessing flash memory. Therefore I need to reserve flash memory on build time to ensure that I don't corrupt other applications data and they don't corrupt mine. I reserve flash memory in the following way:

static const uint8_t backing_memory[FLASHPAGE_SIZE] __attribute__((aligned(FLASHPAGE_SIZE))) = {0};

This approach works on other hardware such as the nrf52840 development kit but not on the nrf52840 dongle. After researching for a while I found the reason for this to likely be the Open USB Bootloader of the nrf52840 dongle. Skimming through the Bootloader code I found the follow line:

ret_val = nrf_bootloader_flash_protect(0, nrf_dfu_bank0_start_addr() + s_dfu_settings.bank_0.image_size, false);


This write protects the flash memory where my backing_memory buffer is allocated and therefore I can't write to this buffer.

Based on these findings my questions is: Is there a way to reserve flash memory on build time that is not write protected without adjusting the Bootloader ?

Related