Solved: Invalid partition table of otadata size can corrupt ota_0 partition
-
@xykon said in New beta firmware updater 1.13.1.b1:
'otadata' : ["0x190000", "0x1000"]
'ota_0' : ["0x1a0000", "0x180000"]According to the esp-idf docs otadata should be 0x2000 in size.
Reading the source code in https://github.com/pycom/pycom-esp-idf/blob/master/components/app_update/esp_ota_ops.c I think making this partition only 4k is a serius bug. and will lead to having the first block (4k) of ota_0 data erased when updating the boot partition.
static esp_err_t rewrite_ota_seq(uint32_t seq, uint8_t sec_id, const esp_partition_t *ota_data_partition) { esp_err_t ret; if (sec_id == 0 || sec_id == 1) { s_ota_select[sec_id].ota_seq = seq; s_ota_select[sec_id].crc = ota_select_crc(&s_ota_select[sec_id]); ret = esp_partition_erase_range(ota_data_partition, sec_id * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE); if (ret != ESP_OK) { return ret; } else { return esp_partition_write(ota_data_partition, SPI_FLASH_SEC_SIZE * sec_id, &s_ota_select[sec_id].ota_seq, sizeof(ota_select)); } } else { return ESP_ERR_INVALID_ARG; } }
-
Checking pycom micropython source I see, that you are not useing the esp-idf functions for performing the update .... so no danger of corrupting the ota_0 slot. Still I wonder why you are doing "your one thing" instead of using the esp-idf functions ...