Over-The-Air Device Firmware Upgrade (Alpha)#

Wi-SUN Over-The-Air Device Firmware Upgrade (OTA DFU) service is implemented for updating Wi-SUN device's firmware. The component uses the Gecko Bootloader API to perform firmware write, verify, and set to bootload operations.

A Trivial File Transfer Protocol (TFTP) client provides downloader solution to obtain a new Gecko Bootloader File (GBL) file from remote host Over-The-Air, using the Wi-SUN network. The connection to the TFTP remote host can be configured in component configuration file. The entire firmware upgrade session can be managed over CoAP. The service includes notification and status request capabilities.

Modules#

Type definitions

Functions#

void

Initialize the device firmware upgrade service.

sl_status_t

Start firmware update.

sl_status_t

Stop firmware update.

sl_status_t
uint32_t

Get the status value.

const char *

Get the status string in JSON format.

void

Free the status string buffer.

bool
sl_wisun_ota_dfu_get_fw_update_status_flag(const sl_wisun_ota_dfu_status_t status_flag)

Get the status flag value.

void
sl_wisun_ota_dfu_error_hnd(const sl_wisun_ota_dfu_error_code_t error_code, sl_wisun_ota_dfu_error_ctx_t *const ctx)

OTA DFU error handler (weak implementation)

Function Documentation#

sl_wisun_ota_dfu_init#

void sl_wisun_ota_dfu_init (void )

Initialize the device firmware upgrade service.

Parameters
N/A

Initialize Wi-SUN OTA Device Firmware Upgrade service.


Definition at line 144 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_start_fw_update#

sl_status_t sl_wisun_ota_dfu_start_fw_update (void )

Start firmware update.

Parameters
N/A

Start firmware update by setting SL_WISUN_OTA_DFU_STATUS_FW_UPDATE_STARTED flag Returns

  • sl_status_t SL_STATUS_OK on success, otherwise SL_STATUS_FAIL


Definition at line 152 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_stop_fw_update#

sl_status_t sl_wisun_ota_dfu_stop_fw_update (void )

Stop firmware update.

Parameters
N/A

Stop firmware update by setting SL_WISUN_OTA_DFU_STATUS_FW_UPDATE_STOPPED flag Returns

  • sl_status_t SL_STATUS_OK on success, otherwise SL_STATUS_FAIL


Definition at line 160 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_reboot_and_install#

sl_status_t sl_wisun_ota_dfu_reboot_and_install (void )

Reboot device.

Parameters
N/A

Reboot device with calling corresponding gecko bootloader 'bootloader_rebootAndInstall' API This functions is available if auto-reboot mode is disabled. Returns

  • sl_status_t SL_STATUS_OK on success, otherwise SL_STATUS_FAIL


Definition at line 170 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_get_fw_update_status#

uint32_t sl_wisun_ota_dfu_get_fw_update_status (void )

Get the status value.

Parameters
N/A

Returning the value of event flags Returns

  • uint32_t Status


Definition at line 178 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_get_fw_update_status_json_str#

const char * sl_wisun_ota_dfu_get_fw_update_status_json_str (void )

Get the status string in JSON format.

Parameters
N/A

String buffer is allocated in heap by CoAP allocator Returns

  • const char * Allocated string pointer on success, otherwise NULL


Definition at line 185 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_free_fw_update_status_json_str#

void sl_wisun_ota_dfu_free_fw_update_status_json_str (const char * str)

Free the status string buffer.

Parameters
[in]str

String ptr

Call CoAP free to release allocated memory


Definition at line 192 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_get_fw_update_status_flag#

bool sl_wisun_ota_dfu_get_fw_update_status_flag (const sl_wisun_ota_dfu_status_t status_flag)

Get the status flag value.

Parameters
[in]status_flag

Status flag enum

Bool representation of status variable bit value Returns

  • bool true if the flag is set, otherwise false


Definition at line 200 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h

sl_wisun_ota_dfu_error_hnd#

void sl_wisun_ota_dfu_error_hnd (const sl_wisun_ota_dfu_error_code_t error_code, sl_wisun_ota_dfu_error_ctx_t *const ctx)

OTA DFU error handler (weak implementation)

Parameters
[in]error_code

Error code

[in]ctx

Error context with error details

Catch error in different stages of boot load.


Definition at line 208 of file /mnt/raid/workspaces/ws.XvhINl85J/overlay/gsdk/app/wisun/component/ota_dfu/sl_wisun_ota_dfu.h