Hi, I have a problem with flash write speed on encrypted flash when using esp_ota_write().
The time needed to flash a 8kByte array increases from 25ms to ~400ms after flash encryption and secure boot v2 is enabled.
Esptool.py wite times increase from 17s to only 22s which I assume as correct (this is the write time of a 1.2M image). This implies that the bare flash write+encryption is fast but for some reason esp_ota_write() is slow.
Has anyone encountered such issue?
Thanks,
Viktor
ESP32: Slow OTA on encrypted flash
Re: ESP32: Slow OTA on encrypted flash
I made a simple test that runs on the encrypted board:
Results (write times of a 8kbyte block):
25ms (plaintext), 105ms (encrypted). Is this normal?
Code: Select all
esp_partition_t* partition = esp_partition_find_first(
ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, "ota_0");
if(partition) {
int64_t beginT, endT;
//const int RUNS = 1000;
static uint8_t data[8192];
esp_fill_random(data, sizeof(data));
for(;;) {
ESP_ERROR_CHECK(esp_partition_erase_range(partition, 0, sizeof(data)));//sizeof(data)));
beginT = esp_timer_get_time();
partition->encrypted = 1;
ESP_ERROR_CHECK(esp_partition_write(partition, 0, data, sizeof(data)));
endT = esp_timer_get_time();
printf("esp_partition_write: %dms\n", (uint32_t)(endT - beginT)/1000);
ESP_ERROR_CHECK(esp_partition_erase_range(partition, 0, sizeof(data)));//sizeof(data)));
beginT = esp_timer_get_time();
partition->encrypted = 0;
ESP_ERROR_CHECK(esp_partition_write(partition, 0, data, sizeof(data)));
endT = esp_timer_get_time();
printf("esp_partition_write: %dms\n", (uint32_t)(endT - beginT)/1000);
vTaskDelay(1000);
}
}
25ms (plaintext), 105ms (encrypted). Is this normal?
Re: ESP32: Slow OTA on encrypted flash
I found the reason for the slow encrypted writes, details can be found here: https://github.com/espressif/esp-idf/issues/12553
Re: ESP32: Slow OTA on encrypted flash
Hi @boborjan,
thank you for the report, your findings are correct. Our teams is already taking a look into it, you can watch the progress in your https://github.com/espressif/esp-idf/issues/12505 issue.
thank you for the report, your findings are correct. Our teams is already taking a look into it, you can watch the progress in your https://github.com/espressif/esp-idf/issues/12505 issue.
Who is online
Users browsing this forum: No registered users and 293 guests