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 */) |
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.
Note: offset and size must be aligned to minimal eraseable page boundary -
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 that image size is not too big
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.
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_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 |
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 |