espressif / esp-iot-solution

Espressif IoT Library. IoT Device Drivers, Documentations and Solutions.
Apache License 2.0
1.99k stars 789 forks source link

bootloader_support_plus @esp32s3 Not functioning properly (AEGHB-810) #406

Closed greentd closed 2 months ago

greentd commented 2 months ago

Answers checklist.

IDF version.

ESP-IDF v5.4-dev-2744-g59e1838270

Espressif SoC revision.

ESP32S3FH4R2

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

CMD

Development Kit.

ESP32S3FH4R2

Power Supply used.

External 3.3V

What is the expected behavior?

I want to implement differential compression OTA on esp32s2fh4r2 to reduce the flash usage of OTA partition

What is the actual behavior?

https://github.com/espressif/esp-iot-solution/tree/master/examples/ota/simple_ota_example

Using this routine, the uncompressed bin file can be upgraded normally, but the compressed file will prompt after the upgrade and restart.

E (122) esp_image: Checksum failed. Calculated 0xef read 0x0 E (128) boot: OTA app partition slot 1 is not bootable

Steps to reproduce.

  1. Step
  2. Step
  3. Step ...

Debug Logs.

I (27) boot: ESP-IDF v5.4-dev-2744-g59e1838270 2nd stage bootloader
I (27) boot: compile time Sep 13 2024 14:51:33
I (27) boot: Multicore bootloader
I (32) boot: chip revision: v0.1
I (35) boot: efuse block revision: v1.2
I (40) boot.esp32s3: Boot SPI Speed : 80MHz
I (45) boot.esp32s3: SPI Mode       : DIO
I (49) boot.esp32s3: SPI Flash Size : 4MB
I (54) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (63) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 phy_init         RF data          01 01 0000c000 00001000
I (78) boot:  1 nvs              WiFi data        01 02 0000d000 00007000
I (85) boot:  2 otadata          OTA data         01 00 00014000 00002000
I (93) boot:  3 ota_0            OTA app          00 10 00020000 00130000
I (100) boot:  4 ota_1            OTA app          00 11 00150000 000a0000
I (108) boot: End of partition table
[boot] Custom bootloader message defined in the KConfig file.
I (118) esp_image: segment 0: paddr=00020020 vaddr=3c0b0020 size=2bd50h (179536) map
I (158) esp_image: segment 1: paddr=0004bd78 vaddr=3fc99c00 size=042a0h ( 17056) load
I (161) esp_image: segment 2: paddr=00050020 vaddr=42000020 size=a08e8h (657640) map
I (279) esp_image: segment 3: paddr=000f0910 vaddr=3fc9dea0 size=0070ch (  1804) load
I (280) esp_image: segment 4: paddr=000f1024 vaddr=40374000 size=15b3ch ( 88892) load
I (313) boot: Loaded app from partition at offset 0x20000
I (313) boot: Disabling RNG early entropy source...
I (325) cpu_start: Multicore app
I (336) cpu_start: Pro cpu start user code
I (336) cpu_start: cpu freq: 160000000 Hz
I (336) app_init: Application information:
I (339) app_init: Project name:     simple_ota
I (344) app_init: App version:      1
I (348) app_init: Compile time:     Sep 13 2024 14:50:59
I (354) app_init: ELF file SHA256:  5d74ccf94...
I (360) app_init: ESP-IDF:          v5.4-dev-2744-g59e1838270
I (366) efuse_init: Min chip rev:     v0.0
I (371) efuse_init: Max chip rev:     v0.99
I (376) efuse_init: Chip rev:         v0.1
I (381) heap_init: Initializing. RAM available for dynamic allocation:
I (388) heap_init: At 3FCA29C8 len 00046D48 (283 KiB): RAM
I (394) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (400) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (406) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM
I (414) spi_flash: detected chip: generic
I (417) spi_flash: flash io: dio
I (421) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (428) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (436) main_task: Started on CPU0
I (466) main_task: Calling app_main()
I (466) simple_ota_example: OTA example app_main start
I (486) simple_ota_example: SHA-256 for bootloader:  18eaa08f51aa497123025cc841a69143f20c0c968a09c113805acf5d3122522a
I (556) simple_ota_example: SHA-256 for current firmware:  08842fb198bd8de9623fbcb823e954b893739e04cdfbcccfb5261d0088cdddf8
I (556) example_connect: Start example_connect.
I (566) pp: pp rom version: e7ae62f
I (566) net80211: net80211 rom version: e7ae62f
I (586) wifi:wifi driver task: 3fcaca98, prio:23, stack:6656, core=0
I (586) wifi:wifi firmware version: df2deb7
I (586) wifi:wifi certification version: v7.0
I (586) wifi:config NVS flash: enabled
I (596) wifi:config nano formatting: disabled
I (596) wifi:Init data frame dynamic rx buffer num: 32
I (596) wifi:Init static rx mgmt buffer num: 5
I (606) wifi:Init management short buffer num: 32
I (606) wifi:Init dynamic tx buffer num: 32
I (616) wifi:Init static tx FG buffer num: 2
I (616) wifi:Init static rx buffer size: 1600
I (626) wifi:Init static rx buffer num: 10
I (626) wifi:Init dynamic rx buffer num: 32
I (626) wifi_init: rx ba win: 6
I (636) wifi_init: accept mbox: 6
I (636) wifi_init: tcpip mbox: 32
I (636) wifi_init: udp mbox: 6
I (646) wifi_init: tcp mbox: 6
I (646) wifi_init: tcp tx win: 5760
I (656) wifi_init: tcp rx win: 5760
I (656) wifi_init: tcp mss: 1440
I (656) wifi_init: WiFi IRAM OP enabled
I (666) wifi_init: WiFi RX IRAM OP enabled
I (666) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
I (716) wifi:mode : sta (64:e8:33:40:c0:9c)
I (716) wifi:enable tsf
I (716) example_connect: Connecting to T1234...
W (716) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (726) example_connect: Waiting for IP(s)
I (3586) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (3586) wifi:state: init -> auth (0xb0)
I (3596) wifi:state: auth -> assoc (0x0)
I (3606) wifi:state: assoc -> run (0x10)
I (3626) wifi:connected with T1234, aid = 4, channel 11, BW20, bssid = 74:05:a5:a6:41:a5
I (3626) wifi:security: WPA2-PSK, phy: bgn, rssi: -64
I (3626) wifi:pm start, type: 1

I (3626) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (3636) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (3656) wifi:<ba-add>idx:0 (ifx:0, 74:05:a5:a6:41:a5), tid:0, ssn:0, winSize:64
I (3676) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (5146) esp_netif_handlers: example_netif_sta ip: 192.168.113.225, mask: 255.255.255.0, gw: 192.168.113.1
I (5146) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.113.225
I (5556) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:66e8:33ff:fe40:c09c, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5556) example_common: Connected to example_netif_sta
I (5566) example_common: - IPv4 address: 192.168.113.225,
I (5566) example_common: - IPv6 address: fe80:0000:0000:0000:66e8:33ff:fe40:c09c, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (5576) wifi:Set ps type: 0, coexist: 0

I (5586) simple_ota_example: Starting OTA example task
I (5586) simple_ota_example: Attempting to download update from https://192.168.113.118:8000/upload/test_hello.bin.xz.packed
I (5606) main_task: Returned from app_main()
I (5676) esp-x509-crt-bundle: Certificate validated
I (6116) esp_https_ota: Starting OTA...
I (6116) custom_image: OTA to ota_1
I (6126) esp_https_ota: Writing to partition subtype 17 at offset 0x150000
I (9846) simple_ota_example: OTA Succeed, Rebooting...
I (9846) wifi:state: run -> init (0x0)
I (9846) wifi:pm stop, total sleep time: 1472117 us / 6214217 us

I (9846) wifi:<ba-del>idx:0, tid:0
I (9846) wifi:new:<11,0>, old:<11,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (9896) wifi:flush txq
I (9896) wifi:stop sw txq
I (9896) wifi:lmac stop hw txq
I (9896) wifi:Deinit lldesc rx mblock:10
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375b10
0x40375b10: esp_restart_noos at D:/esp32/esp-idf/components/esp_system/port/soc/esp32s3/system_internal.c:158

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x18b4
load:0x403c8700,len:0x4
load:0x403c8704,len:0xd34
load:0x403cb700,len:0x2efc
entry 0x403c892c
I (31) boot: ESP-IDF v5.4-dev-2744-g59e1838270 2nd stage bootloader
I (31) boot: compile time Sep 13 2024 14:51:33
I (32) boot: Multicore bootloader
I (36) boot: chip revision: v0.1
I (40) boot: efuse block revision: v1.2
I (44) boot.esp32s3: Boot SPI Speed : 80MHz
I (49) boot.esp32s3: SPI Mode       : DIO
I (54) boot.esp32s3: SPI Flash Size : 4MB
I (59) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label            Usage          Type ST Offset   Length
I (75) boot:  0 phy_init         RF data          01 01 0000c000 00001000
I (82) boot:  1 nvs              WiFi data        01 02 0000d000 00007000
I (90) boot:  2 otadata          OTA data         01 00 00014000 00002000
I (97) boot:  3 ota_0            OTA app          00 10 00020000 00130000
I (105) boot:  4 ota_1            OTA app          00 11 00150000 000a0000
I (112) boot: End of partition table
[boot] Custom bootloader message defined in the KConfig file.
E (122) esp_image: Checksum failed. Calculated 0xef read 0x0
E (128) boot: OTA app partition slot 1 is not bootable
I (134) esp_image: segment 0: paddr=00020020 vaddr=3c0b0020 size=2bd50h (179536) map
I (174) esp_image: segment 1: paddr=0004bd78 vaddr=3fc99c00 size=042a0h ( 17056) load
I (178) esp_image: segment 2: paddr=00050020 vaddr=42000020 size=a08e8h (657640) map
I (296) esp_image: segment 3: paddr=000f0910 vaddr=3fc9dea0 size=0070ch (  1804) load
I (297) esp_image: segment 4: paddr=000f1024 vaddr=40374000 size=15b3ch ( 88892) load
I (330) boot: Loaded app from partition at offset 0x20000
I (330) boot: Disabling RNG early entropy source...
I (342) cpu_start: Multicore app

More Information.

No response

greentd commented 2 months ago

I bought an ESP32C3 development board and ran it with esp-idf v5.07. I still get the error:

E (6255) esp_image: Checksum failed. Calculated 0xef read 0x0 E (6255) simple_ota_example: Firmware upgrade failed

I (4525) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:9e9e:6eff:fe09:ac68, type: ESP_IP6_ADDR_IS_LINK_LOCAL I (4975) esp_netif_handlers: example_netif_sta ip: 192.168.113.129, mask: 255.255.255.0, gw: 192.168.113.1 I (4975) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.113.129 I (4985) example_common: Connected to example_netif_sta I (4985) example_common: - IPv4 address: 192.168.113.129, I (4995) example_common: - IPv6 address: fe80:0000:0000:0000:9e9e:6eff:fe09:ac68, type: ESP_IP6_ADDR_IS_LINK_LOCAL I (5005) wifi:Set ps type: 0, coexist: 0

I (5005) simple_ota_example: Starting OTA example task I (5015) simple_ota_example: Attempting to download update from https://192.168.113.118:8000/upload/test_hello.bin.xz.packed I (5025) main_task: Returned from app_main() I (5125) esp-x509-crt-bundle: Certificate validated I (5465) esp_https_ota: Starting OTA... I (5465) esp_https_ota: Writing to partition subtype 17 at offset 0x150000 E (6255) esp_image: Checksum failed. Calculated 0xef read 0x0 E (6255) simple_ota_example: Firmware upgrade failed

I also tested it on esp32c3 using esp-idf v5.14, and it also cannot be compressed and upgraded.

WangYuxin-esp commented 2 months ago

Thank you for reporting the issue. Please check if option CONFIG_BOOTLOADER_COMPRESSED_ENABLED is enabled in the configuration menu.