Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Device Firmware Update RTOS Driver

This driver can be used to instantiate and manipulate various flash partitions on xcore in an RTOS application.

For application usage refer to the tutorial RTOS Application DFU.

## Initialization API

The following structures and functions are used to initialize and start a DFU driver instance.

void rtos_dfu_image_init(rtos_dfu_image_t *dfu_image_ctx, fl_QSPIPorts *qspi_ports, fl_QuadDeviceSpec *qspi_specs, unsigned int len)

  Initializes an RTOS DFU image driver instance. This must be called before initializing the RTOS QSPI driver instance.

  This will search the flash for program images via libquadflash and store then for application DFU use.

  Parameters:

    - dfu_image_ctx – A pointer to the DFU image driver instance to initialize.

    - qspi_ports – A pointer to the fl_QSPIPorts context to determine which resources to use.

    - qspi_specs – A pointer to an array of fl_QuadDeviceSpec to try to connect to.

    - len – The number of fl_QuadDeviceSpec contained in qspi_specs

struct rtos_dfu_image_t
  #include <rtos_dfu_image.h>

  Struct representing an RTOS DFU image driver instance.

  The members in this struct should not be accessed directly.

## Core API

The following functions are the core DFU driver functions that are used after it has been initialized and started.

inline unsigned rtos_dfu_image_get_data_partition_addr(rtos_dfu_image_t *dfu_image_ctx)

  Get the starting address of the data partition

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The byte address

inline unsigned rtos_dfu_image_get_factory_addr(rtos_dfu_image_t *dfu_image_ctx)

  Get the starting address of the factory image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The byte address

inline unsigned rtos_dfu_image_get_factory_size(rtos_dfu_image_t *dfu_image_ctx)

  Get the size of the factory image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The size in bytes

inline unsigned rtos_dfu_image_get_factory_version(rtos_dfu_image_t *dfu_image_ctx)

  Get the version of the factory image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The version

inline unsigned rtos_dfu_image_get_upgrade_addr(rtos_dfu_image_t *dfu_image_ctx)

  Get the starting address of the upgrade image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The byte address

inline unsigned rtos_dfu_image_get_upgrade_size(rtos_dfu_image_t *dfu_image_ctx)

  Get the size of the upgrade image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The size in bytes

inline unsigned rtos_dfu_image_get_upgrade_version(rtos_dfu_image_t *dfu_image_ctx)

  Get the version of the upgrade image

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.

  Returns:

    The version

void rtos_dfu_image_print_debug(rtos_dfu_image_t *dfu_image_ctx)

  Print debug information

  Parameters:

    - ctx – A pointer to the DFU image driver instance to use.