mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/ota_magic_byte_issue' into 'master'
bugfix/ota_magic_byte_issue: Fixes OTA magic byte error See merge request idf/esp-idf!3936
This commit is contained in:
commit
c69907a54b
@ -183,8 +183,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
|||||||
if (it->handle == handle) {
|
if (it->handle == handle) {
|
||||||
// must erase the partition before writing to it
|
// must erase the partition before writing to it
|
||||||
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
||||||
|
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||||
if(it->wrote_size == 0 && size > 0 && data_bytes[0] != 0xE9) {
|
|
||||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
|
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
|
||||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user