User Tools

Site Tools


esp32_ota

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
esp32_ota [2024/03/20 01:50]
sausage [ESP32 OTA and Rollbacks - What happens under the hood?]
esp32_ota [2025/02/02 21:16] (current)
sausage CRC checksum details
Line 303: Line 303:
 </​code>​ </​code>​
  
-Interesting. On the left is ''​ota_0''​. It has a boot sequence of ''​01''​ and a CRC check (not covered in this article). This partition will boot each time the ESP32 is reset. On the right is ''​ota_1'',​ and there is nothing here to indicate if it should boot.+Interesting. On the left is ''​ota_0''​. It has a boot sequence of ''​01''​ and a CRC checksum ​(keep a note of this, we will come back to this). This partition will boot each time the ESP32 is reset. On the right is ''​ota_1'',​ and there is nothing here to indicate if it should boot.
  
 We can also verify the ''​otadata''​ partition and take a closer look at what is stored there now. We can also verify the ''​otadata''​ partition and take a closer look at what is stored there now.
Line 319: Line 319:
  
 ''​9A 98 43 47''​ is the firmware checksum. ​ ''​9A 98 43 47''​ is the firmware checksum. ​
 +
 +Remember the CRC checksum in ''​ota_0''?​
 +
 +''​0x4743989a''​. This is how you can confirm which firmware is running.
  
 Let's switch to booting the firmware on ''​ota_1'':​ Let's switch to booting the firmware on ''​ota_1'':​
Line 358: Line 362:
  
 In our case, the second sector has a new entry, the ''​02''​ sequence. This is for the firmware on ''​ota_1''​. ''​02''​ is greater than ''​01''​ so this is the firmware selected for boot by the bootloader. In our case, the second sector has a new entry, the ''​02''​ sequence. This is for the firmware on ''​ota_1''​. ''​02''​ is greater than ''​01''​ so this is the firmware selected for boot by the bootloader.
 +
 +Again we can inspect the checksum: ''​0x55f63774''​ is ''​74 37 F6 55''​.
  
 How an OTA partition is determined from sequence numbers in the otadata partition is not explained in the documentation,​ but is explained in the code. You can see it here: https://​github.com/​pycom/​esp-idf-2.0/​blob/​master/​components/​app_update/​esp_ota_ops.c#​L297 How an OTA partition is determined from sequence numbers in the otadata partition is not explained in the documentation,​ but is explained in the code. You can see it here: https://​github.com/​pycom/​esp-idf-2.0/​blob/​master/​components/​app_update/​esp_ota_ops.c#​L297
esp32_ota.1710899441.txt.gz ยท Last modified: 2024/03/20 01:50 by sausage