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

How to generate init file(*Dat) for secure DFU OTA update?

Hi;

I am trying to secure DFU OTA. For that, i am using SDK12.2.0 and done with example file.

Now how to generate this .dat file itself.

Also explain each parameter of init file and how to set it.

  • Hi Nilesh,

    you can generate firmware images for the Secure Bootloader using our nrfutil tool, which is available here on GitHub.

    Install instructions and examples on how to generate the firmware images are given in the READM.md file.

    Best regards

    Bjørn

  • Thank you for the reply.

    I am tried to generate same package using dfu_test_app_hrm_s130.hex located into nRF5_SDK_12.2.0_f012efa\examples\dfu\ble_dfu_send_hex\test_images_update_nrf51.

    These are the setup which i am followed: 1: First generate the .pem file using "nrfutil keys generate private.pem" 2: Export into dfu_public_key.c using "nrfutil keys display --key pk --format code private.pem --out_file public_key" command. 3: Generate zip file "nrfutil pkg generate --hw-version 51 --sd-req 0x87 --application-version 1 --application dfu_test_app_hrm_s130.hex --key-file key.private app_dfu_package.zip"

    But it's not working. Then, compare information of the both packages using "nrfutil pkg display package.zip" command attached herewith.

    C:\Python27\Scripts>nrfutil pkg display dfu_test_app_hrm_s130.zip
    
    DFU Package: <dfu_test_app_hrm_s130.zip>: | |- Image count: 1 | |- Image #0: |- Type: application |- Image file: nrf51422_xxac.bin |- Init packet file: nrf51422_xxac.dat | |- op_code: INIT |- signature_type: ECDSA_P256_SHA256 |- signature: 5dc00acac037cc2ee6bf997d5112ddd6827ed7ffaca278d7e5cb402a82ba 0124bf69ea1b9da6c5b3aa8b571d7eb5c4855a664b4408840115fc84f69c168c17c9 | |- fw_version: 0x00000001 (1) |- hw_version 0x00000033 (51) |- sd_req: 0xCAFE, 0x87 |- type: APPLICATION |- sd_size: 0 |- bl_size: 0 |- app_size: 30176 | |- hash_type: SHA256 |- hash: b4767e557c167df5a78f2e1e380b5181879094b1e6819965eb7499e079a8269e | |- is_debug: True
    
    C:\Python27\Scripts>nrfutil pkg display app_dfu_package.zip
    
    DFU Package: <app_dfu_package.zip>: | |- Image count: 1 | |- Image #0: |- Type: application |- Image file: dfu_test_app_hrm_s130.bin |- Init packet file: dfu_test_app_hrm_s130.dat | |- op_code: INIT |- signature_type: ECDSA_P256_SHA256 |- signature: aa00bab4f4ce5dca5d95e2837967a5cffacb521432ab2aaf0887b39ad76e c0ca49c9fdab7effb0a6f7a91403f974889734ba84626b00a474eef1fec969ffd644 | |- fw_version: 0x00000001 (1) |- hw_version 0x00000033 (51) |- sd_req: 0x87 |- type: APPLICATION |- sd_size: 0 |- bl_size: 0 |- app_size: 30176 | |- hash_type: SHA256 |- hash: b4767e557c167df5a78f2e1e380b5181879094b1e6819965eb7499e079a8269e | |- is_debug: False
    

    Please suggest me how can i solve it.

  • Can you elaborate when you say it does not work? Do you get an error message from the app your using to perform DFU? Did you replace the Debug Public key in the bootloader source code with the one you generated from the private key?

  • First i am maintain dfu_public_key.c file in same folder and update it using update command which mentioned in earliest reply.

    I am not getting any error but when i am trying to update it using my mobile app, first showing connecting dfu message then intializating DFu then not strart updating process but directly display disconnecting message.

    So, just disconnecting after the connecting without any error message.

  • Are you using the nRF Connect or the nRF Toolbox app? Which type of phone is it, android or iOS?

Related