I am trying to use esp_https_ota to update my app from an HTTPS server. I verified that my server implementation returns exactly the same response as the python "simpleHTTPServer" that is used in the official examples.
I also verified that my TLS information is correct, and the connection succeeds. My issue is that the esp_https_ota function complains about the binary being too large. This is my partitions.csv:
Code: Select all
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xE000, 0x2000,
ota_0, 0, ota_0, 0x10000, 0x1E0480,
ota_1, 0, ota_1, , 0x1E0480,
As an aside, can someone confirm that the second OTA's offset is 0x20000 because it has to be aligned on a multiple of 0x1000?I (39944) esp_https_ota: Writing to partition subtype 17 at offset 0x200000
E (39954) esp_https_ota: esp_ota_begin failed (ESP_ERR_INVALID_SIZE)
as you can see, both partitions are just under 2MB, and the binary in question is 1.3MB in size:
I tried erasing flash to make sure that the ota_data partition didn't have garbage data causing a problem.Flash: [======= ] 70.7% (used 1390786 bytes from 1967232 bytes)
This is the exact code i'm using to fetch the binary:
Code: Select all
esp_err_t WiFiManager::DoUpdate(const char* uri){
esp_http_client_config_t cfg = {
.url = uri,
.cert_pem = caCert
};
esp_err_t ret = esp_https_ota(&cfg);
if (ret == ESP_OK) {
esp_restart();
} else {
return ESP_FAIL;
}
return ESP_OK;
}