Hello Everyone,
We are using nRF52840 IC for our products which has 1 MB of flash.
Thread Secure DFU Example provided with Nordic SDK supports only Dual Bank DFU. This limits the application size.
Our Application size is increasing and therefore Dual Bank DFU cannot accommodate new application image.
To resolve this issue, we have decided to add an external Flash which can act as Bank1 for storing DFU image.
We have successfully directed incoming DFU packets to external QSPI flash by modifying nrf_dfu_flash_erase to qspi_earse in on_data_obj_create_request() and nrf_dfu_flash_store to QSPI store in on_data_obj_write_request().
During post validation - we have read entire firmware from external flash for Hash Verification.
After that, by enabling logs, I can see bootloader settings are updated. Here, 3 parameters with DFU Banks
typedef struct
{
uint32_t image_size; /**< Size of the image in the bank. */
uint32_t image_crc; /**< CRC of the image. If set to 0, the CRC is ignored. */
uint32_t bank_code; /**< Identifier code for the bank. */
} nrf_dfu_bank_t;
For Bank0, these members remain intact and for Bank1 - they remain 0. And bank_current of nrf_dfu_settings_t structure is changed to 1. I can see flash write success logs.
But After, booting - bootloader settings are reverted back. i.e. bank_current is changed to 0 and crc of settings page is also reverted back to before dfu.
Consequently, this part of bootloader
#if NRF_BL_DFU_ALLOW_UPDATE_FROM_APP
// Postvalidate if DFU has signaled that update is ready.
if (s_dfu_settings.bank_current == NRF_DFU_CURRENT_BANK_1)
{
postvalidate();
}
#endif
is never executed.
Can someone please point it out which part of boot loader might be doing that ?
Thanks.