problem to adding AES encription to secure DFU SDK15.0

Hi!

nRF52832, SDK15, SD6.0.0, S132

I try to use secure_bootloader from SDK15 examples. All works.

Now I need encrypt my firmware with AES. I already made it on a SDK13- works fine. 

Now after encrypt .bin file in the dfu.zip package, I try to decrypt it in the bootloader project. For that I in a file 

nrf_dfu_req_handler.c in a on_data_obj_write_request() function insert my decode function:

static void on_data_obj_write_request(nrf_dfu_request_t * p_req, nrf_dfu_response_t * p_res)
{
    NRF_LOG_DEBUG("Handle NRF_DFU_OP_OBJECT_WRITE (data)");

    if (!nrf_dfu_validation_init_cmd_present())
    {
        /* Can't accept data because DFU isn't initialized by init command. */
        p_res->result = NRF_DFU_RES_CODE_OPERATION_NOT_PERMITTED;
        return;
    }

    uint32_t const data_object_offset = s_dfu_settings.progress.firmware_image_offset -
                                        s_dfu_settings.progress.firmware_image_offset_last;

    if ((p_req->write.len + data_object_offset) > s_dfu_settings.progress.data_object_size)
    {
        /* Can't accept data because too much data has been received. */
        NRF_LOG_ERROR("Write request too long");
        p_res->result = NRF_DFU_RES_CODE_INVALID_PARAMETER;
        return;
    }

    uint32_t const write_addr = m_firmware_start_addr + s_dfu_settings.write_offset;

    ASSERT(p_req->callback.write);
    
                // az
                for (int i = 0; i < p_req->write.len; i+=16)
                {
                    AES128_ECB_decrypt (p_req->write.p_data + i, key, p_req->write.p_data + i); 
                }
                
    ret_code_t ret =
        nrf_dfu_flash_store(write_addr, p_req->write.p_data, p_req->write.len, p_req->callback.write);

    if (ret != NRF_SUCCESS)
    {
        /* When nrf_dfu_flash_store() fails because there is no space in the queue,
         * stop processing the request so that the peer can detect a CRC error
         * and retransmit this object. Remember to manually free the buffer !
         */
        p_req->callback.write((void*)p_req->write.p_data);
        return;
    }

    /* Update the CRC of the firmware image. */
    s_dfu_settings.write_offset                   += p_req->write.len;
    s_dfu_settings.progress.firmware_image_offset += p_req->write.len;
    s_dfu_settings.progress.firmware_image_crc     =
        crc32_compute(p_req->write.p_data, p_req->write.len, &s_dfu_settings.progress.firmware_image_crc);

    /* This is only used when the PRN is triggered and the 'write' message
     * is answered with a CRC message and these field are copied into the response.
     */
    p_res->write.crc    = s_dfu_settings.progress.firmware_image_crc;
    p_res->write.offset = s_dfu_settings.progress.firmware_image_offset;
}

AES128_ECB_decrypt().....

One more- this function works fine with same syntax on the SDK13.

But in the SDK13 after that I write another CRC and it works.

Now on SDK15 when I try to update via smartphone, I see error on the smartphone - ERROC CRC.

Also I have RTT log of it:

 0> <debug> nrf_dfu_req_handler:  
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
 0> <debug> nrf_dfu_req_handler: Offset:2928, CRC:0xA907DD27
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> app: Shutting down transports (found: 1)
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (data)
 0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x00039000, len=1 pages), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Creating object with size: 4096. Offset: 0x00000000, CRC: 0x00000000
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_flash: Flash erase success: addr=0x00039000, pending 0
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039000, src=0x20005EB8, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039000, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
 0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000390F4, src=0x20005EB8, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000390F4, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000391E8, src=0x20005FAC, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000391E8, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000392DC, src=0x20006194, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
 0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000393D0, src=0x20005EB8, len=244 bytes), queue usage: 1
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000392DC, pending 1
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
 0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000393D0, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
 0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000394C4, src=0x20005FAC, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000394C4, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
 0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000395B8, src=0x20006288, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000395B8, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000396AC, src=0x20006194, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000397A0, src=0x20005EB8, len=244 bytes), queue usage: 1
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000396AC, pending 1
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x000397A0, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
 0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039894, src=0x20005FAC, len=244 bytes), queue usage: 0
 0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
 0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
 0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039894, pending 0
 0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
 0> x200060A0, len=244 bytes), queue usage: 0
 0> a)
 0> <debug> nrf_dfu_ble: Advertising...
 0> <info> nrf_bootloader_wdt: Internal feed

In wich place of bootloader should I clear or replace CRC ? I just want to reject this verification from bootloader.  

  • I tryed topic

    https://devzone.nordicsemi.com/f/nordic-q-a/37260/adding-encryption-to-secure-dfu-sdk-v15

    and without any success. But I use my AES encryption manualy. And crypt in the DFU only .bin file from this package.

    Any help?

  • You get invalid CRC because you are calculating the CRC on the decrypted data while the phone compares the CRC agains its encrypted image. If you want to skip CRC validation you need to do it in the phone app, not in the bootloader. 

  • Hi!

    I tryed it before:

    and result is:

    on the smartphone- 1,2,3 %... 1,2,3 %... CRC INCORRECT.

    On the RTT debug is:

    uint32_t crc32_compute_encrypted = crc32_compute.log
    # SEGGER J-Link RTT Viewer V5.12f Terminal Log File
    # Compiled: 16:04:47 on May 17 2016
    # Logging started @ 18 Dec 2018 12:50:12
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <debug> nrf_dfu_ble: Connected
     0> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
     0> <debug> nrf_dfu_ble: max_conn_interval: 12
     0> <debug> nrf_dfu_ble: min_conn_interval: 12
     0> <debug> nrf_dfu_ble: slave_latency: 0
     0> <debug> nrf_dfu_ble: conn_sup_timeout: 600
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <debug> nrf_dfu_ble: Received BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST (request: 517, reply: 247).
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_SELECT (command)
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_ble: Set receipt notif
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> app: Shutting down transports (found: 1)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (command)
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 135 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
     0> <debug> nrf_dfu_validation:  az nrf_dfu_validation_init_cmd_append CRC = 0x83B93D52
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (command)
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
     0> <debug> nrf_dfu_validation: PB: Init packet data len: 58
     0> <info> nrf_dfu_validation: Signature required. Checking signature.
     0> <info> nrf_dfu_validation: Calculating init packet hash (init packet len: 58)
     0> <info> nrf_dfu_validation: Verify signature
     0> <info> nrf_dfu_validation: Image verified
     0> <debug> app: Enter nrf_dfu_cache_prepare()
     0> <debug> app: required_size: 0x127A0.
     0> <debug> app: single_bank: false.
     0> <debug> app: keep_app: false.
     0> <debug> app: keep_softdevice: true.
     0> <debug> app: SD_PRESENT: true.
     0> <debug> app: Bank contents:
     0> <debug> app: Bank 0 code: 0x01: Size: 0x127A0
     0> <debug> app: Bank 1 code: 0x00: Size: 0x0
     0> <debug> app: pass: 0.
     0> <debug> app: cache_address: 0x39000.
     0> <debug> app: cache_too_small: false.
     0> <debug> app: keep_firmware: false.
     0> <debug> app: delete_more: false.
     0> <debug> nrf_dfu_validation: Write address set to 0x00039000
     0> <debug> nrf_dfu_settings: Writing settings...
     0> <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
     0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x20006EEC, len=440 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler: Writing valid init command to flash.
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_ble: Set receipt notif
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_SELECT (data)
     0> <debug> nrf_dfu_req_handler: crc = 0x0, offset = 0x0, max_size = 0x1000
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pending 1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
     0> <debug> app: Shutting down transports (found: 1)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x00039000, len=1 pages), queue usage: 0
     0> <debug> nrf_dfu_req_handler: Creating object with size: 4096. Offset: 0x00000000, CRC: 0x00000000
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039000, src=0x20005EB8, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xA5BE0D95
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash erase success: addr=0x00039000, pending 1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039000, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000390F4, src=0x20005FAC, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xE5314F14
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000390F4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
     0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000391E8, src=0x20005FAC, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x9ECA00EB
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000391E8, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
     0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000392DC, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x9762C394
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000392DC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000393D0, src=0x20005FAC, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x44ED2D93
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000394C4, src=0x200060A0, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x4728C0BC
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000393D0, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
     0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000394C4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000395B8, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xA23B0BC0
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000395B8, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000396AC, src=0x20006194, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x7DC4EF60
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000396AC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000397A0, src=0x20005FAC, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x2DDE539B
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039894, src=0x200060A0, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x3EEBA32C
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000397A0, pending 1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039894, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039988, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x480D7EB2
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039A7C, src=0x20006288, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xB69DF0F4
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039988, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039A7C, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
     0> <debug> nrf_dfu_req_handler: Offset:2928, CRC:0xB69DF0F4
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> app: Shutting down transports (found: 1)
     0> ta)
     0> =1 pages), queue usage: 0
     0> 0x1
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039000, src=0x20006288, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xA5BE0D95
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash erase success: addr=0x00039000, pending 1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039000, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000390F4, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x65491F3A
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000390F4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000391E8, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xB42E4DC3
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000391E8, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000392DC, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x9C65D3A5
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000392DC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000393D0, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xA314E743
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_ble: Buffer 0x20005FAC acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000394C4, src=0x200060A0, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x6F63CA50
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000393D0, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000394C4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000395B8, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xC2C9B9F7
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000395B8, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000396AC, src=0x20005FAC, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xD549DA26
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000396AC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005FAC
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000397A0, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xEFB76CD5
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039894, src=0x200060A0, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x034017AB
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000397A0, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039894, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039988, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x09046457
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039A7C, src=0x20006194, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x0ACA8202
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039988, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039A7C, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <debug> app: Shutting down transports (found: 1)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x00039000, len=1 pages), queue usage: 0
     0> <debug> nrf_dfu_req_handler: Creating object with size: 4096. Offset: 0x00000000, CRC: 0x00000000
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039000, src=0x20006194, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xA5BE0D95
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash erase success: addr=0x00039000, pending 1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039000, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000390F4, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xE5314F14
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000390F4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000391E8, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x9ECA00EB
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000391E8, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000392DC, src=0x20006194, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x9762C394
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000392DC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000393D0, src=0x20006194, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x008DCE2F
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000393D0, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000394C4, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xB331DA08
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_ble: Buffer 0x20005EB8 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000394C4, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000395B8, src=0x200060A0, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xBFE56552
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006288 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000396AC, src=0x20006194, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xB2AD5C46
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000395B8, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_ble: Buffer 0x200060A0 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000396AC, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000397A0, src=0x20005EB8, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x49E2022D
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_ble: Buffer 0x20006194 acquired, len 244 (244)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x000397A0, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20005EB8
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039894, src=0x20006288, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0xE4B9E193
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039988, src=0x200060A0, len=244 bytes), queue usage: 1
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x24FBAE4E
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039894, pending 1
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006288
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039988, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x200060A0
     0> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x00039A7C, src=0x20006194, len=244 bytes), queue usage: 0
     0> <debug> nrf_dfu_req_handler:  az on_data_obj_write_request CRC = 0x2C8EE692
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
     0> <debug> nrf_dfu_req_handler: Offset:2928, CRC:0x2C8EE692
     0> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
     0> <debug> nrf_dfu_flash: Flash write success: addr=0x00039A7C, pending 0
     0> <debug> nrf_dfu_ble: Freeing buffer 0x20006194
     0> <debug> nrf_dfu_ble: Advertising...
     0> <info> nrf_bootloader_wdt: Internal feed
     0> <info> nrf_bootloader_wdt: Internal feed
    

    Therefore, youre suggest doesn't works.

    May be do you have one more idea?