External application DFU update

We would like to try using the standard DFU process to update third party device connected to the nrf52 chip.

For proof-of-concept I want to use DFU update with experimental function NRF_DFU_SUPPORTS_EXTERNAL_APP=1


the documentation states that it is necessary to use a bank 1 for this. However, it's size is extremely small for our task.

My question is, is there a way to find out that "External application" is receiving through the DFU and then save it to an external SPI flash memory (instead of bank 1)? Do you have any examples of a similar process?

I think that this part of the code could help in this process:

  • Hi Rakhneko, 

    You understanding is correct. However we don't have an example on how to do that. 


    What you would need to do is to modify on_data_obj_write_request() so that when it detect the image type to be DFU_FW_TYPE_EXTERNAL_APPLICATION it would instead of calling nrf_dfu_flash_store() it should call your own functoin nrf_dfu_external_flash_store() with the address space that you define. 

    You may need to modify the verification function as well. After the image is received to the external flash, it has to be verified with the hash provided in the init packet.  Please have a look at the postvalidate() function. 

    I'm afraid that you would need to study the code and make the modification on your own as we don't have an example for this. 

  • This is great news!


    Could you please explain where can I get information about the type of data (dfu_fw_type_t) I get? how to check what our data exactly is DFU_FW_TYPE_EXTERNAL_APPLICATION ?

    in functions for working with memory (including on_data_obj_write_request) I could not find such information ..

    thanks in advance!

  • Hi again, 

    First you would need to generate the image .zip file with nrfutil that define the image as external application (--external-app) . Please have a look here. and here.

    the image type (DFU_FW_TYPE_EXTERNAL_APPLICATION) is assigned automatically when the bootloader decode the init packet (stored_init_cmd_decode() it will be stored to mp_init->type) 

    mp_init is available inside nrf_dfu_validation.c . You may need to add a global variable into nrf_dfu_req_handler.c that collect the value of  mp_init->type, the same way as we collect the value of m_firmware_start_addr variable by calling nrf_dfu_validation_init_cmd_execute(). 

Related