pre_encrypted_ota sample custom partition not working

dzungpv
Posts: 17
Joined: Thu Mar 26, 2020 4:52 am

pre_encrypted_ota sample custom partition not working

Postby dzungpv » Fri Sep 29, 2023 8:07 am

I try pre_encrypted_ota sample with SDK 4.4.6 by cherry pick two merge from SDK 5.
Origin project working fine and the pre encrypt ota can be update from the test server. But to use it I must use custom partition to support secure boot and flash encryption.
I just test by apply new partition table:

Code: Select all

# Name,   Type, SubType, Offset,  Size, Flags
nvs, data, nvs, 0xF000, 0x4000
otadata, data, ota, 0x13000 , 0x2000
phy_init, data, phy, 0x15000, 0x1000
app0, app, ota_0, 0x20000, 0x1E0000
app1, app, ota_1, 0x200000, 0x1E0000
spiffs, data, spiffs, 0x3E0000, 0x11000
coredump, data, coredump, 0x3F1000, 0x8000
esp_secure_cert, data, nvs, 0x3F9000, 0x2000
fctry, data, nvs, 0x3FB000, 0x4000
nvs_keys, data, nvs_keys, 0x3FF000, 0x1000, encrypted,
But after OTA the sample app not working any more, it show the logs:

Code: Select all

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6672
load:0x40078000,len:15064
load:0x40080400,len:3836
0x40080400: _init at ??:?

entry 0x4008069c
I (27) boot: ESP-IDF v4.4.6-5-gcaa96638dd-dirty 2nd stage bootloader
I (27) boot: compile time 14:47:52
I (27) boot: Multicore bootloader
I (32) boot: chip revision: v1.0
I (36) boot.esp32: SPI Speed      : 40MHz
I (41) boot.esp32: SPI Mode       : DIO
I (45) boot.esp32: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (55) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (66) boot:  0 nvs              WiFi data        01 02 0000f000 00004000
I (73) boot:  1 otadata          OTA data         01 00 00013000 00002000
I (81) boot:  2 phy_init         RF data          01 01 00015000 00001000
I (88) boot:  3 app0             OTA app          00 10 00020000 001e0000
I (96) boot:  4 app1             OTA app          00 11 00200000 001e0000
I (103) boot:  5 spiffs           Unknown data     01 82 003e0000 00011000
I (111) boot:  6 coredump         Unknown data     01 03 003f1000 00008000
I (118) boot:  7 esp_secure_cert  WiFi data        01 02 003f9000 00002000
I (126) boot:  8 fctry            WiFi data        01 02 003fb000 00004000
I (133) boot:  9 nvs_keys         NVS keys         01 04 003ff000 00001000
I (141) boot: End of partition table
I (145) esp_image: segment 0: paddr=00200020 vaddr=3f400020 size=1d50ch (120076) map
I (197) esp_image: segment 1: paddr=0021d534 vaddr=3ffb0000 size=02ae4h ( 10980) load
I (202) esp_image: segment 2: paddr=00220020 vaddr=400d0020 size=93308h (602888) map
I (421) esp_image: segment 3: paddr=002b3330 vaddr=3ffb2ae4 size=005f0h (  1520) load
I (422) esp_image: segment 4: paddr=002b3928 vaddr=40080000 size=14f6ch ( 85868) load
I (472) boot: Loaded app from partition at offset 0x200000
I (472) boot: Disabling RNG early entropy source...
I (484) cpu_start: Multicore app
I (484) cpu_start: Pro cpu up.
I (484) cpu_start: Starting app cpu, entry point is 0x40081188
0x40081188: call_start_cpu1 at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/port/cpu_start.c:151

I (474) cpu_start: App cpu up.
I (502) cpu_start: Pro cpu start user code
I (502) cpu_start: cpu freq: 160000000
I (503) cpu_start: Application information:
I (507) cpu_start: Project name:     pre_encrypted_ota
I (513) cpu_start: App version:      v4.4.6-5-gcaa96638dd-dirty
I (519) cpu_start: Compile time:     Sep 29 2023 13:56:16
I (526) cpu_start: ELF file SHA256:  cfea3d65a33d6fbd...
I (531) cpu_start: ESP-IDF:          v4.4.6-5-gcaa96638dd-dirty
I (538) cpu_start: Min chip rev:     v0.0
I (543) cpu_start: Max chip rev:     v3.99 
I (548) cpu_start: Chip rev:         v1.0
I (553) heap_init: Initializing. RAM available for dynamic allocation:
I (560) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (566) heap_init: At 3FFB73A0 len 00028C60 (163 KiB): DRAM
I (572) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (578) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (585) heap_init: At 40094F6C len 0000B094 (44 KiB): IRAM
I (592) spi_flash: detected chip: generic
I (596) spi_flash: flash io: dio
I (601) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
E (611) partition: No MD5 found in partition table
E (621) partition: load_partitions returned 0x105
ESP_ERROR_CHECK failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x40088d20
0x40088d20: _esp_error_check_failed at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/esp_err.c:42

file: "IDF/examples/system/ota/pre_encrypted_ota/main/pre_encrypted_ota.c" line 170
func: app_main
expression: err

abort() was called at PC 0x40088d23 on core 0
0x40088d23: _esp_error_check_failed at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/esp_err.c:43



Backtrace: 0x40081b7a:0x3ffb9860 0x40088d2d:0x3ffb9880 0x4008f7aa:0x3ffb98a0 0x40088d23:0x3ffb9910 0x400d7128:0x3ffb9930 0x40161428:0x3ffb9960 0x4008c019:0x3ffb9980
0x40081b7a: panic_abort at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/panic.c:408

0x40088d2d: esp_system_abort at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/esp_system.c:137

0x4008f7aa: abort at /Users/xx/esp/esp-idf-v4.4.6/components/newlib/abort.c:46

0x40088d23: _esp_error_check_failed at /Users/xx/esp/esp-idf-v4.4.6/components/esp_system/esp_err.c:43

0x400d7128: app_main at /Users/xx/esp/esp-idf-v4.4.6/examples/system/ota/pre_encrypted_ota/main/pre_encrypted_ota.c:170 (discriminator 1)

0x40161428: main_task at /Users/xx/esp/esp-idf-v4.4.6/components/freertos/port/port_common.c:141 (discriminator 2)

0x4008c019: vPortTaskWrapper at /Users/xx/esp/esp-idf-v4.4.6/components/freertos/port/xtensa/port.c:142
So I think it must be difference in partition mention in sample app, it is 3: 1MB factory and 2 app image each 1 MB. So how can I use the feature with just 2 OTA partition?

ESP_Mahavir
Posts: 190
Joined: Wed Jan 24, 2018 6:51 am

Re: pre_encrypted_ota sample custom partition not working

Postby ESP_Mahavir » Mon Oct 09, 2023 4:17 am

Hello,

This error highlights that the application is built with MD5 checksum enabled for the partition table binary but the actual partition table on the device does not have the MD5 checksum appended to it.

Is it the case that the device is running bootloader and partition table from old IDF release? Or you are facing this issue with fresh build from IDF 4.4 release?

Ref:

https://docs.espressif.com/projects/esp ... 5-checksum

Who is online

Users browsing this forum: No registered users and 69 guests