Skip to content

Fix corrupt coredump images #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2024
Merged

Fix corrupt coredump images #246

merged 1 commit into from
Nov 23, 2024

Conversation

tl-sl
Copy link
Contributor

@tl-sl tl-sl commented Nov 23, 2024

Description

Fix corrupt coredump's caused by stack size setting. This was observed on esp32 on both 3.0.x and 3.1.x releases. Issue is fully resolved by setting to 0 which seems to be the esp-idf default or otherwise making it larger, test 2048 works also.

esp32s3 didnt seem impacted by this issue and does successfully create coredumps with the current setting. I have not tested under any of the risc-v targets.

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:4604
ho 0 tail 12 room 4
load:0x40078000,len:15468
load:0x40080400,len:4
ho 8 tail 4 room 4
load:0x40080404,len:3180
entry 0x400805b8
E (169) esp_core_dump_flash: ����e dump data check failed:
Calculated checksum='a1ca788b'
Image checksum='ffffffff'

assert failed: void setup() main.cpp:5 (0)

Related

espressif/arduino-esp32#10632
espressif/esp-idf#14917

Testing

Tested under esp-idf 5.1, 5.2 and 5.3 and Arduino 3.0 and 3.1 component under esp-idf. In all cases setting this to zero fixes corrupt coredumps. results with the setting at 1024 were inconsistent but only v5.2 seemed to work, all other builds failed (some with different errors that logs above).

ESP32 Logs fixed
ELF file SHA256: d9ab10d792ca16e9

I (300) esp_core_dump_flash: Save core dump to flash...
I (306) esp_core_dump_flash: Erase flash 12288 bytes @ 0x110000
I (484) esp_core_dump_flash: Write end offset 0x2504, check sum length 4
I (484) esp_core_dump_flash: Core dump has been saved to flash.
Rebooting...
ets Jul 29 2019 12:21:46

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:7132
ho 0 tail 12 room 4
load:0x40078000,len:15624
ho 0 tail 12 room 4
load:0x40080400,len:4
--- 0x40080400: _init at ??:?

load:0x40080404,len:3876
entry 0x4008064c
I (32) boot: ESP-IDF v5.1.4-828-g33fbade6b8-dirty 2nd stage bootloader
I (33) boot: compile time Nov 23 2024 14:57:15
I (35) boot: Multicore bootloader
I (39) boot: chip revision: v3.0
I (43) boot.esp32: SPI Speed      : 40MHz
I (47) boot.esp32: SPI Mode       : DIO
I (52) boot.esp32: SPI Flash Size : 4MB
I (57) boot: Enabling RNG early entropy source...
I (62) boot: Partition Table:
I (66) boot: ## Label            Usage          Type ST Offset   Length
I (73) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (80) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (88) boot:  2 factory          factory app      00 00 00010000 00100000
I (95) boot:  3 coredump         Unknown data     01 03 00110000 00010000
I (103) boot: End of partition table
I (107) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0e94ch ( 59724) map
I (137) esp_image: segment 1: paddr=0001e974 vaddr=3ffb0000 size=016a4h (  5796) load
I (140) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=234bch (144572) map
I (195) esp_image: segment 3: paddr=000434e4 vaddr=3ffb16a4 size=010dch (  4316) load
I (197) esp_image: segment 4: paddr=000445c8 vaddr=40080000 size=0d9b0h ( 55728) load
I (231) boot: Loaded app from partition at offset 0x10000
I (231) boot: Disabling RNG early entropy source...
I (243) cpu_start: Multicore app
I (243) cpu_start: Pro cpu up.
I (243) cpu_start: Starting app cpu, entry point is 0x40081318
--- 0x40081318: call_start_cpu1 at /usr/local/src/esp/esp-idf/components/esp_system/port/cpu_start.c:159


I (229) cpu_start: App cpu up.
I (261) cpu_start: Pro cpu start user code
I (261) cpu_start: cpu freq: 160000000 Hz
I (261) cpu_start: Application information:
I (266) cpu_start: Project name:     main
I (271) cpu_start: App version:      1
I (275) cpu_start: Compile time:     Nov 23 2024 20:32:34
I (281) cpu_start: ELF file SHA256:  d9ab10d792ca16e9...
I (287) cpu_start: ESP-IDF:          v5.1.4-828-g33fbade6b8-dirty
I (294) cpu_start: Min chip rev:     v0.0
I (298) cpu_start: Max chip rev:     v3.99 
I (303) cpu_start: Chip rev:         v3.0
I (308) heap_init: Initializing. RAM available for dynamic allocation:
I (315) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (321) heap_init: At 3FFB3820 len 0002C7E0 (177 KiB): DRAM
I (328) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (334) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (340) heap_init: At 4008D9B0 len 00012650 (73 KiB): IRAM
I (348) spi_flash: detected chip: winbond
I (351) spi_flash: flash io: dio
W (355) spi_flash: Detected size(16384k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (369) esp_core_dump_flash: Init core dump to flash
I (375) esp_core_dump_flash: Found partition 'coredump' @ 110000 65536 bytes
I (395) esp_core_dump_flash: Core dump data checksum is correct
I (395) esp_core_dump_flash: Found core dump 9476 bytes in flash @ 0x110000
I (399) app_start: Starting scheduler on CPU0
I (403) app_start: Starting scheduler on CPU1
I (403) main_task: Started on CPU0
I (413) main_task: Calling app_main()
I
assert failed: void setup() main.cpp:5 (0)


Backtrace: 0x4008194a:0x3ffb8c80 0x40086fd1:0x3ffb8ca0 0x4008c5e5:0x3ffb8cc0 0x400dbf0a:0x3ffb8de0 0x400d8832:0x3ffb8e10 0x4008958d:0x3ffb8e30
--- 0x4008194a: panic_abort at /usr/local/src/esp/esp-idf/components/esp_system/panic.c:466
0x40086fd1: esp_system_abort at /usr/local/src/esp/esp-idf/components/esp_system/port/esp_system_chip.c:84
0x4008c5e5: __assert_func at /usr/local/src/esp/esp-idf/components/newlib/assert.c:81
0x400dbf0a: setup() at /usr/local/src/esp/arduino/hello_world/main/main.cpp:5
0x400d8832: loopTask(void*) at /usr/local/src/esp/arduino/hello_world/managed_components/espressif__arduino-esp32/cores/esp32/main.cpp:59
0x4008958d: vPortTaskWrapper at /usr/local/src/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162
---

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@me-no-dev me-no-dev merged commit 1a2fd05 into espressif:master Nov 23, 2024
3 of 8 checks passed
darkxst pushed a commit to darkxst/esp32-arduino-lib-builder that referenced this pull request Dec 5, 2024
darkxst pushed a commit to darkxst/esp32-arduino-lib-builder that referenced this pull request Dec 5, 2024
darkxst pushed a commit to darkxst/esp32-arduino-lib-builder that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants