Developing with ZBOSS for Zigbee
|
Macros | |
#define | OTA_UPGRADE_HEADING_DATA (sizeof(zb_zcl_ota_upgrade_file_header_t) + 2 /* fw tag Id */ + 4 /* fw length */) |
#define | OTA_UPGRADE_HASH_SIZE 16 |
#define | OTA_UPGRADE_TRAILING_DATA (2 /* hash tag Id */ + 4 /* hash length */ + OTA_UPGRADE_HASH_SIZE /* Hash */) |
#define OTA_UPGRADE_HASH_SIZE 16 |
Size of the OTA image hash.
#define OTA_UPGRADE_HEADING_DATA (sizeof(zb_zcl_ota_upgrade_file_header_t) + 2 /* fw tag Id */ + 4 /* fw length */) |
Size of sub-element includes OTA header.
#define OTA_UPGRADE_TRAILING_DATA (2 /* hash tag Id */ + 4 /* hash length */ + OTA_UPGRADE_HASH_SIZE /* Hash */) |
Size of sub-element includes a hash value.
void zb_osif_ota_close_storage | ( | void * | dev | ) |
Close device used for OTA image write
dev | flash device handle used to write OTA image |
Erase flash to be used for OTA image store.
dev | flash device handle |
offset | file offset in flash memory |
size | OTA file image size |
zb_bool_t zb_osif_ota_fw_size_ok | ( | zb_uint32_t | image_size | ) |
Check whether the current device flash memory has enough space for the OTA file image.
image_size | OTA file image size |
zb_uint32_t zb_osif_ota_get_erase_portion | ( | void | ) |
Get portion of OTA storage which can be erased at once.
void zb_osif_ota_mark_fw_absent | ( | void | ) |
Mark new FW as absent so bootloader does not attempt to re-flash it.
To be called when starting OTA.
void zb_osif_ota_mark_fw_ready | ( | void * | ota_dev, |
zb_uint32_t | size, | ||
zb_uint32_t | revision | ||
) |
Mark FW as downloaded and ready to use by bootloader.
To be called when finishing OTA, after FW loaded and verified.
ota_dev | flash device handle used to write OTA image |
size | OTA image size, without CRC |
revision | OTA image revision |
void zb_osif_ota_mark_fw_updated | ( | void | ) |
Mark FW upgrade finished, so bootloader just loads current FW.
To be called from newly started application FW. Usually not need to be called by the application. ZBOSS kernel cares about it.
void* zb_osif_ota_open_storage | ( | void | ) |
Open device to be used for OTA image write or read.
Take into account which flash (A or B) current FW is running at.
void zb_osif_ota_read | ( | void * | dev, |
zb_uint8_t * | data, | ||
zb_uint32_t | addr, | ||
zb_uint32_t | size | ||
) |
Read OTA image data from flash.
dev | flash device handle |
data | pointer to the read data |
addr | |
size | amount of data to read |
zb_uint8_t* zb_osif_ota_srv_get_image | ( | void * | dev, |
zb_uint32_t | offset, | ||
zb_uint32_t | len | ||
) |
Get OTA image data at OTA server
dev | flash device handle used to write OTA image |
offset | offset in the OTA image |
len | - length of image block to get |
zb_uint8_t* zb_osif_ota_srv_get_image_header | ( | void * | dev | ) |
Get OTA header at OTA server
dev | flash device handle used to write OTA image |
zb_bool_t zb_osif_ota_verify_integrity | ( | void * | dev, |
zb_uint32_t | raw_len | ||
) |
Verify OTA file image written to device dev
.
dev | flash device handle used to write OTA image |
raw_len | - OTA image file length |
zb_bool_t zb_osif_ota_verify_integrity_async | ( | void * | dev, |
zb_uint32_t | raw_len | ||
) |
Verify OTA file image written to device dev
asynchronously.
dev | flash device handle used to write OTA image |
raw_len | - OTA image file length |
void zb_osif_ota_verify_integrity_done | ( | zb_uint8_t | integrity_is_ok | ) |
Check whether OTA image recording was successful and finalize OTA.
integrity_is_ok | - is verification of OTA image recording successful |
void zb_osif_ota_write | ( | void * | dev, |
zb_uint8_t * | data, | ||
zb_uint32_t | off, | ||
zb_uint32_t | block_size, | ||
zb_uint32_t | image_size | ||
) |
Write OTA image data to flash.
Deal with alignment.
dev | flash device handle |
data | pointer to the data to write |
off | offset in OTA file |
block_size | amount of data to write |
image_size | total image size |