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

Single bin and dat files that contain sd+bl+app

Hello,

I know that you can generate a single zip that contains dat and bin files for sd+bl and dat and bin files for the app.

Is it possible to generate a single dat and bin files that contains sd+bl+app?

I will modify the bootloader to handle it.

All the best,

Ofer.

  • Hi Ofer, 

    The main reason we don't support this option to combine sd+bl+app was that usually it's not enough swap space to receive the combine image of the three when remaining the images of the current ones. So that we split the SD+BL+APP into two phase, first phase is to receive SD+BL , at this phase, the current application is removed and the second phase is to update the new APP when the new BL+SD is replaced and running. 

     
    Let's do some calculations. For example,  the ble_app_hrs and the S140 v7.2.0 require around 256kB + BL and BL settings(32kB) = 288kB.

    This is without the application's data that you may have (bond information for example).

    If you still have enough swap space to receive the image, then it's possible to do the update in one shot. But you would need to modify the bootloader to handle the combined updated and you also need to modify the nrfutil to generate the combine image.  

  • Thank you Hung,

    The activation of the bootloader and softdevice happens after reset in the bootloader. As I understand, If I update the bl+sd to a newer version the old app might not work and I couldn't update it.

  • How do I change the nrfutil?

    Plus, does it mean that I need to change the settings page?

  • Hi Ofer, 
    If you want to do what you wanted, you would need to change quite a lot of code in the bootloader. So that it would:

    1. Accept the image of SD+BL+APP. 

    2. Swap the SD and then tell the MBR to swap the BL. 

    3. After booting with new SD+BL, the bootloader should automatically detect that there is new app image and swap the application image. 

    You need to modify the nrfutil to generate special image that has SD+BL+APP. The nrfutil source code is available here.

    This is a significant task and requires deep knowledge of the bootloader and the DFU protocol. I would suggest to study and get very familiar with the code of the bootloader and the bootloader setting. 

  • Thank you Hung,

    I was able to save save to Bank1 the sl_sd.bin and then the app.bin file one after the other. I do postvalidate on both of them from my application.

    I added a new case in the bootloader for s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_SD_BL_APP;

    In that case it does sd_bl_activate() and then app_activate(). The problem is that after the bl_activate() it doesn't continue to the  app_activate().

    In the bl_activate() it says:

    // Bootloader is different than the banked version. Continue copy
    // Note that if the SD and BL was combined, then the split point between them is in s_dfu_settings.sd_size
    // On success this function won't return.
    ret_val = nrf_dfu_mbr_copy_bl((uint32_t*)src_addr, len);

    What happens to it then?

    All the best,
    Ofer.

Related