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

Mesh DFU: Abort code 0xd DFU_END_ERROR_BANK_AND_DESTINATION_OVERLAP

On our device, we're seeing a problem when trying to run a Mesh DFU to update our firmware.

We first generated a DFU package with application version Y. Then we tried sending it along to our hardware that has application version X, compiled with the "Release" configuration in Segger v4.16. However, it rejected the DFU package due to sizing. The mesh bootloader returned abort code 0x0d (DFU_END_ERROR_BANK_AND_DESTINATION_OVERLAP    /**< When copying the finished bank to its intended destination, it will have to overwrite itself. */).

Oddly enough, when we program the hardware with application version X but compiled with the "Debug" or "ReleaseWithDebugInformation" configuration, it happily accepts the DFU package.

When we looked into the mesh bootloader code, we found this is where it's throwing the abort code, in mesh/bootloader/src/dfu_mesh.c:

    if (m_transaction.p_start_addr != m_transaction.p_bank_addr &&
        section_overlap((uint32_t) m_transaction.p_start_addr, m_transaction.length,
                        (uint32_t) m_transaction.p_bank_addr, m_transaction.length))
    {
        send_end_evt(DFU_END_ERROR_BANK_AND_DESTINATION_OVERLAP);
        start_find_fwid();
        return;
    }

It seems like it's refusing to accept the package because the storage section will overlap with the resulting application section after it is transferred. Is that correct? If so, it seems like it won't ever accept an update that uses more pages in flash since the p_bank_addr is always set to p_start_addr + old_app_length. If the new length is larger than the old_app_length, then p_bank_addr < p_start_addr + m_transaction.length, which is not allowed.

Is my understanding correct? If so, how can we send over an application update that's larger than the previous application?

For reference, we are using nRF5 SDK for Mesh v3.1.0 (nrf5SDKforMeshv310src)

Parents
  • Hi Thomas, 

    We were aware of this issue from SDK v3.1 and it was updated in SDK v3.2 that we added a function called optimal_bank_address() from SDK v3.2. So instead of leaving the start address of the swap bank area to the end of the current image it will calculate and place it in the middle of the app area. 
    This would help solving the issue when the new image is larger than the original image. Please consider update the application with this optimal bank address calculation instead of using the "bank_addr" as in the original 3.1 code. 

    Actually we can have a even better solution that it should be fine to have some overlap as when we copying the image we can erase part of the new image in the swap area if it's already copied to the new location. The same way as we implemented in our nRF5 SDK. But we haven't implemented this in current mesh bootloader yet. 

Reply
  • Hi Thomas, 

    We were aware of this issue from SDK v3.1 and it was updated in SDK v3.2 that we added a function called optimal_bank_address() from SDK v3.2. So instead of leaving the start address of the swap bank area to the end of the current image it will calculate and place it in the middle of the app area. 
    This would help solving the issue when the new image is larger than the original image. Please consider update the application with this optimal bank address calculation instead of using the "bank_addr" as in the original 3.1 code. 

    Actually we can have a even better solution that it should be fine to have some overlap as when we copying the image we can erase part of the new image in the swap area if it's already copied to the new location. The same way as we implemented in our nRF5 SDK. But we haven't implemented this in current mesh bootloader yet. 

Children
No Data
Related