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

DFU update for App + DFU_APP_DATA_RESERVED

Hey,

I am using SDK12, S130, nRF51822;

Trying to create a DFU update for application which Also writes over a certain area in the reserve app data, in the end of the designated maximal area for the applicati, I merged my application with a .hex for DFU_APP_DATA_RESERVED.

The problem is that it (nrfutil pkg generate) seems to create a giant .zip file for the update, filling all the memory between the actual application and the DFU_APP_DATA_RESERVED (with nothing basically, but it takes space), Now I cant update the DFU because the file is too big, not to mention having dual bank, maybe merging the APP with the DFU_APP_DATA_RESERVED isn't the best way to do it.

So what is the way to update the APP and APP data in the same DFU upload?

I would appreciate any ideas, advice and help,

Thanks!

  • Hi Eran, 

    The way the bootloader is configured now is that it will always expect the preserved application data should located right before the bootloader. 

    Preserve here meaning that the data will not be changed after a DFU update. 

    In your case it's a little bit different, you want to update the "preserved application data" when  you do DFU. 

    In that case I would suggest to change your application data location to another place, right after the application flash for example. You can declare a static array that you set an attribute in flash. Similar to how we reserve the last 2 pages in the bootloader's flash as the bootloader setting and the MBR setting. 

    When you generate the application image you won't get the issue of the huge image as before. The reason for the huge image is that nrfutil thought that your application size is all the way from the application start address to the last address where you put the "preserved application data" area. 

    So what you do is to move the application data from the place near the bootloader to the place right after the application, as it's part of the application. The bootloader when doing DFU doesn't need to know about this application data space, and will just update the application+data as one single image. 

  • Hey Hung,

    In that case I would suggest to change your application data location to another place, right after the application flash for example

    I think that that means that if I want to increase application size the next update I have to move it again?

    Thanks

  • Yes, correct. Or you can change the bootloader so that you would support a 4th type of DFU update. In addition to SD, BL, APP, you support APPDATA for example and you can define a dedicated location for APPDATA. This requires modification on the DFU protocol, including the phone's side and nrfutil. 

Related