add ota algorithm for device
1. effective "Differential Upgrade" patch algorithm with high compression rate 2. effective recovery algorithm support recovery firmware in blocks which has low memory consumption and wear-leveling strategies, especially suitable for embeded devices with low RAM. 3. add sample ota bootloader project, see: board\TencentOS_tiny_EVB_MX_Plus\KEIL\ota\ota_bootloader_recovery 4. add sample application project for download firmware through http, see: board\TencentOS_tiny_EVB_MX_Plus\KEIL\ota\ota_application_download_through_http 5. add sample application project for download firmware through qcloud explorer console, see: board\TencentOS_tiny_EVB_MX_Plus\KEIL\ota\ota_application_download_through_qcloud_iot_explorer 6. an OTA markdown document is pending
This commit is contained in:
22
components/ota/common/image/ota_image.c
Normal file
22
components/ota/common/image/ota_image.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "crc8.h"
|
||||
#include "ota_image.h"
|
||||
|
||||
uint8_t ota_img_hdr_crc(ota_img_hdr_t *img_hdr)
|
||||
{
|
||||
uint8_t crc = 0;
|
||||
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->magic, sizeof(uint16_t));
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->new_version, sizeof(ota_img_vs_t));
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->old_version, sizeof(ota_img_vs_t));
|
||||
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->new_crc, sizeof(uint8_t));
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->new_size, sizeof(uint32_t));
|
||||
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->old_crc, sizeof(uint8_t));
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->old_size, sizeof(uint32_t));
|
||||
|
||||
crc = crc8(crc, (uint8_t *)&img_hdr->patch_size, sizeof(uint32_t));
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user