Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_dfu_flash_callback_t changed in SDK 15

Hello,

 with SDK15 the definition of the nrf_dfu_flash_callback_t changed from

typedef nrf_fstorage_evt_handler_t dfu_flash_callback_t;

typedef void (*nrf_fstorage_evt_handler_t)(nrf_fstorage_evt_t * p_evt);

typedef struct
{
    nrf_fstorage_evt_id_t   id;         //!< The event ID.
    ret_code_t              result;     //!< Result of the operation.
    uint32_t                addr;       //!< Address at which the operation was performed.
    uint32_t                len;        //!< Length of the operation.
    void                  * p_param;    //!< User-defined parameter passed to the event handler.
} nrf_fstorage_evt_t;

to

typedef void (*nrf_dfu_flash_callback_t)(void * p_buf);

we used the nrf_fstorage_evt_t->result to determine the success of the operation in the callback, but now with the (void* p_buf) we can't do it, because there is no description what data is in this buffer and in what form.

If someone could provide a solution, I would appreciate it.

Thanks in advance and best regards,

Niclas

Parents
  • Hello!

    So, as far I as can see there are a couple of functions accepting a nrf_dfu_flash_callback_t. In general, those functions accept a callback that will be invoked upon completion and passed the memory buffer used for the operation, which the caller has the responsibility to free.

    For example, taking the case of nrf_dfu_flash_store(), the application allocates a memory buffer to receive data into; that buffer is passed to the store function, together with a nrf_dfu_flash_callback_t. When that operation has completed and the buffer has been written to flash, the callback is invoked and provided a pointer to that buffer and so the buffer is freed.

    If you want to know the result or progress of the DFU operation you should check for any NRF_DFU_EVT_* events that arrive to the handler you supplied to  nrf_dfu_req_handler_init().

Reply
  • Hello!

    So, as far I as can see there are a couple of functions accepting a nrf_dfu_flash_callback_t. In general, those functions accept a callback that will be invoked upon completion and passed the memory buffer used for the operation, which the caller has the responsibility to free.

    For example, taking the case of nrf_dfu_flash_store(), the application allocates a memory buffer to receive data into; that buffer is passed to the store function, together with a nrf_dfu_flash_callback_t. When that operation has completed and the buffer has been written to flash, the callback is invoked and provided a pointer to that buffer and so the buffer is freed.

    If you want to know the result or progress of the DFU operation you should check for any NRF_DFU_EVT_* events that arrive to the handler you supplied to  nrf_dfu_req_handler_init().

Children
Related