This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK 15.3.0: non-fatal protection error during nrf_bootloader_app_start_final()

I'm implemented DFU (with custom transport, but the problem is not there). Even when flashing SD+bootloader+app+settings I can see an error in the logs:

```

14:23:48.096384 <error> app: Could not protect SoftDevice and application, 0x7.

```

I'm using a single-bank scheme (since my app is too big for nrf52810).

In fact the code is the following:

ret_code_t nrf_bootloader_flash_protect(uint32_t address, uint32_t size, bool read_protect)
{
    if ((size & (CODE_PAGE_SIZE - 1)) || (address > BOOTLOADER_SETTINGS_ADDRESS))
    {
        NRF_LOG_ERROR("size: %x/%x, address: %x vs. %x", size, size & (CODE_PAGE_SIZE -1), address, BOOTLOADER_SETTINGS_ADDRESS); // added by me
        return NRF_ERROR_INVALID_PARAM;
    }

    […]

}

void nrf_bootloader_app_start_final(uint32_t vector_table_addr)

{

    […]

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

}

And my application does not stop at a page boundary.

It looks that this behavior has been added in SDK 15 (I used to use SDK 12 and did not experience such error log).

So:

- either the settings should be generated w/ size in the page boundary (also for DFU init "packet")

- the check should be reviewed

- something else that I missed ?

Thanks.

Marc.

  • HI Marto, 

    I sincerely apologize for the very late reply. 

    I agree that the check should be revised as the  s_dfu_settings.bank_0.image_size, which comes from the init packet, is very rarely a multiple of the page size. I think this can be easily fixed by doing the following:

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

    Best regards

    Bjørn

Related