nRF Connect SDK API 0.1.0
|
Provides an API for writing DFU Multi Image package. More...
Data Structures | |
struct | dfu_image_writer |
User-provided functions for writing a single image from DFU Multi Image package. More... | |
Typedefs | |
typedef int(* | dfu_image_open_t) (int image_id, size_t image_size) |
typedef int(* | dfu_image_write_t) (const uint8_t *chunk, size_t chunk_size) |
typedef int(* | dfu_image_close_t) (bool success) |
Functions | |
int | dfu_multi_image_init (uint8_t *buffer, size_t buffer_size) |
Initialize DFU Multi Image library context. | |
int | dfu_multi_image_register_writer (const struct dfu_image_writer *writer) |
Register DFU image writer. | |
int | dfu_multi_image_write (size_t offset, const uint8_t *chunk, size_t chunk_size) |
Write subsequent DFU Multi Image package chunk. | |
size_t | dfu_multi_image_offset (void) |
Returns DFU Multi Image package write position. | |
int | dfu_multi_image_done (bool success) |
Complete DFU Multi Image package write. | |
Provides an API for writing DFU Multi Image package.
DFU Multi Image package is a general-purpose update file consisting of a CBOR-based header that describes contents of the package, followed by a number of update components, such as firmware images for different MCU cores. More specifically, the header contains signed numeric identifiers and sizes of included images. The meaning of the identifiers is application-specific, that is, a user is allowed to assign arbitrary identifiers to their images.
A DFU Multi Image package can be built manually using either the Python script located at 'scripts/bootloader/dfu_multi_image_tool.py' or the CMake wrapper defined in 'cmake/dfu_multi_image.cmake'. Additionally, DFU_MULTI_IMAGE_PACKAGE_BUILD
and related Kconfig options are available to enable building of a package that includes common update images.
The DFU Multi Image library can be used to process a DFU Multi Image package downloaded onto a device during the DFU process. Its proper usage consists of the following steps:
dfu_multi_image_init
function to initialize the library's context.dfu_multi_image_register_writer
for each image identifier you would like to extract from the package. Images included in the package for which no corresponding writers have been registered will be ignored.dfu_multi_image_write
function. The chunks must be provided in order. Note that if the function returns an error, no more chunks shall be provided.dfu_multi_image_done
function to release open resources and verify that all data declared in the header have been written properly.