Firmware verification happens TWICE during OTA install

jcolebaker
Posts: 60
Joined: Thu Mar 18, 2021 12:23 am

Firmware verification happens TWICE during OTA install

Postby jcolebaker » Wed Dec 08, 2021 10:33 pm

Hi, We've implemented OTA upgrade following several examples, and it's working well. I've turned on firmware image signing to help ensure that a valid image has been sent.

Once the OTA data has been received and written to flash, I finish the OTA process as follows:

Code: Select all

result = esp_ota_end(l_update_handle);
...
result = esp_ota_set_boot_partition(l_update_partition);
...
In the logs, I see this ("Install firmware" message is generated just before calling "esp_ota_end"):

Code: Select all

I (203722) OTA: Install firmware...
I (203732) esp_image: segment 0: paddr=00120020 vaddr=3f400020 size=15c40h ( 89152) map
I (203762) esp_image: segment 1: paddr=00135c68 vaddr=3ffbdb60 size=05a58h ( 23128)
I (203772) esp_image: segment 2: paddr=0013b6c8 vaddr=40080000 size=04950h ( 18768)
I (203782) esp_image: segment 3: paddr=00140020 vaddr=400d0020 size=5e71ch (386844) map
I (203902) esp_image: segment 4: paddr=0019e744 vaddr=40084950 size=13970h ( 80240)
I (203932) esp_image: segment 5: paddr=001b20bc vaddr=50000000 size=00010h (    16)
I (203932) esp_image: segment 6: paddr=001b20d4 vaddr=00000000 size=0deach ( 57004)
I (203962) esp_image: Verifying image signature...
I (204922)  OTA: Update boot partition...
I (204932) esp_image: segment 0: paddr=00120020 vaddr=3f400020 size=15c40h ( 89152) map
I (204962) esp_image: segment 1: paddr=00135c68 vaddr=3ffbdb60 size=05a58h ( 23128)
I (204972) esp_image: segment 2: paddr=0013b6c8 vaddr=40080000 size=04950h ( 18768)
I (204972) esp_image: segment 3: paddr=00140020 vaddr=400d0020 size=5e71ch (386844) map
I (205102) esp_image: segment 4: paddr=0019e744 vaddr=40084950 size=13970h ( 80240)
I (205132) esp_image: segment 5: paddr=001b20bc vaddr=50000000 size=00010h (    16)
I (205132) esp_image: segment 6: paddr=001b20d4 vaddr=00000000 size=0deach ( 57004)
I (205152) esp_image: Verifying image signature...
I (206162)  OTA: Firmware installed. Restarting...
...(reboot)
It looks like the "Verifying image signature..." step is done twice, once during "esp_ota_end" and once during "esp_ota_set_boot_partition".

Is it possible to avoid running this signature verification twice?

It takes ~1 second each time at the moment, but that will increase as we add more features.

Who is online

Users browsing this forum: No registered users and 144 guests