Skip to content
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

[release/v5.1] coredump crashes in write_cfg->prepare, 0xa5a5a5a5, COMPILER_STACK_CHECK_MODE_ALL(IDFGH-12169) #13224

Closed
3 tasks done
chipweinberger opened this issue Feb 21, 2024 · 12 comments
Labels
Resolution: Cannot Reproduce Issue cannot be reproduced Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@chipweinberger
Copy link
Contributor

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

release/v5.1 (d922d41) (Feb 20, 2024)

Espressif SoC revision.

ESP32-S3 (v0.1)

Operating System used.

macOS

How did you build your project?

VS Code IDE

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

None

Development Kit.

ESP32-S3

Power Supply used.

USB

What is the expected behavior?

I'm simulating a crash using ESP_ERROR_CHECK, I expect a coredump to happen

What is the actual behavior?

The coredump crashes. I think it crashes here

    ESP_COREDUMP_LOG_PROCESS("============== Data size = %d bytes ============", tot_len);
    
    // Prepare write elf
    if (write_cfg->prepare) {
        err = write_cfg->prepare(write_cfg->priv, (uint32_t*)&tot_len);  // crashes here I think

Steps to reproduce.

force a crash by calling _esp_error_check_failed(ESP_ERR_INVALID_RESPONSE, FILE, LINE, __ASSERT_FUNC, #x);

Debug Logs.

I (43951) pd console handlers: /api/debug/force-system-crash called 
E (44361) pd api debug: force system crash
ESP_ERROR_CHECK failed: esp_err_t 0x108 (ESP_ERR_INVALID_RESPONSE) at 0x420712f1
0x420712f1: pd_api_debug_force_system_crash(pd_error_t*) at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/jamcorder-firmware/jcommon/api/core/pd_api_debug.cpp:39

file: "/Volumes/User/MBP-Google-Drive/jamcorder/firmware/jamcorder-firmware/jcommon/api/core/pd_api_debug.cpp" line 39
func: cJSON* pd_api_debug_force_system_crash(pd_error_t*)
expression: false

abort() was called at PC 0x40384b03 on core 0
0x40384b03: _esp_error_check_failed at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_system/esp_err.c:50



Backtrace: 0x40376057:0x3fcc7170 0x40384b1d:0x3fcc71a0 0x4038d817:0x3fcc71d0 0x40384b03:0x3fcc7250 0x420712f1:0x3fcc7290 0x42014c3f:0x3fcc72c0 0x420ba01d:0x3fcc7300 0x42015400:0x3fcc7330 0x40385a8e:0x3fcc7370
0x40376057: panic_abort at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_system/panic.c:452

0x40384b1d: esp_system_abort at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_system/port/esp_system_chip.c:84

0x4038d817: abort at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/newlib/abort.c:38

0x40384b03: _esp_error_check_failed at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_system/esp_err.c:50

0x420712f1: pd_api_debug_force_system_crash(pd_error_t*) at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/jamcorder-firmware/jcommon/api/core/pd_api_debug.cpp:39

0x42014c3f: cmd_standard_handler_api_emptyPostToJson(int, char**) at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/jamcorder-firmware/jcommon/api/xcoms/pd_console_handlers.cpp:308 (discriminator 5)

0x420ba01d: esp_console_run at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/console/commands.c:207

0x42015400: pd_console_task_enter_loop(void*) at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/jamcorder-firmware/jcommon/api/xcoms/pd_console_task.cpp:416

0x40385a8e: vPortTaskWrapper at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162





ELF file SHA256: 0fcc9d18e9a02807

I (8624) esp_core_dump_flash: Save core dump to flash...
I (8626) esp_core_dump_common: Backing up stack @ 0x3fcc6f40 and use core dump stack @ 0x3fcaac50
D (8628) esp_core_dump_elf: ================= Calc data size ===============
D (8630) esp_core_dump_elf: ================ Processing task registers ================
D (8632) esp_core_dump_port: Task (TCB:3fcab228) EXIT/PC/PS/A0/SP deadbeef 4037605a 60e30 80384b20 3fcc7170
D (8635) esp_core_dump_common: Crashed task 3fcab228
D (8636) esp_core_dump_port: Add regs for task 0x3fcab228
D (8637) esp_core_dump_port: Task (TCB:3fcbc0d0) EXIT/PC/PS/A0/SP 40377ac4 40381ac9 60630 82006f6d 3fcbbeb0
D (8640) esp_core_dump_port: Add regs for task 0x3fcbc0d0
D (8641) esp_core_dump_port: Task (TCB:3fcbcaf4) EXIT/PC/PS/A0/SP 40377ac4 40381ac9 60230 82006f6d 3fcbc8e0
D (8643) esp_core_dump_port: Add regs for task 0x3fcbcaf4
D (8645) esp_core_dump_port: Task (TCB:3fcad088) EXIT/PC/PS/A0/SP 40377ac4 4037f0b3 60230 8037f0d4 3c2ebc40
D (8647) esp_core_dump_port: Add regs for task 0x3fcad088
D (8649) esp_core_dump_port: Task (TCB:3fcad724) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3db450
D (8651) esp_core_dump_port: Add regs for task 0x3fcad724
D (8652) esp_core_dump_port: Task (TCB:3fcad5b4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3dc630
D (8655) esp_core_dump_port: Add regs for task 0x3fcad5b4
D (8656) esp_core_dump_port: Task (TCB:3fcac0c8) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3c3d9a10
D (8659) esp_core_dump_port: Add regs for task 0x3fcac0c8
D (8660) esp_core_dump_port: Task (TCB:3fcacaac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3c3cacc0
D (8663) esp_core_dump_port: Add regs for task 0x3fcacaac
D (8664) esp_core_dump_port: Task (TCB:3fccafc0) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60e30 80385dec 3fccad50
D (8666) esp_core_dump_port: Add regs for task 0x3fccafc0
D (8668) esp_core_dump_port: Task (TCB:3fcaba48) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3fcc4b90
D (8670) esp_core_dump_port: Add regs for task 0x3fcaba48
D (8672) esp_core_dump_port: Task (TCB:3fcbdc84) EXIT/PC/PS/A0/SP 40377ac4 4037f0b3 60030 8037f0d4 3fcbda50
D (8674) esp_core_dump_port: Add regs for task 0x3fcbdc84
D (8675) esp_core_dump_port: Task (TCB:3fcb73bc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60d30 80385dec 3fcb7180
D (8678) esp_core_dump_port: Add regs for task 0x3fcb73bc
D (8679) esp_core_dump_port: Task (TCB:3fcacec0) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3fcbfbe0
D (8682) esp_core_dump_port: Add regs for task 0x3fcacec0
D (8683) esp_core_dump_port: Task (TCB:3fcd9e44) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60330 80385dec 3fcd9a60
D (8685) esp_core_dump_port: Add regs for task 0x3fcd9e44
D (8687) esp_core_dump_port: Task (TCB:3fccc6bc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60930 80385dec 3fccc420
D (8689) esp_core_dump_port: Add regs for task 0x3fccc6bc
D (8691) esp_core_dump_port: Task (TCB:3fcac73c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60c30 80385dec 3c317d80
D (8693) esp_core_dump_port: Add regs for task 0x3fcac73c
D (8694) esp_core_dump_port: Task (TCB:3fce4790) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60f30 80385dec 3fce44a0
D (8697) esp_core_dump_port: Add regs for task 0x3fce4790
D (8698) esp_core_dump_port: Task (TCB:3fcab3ac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60630 80385dec 3fcc1a90
D (8701) esp_core_dump_port: Add regs for task 0x3fcab3ac
D (8702) esp_core_dump_port: Task (TCB:3fcab6e4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3fcc3400
D (8705) esp_core_dump_port: Add regs for task 0x3fcab6e4
D (8706) esp_core_dump_port: Task (TCB:3fcabd80) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3bbae0
D (8708) esp_core_dump_port: Add regs for task 0x3fcabd80
D (8710) esp_core_dump_port: Task (TCB:3fcabef4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3c3c8370
D (8712) esp_core_dump_port: Add regs for task 0x3fcabef4
D (8714) esp_core_dump_port: Task (TCB:3fcac920) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3c3d8240
D (8716) esp_core_dump_port: Add regs for task 0x3fcac920
D (8717) esp_core_dump_port: Task (TCB:3fcd715c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60930 80385dec 3fcd6ef0
D (8720) esp_core_dump_port: Add regs for task 0x3fcd715c
D (8721) esp_core_dump_port: Task (TCB:3fcb7d4c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3fcb7b10
D (8724) esp_core_dump_port: Add regs for task 0x3fcb7d4c
D (8725) esp_core_dump_port: Task (TCB:3fce93dc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3fcecc40
D (8727) esp_core_dump_port: Add regs for task 0x3fce93dc
D (8729) esp_core_dump_port: Task (TCB:3fcb913c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3fcb8f00
D (8731) esp_core_dump_port: Add regs for task 0x3fcb913c
D (8733) esp_core_dump_port: Task (TCB:3fccf2ac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3fccf040
D (8735) esp_core_dump_port: Add regs for task 0x3fccf2ac
D (8736) esp_core_dump_elf: ================   Processing task data   ================
D (8738) esp_core_dump_port: Task (TCB:3fcab228) EXIT/PC/PS/A0/SP deadbeef 4037605a 60e30 80384b20 3fcc7170
D (8741) esp_core_dump_common: Crashed task 3fcab228
D (8742) esp_core_dump_elf: Add TCB for task 0x3fcab228: addr 0x3fcab228, sz 368
D (8744) esp_core_dump_elf: Add stack for task 0x3fcab228: addr 0x3fcc70b0, sz 1072
D (8746) esp_core_dump_port: Task (TCB:3fcbc0d0) EXIT/PC/PS/A0/SP 40377ac4 40381ac9 60630 82006f6d 3fcbbeb0
D (8748) esp_core_dump_elf: Add TCB for task 0x3fcbc0d0: addr 0x3fcbc0d0, sz 368
D (8750) esp_core_dump_elf: Add stack for task 0x3fcbc0d0: addr 0x3fcbbdf0, sz 704
D (8752) esp_core_dump_port: Task (TCB:3fcbcaf4) EXIT/PC/PS/A0/SP 40377ac4 40381ac9 60230 82006f6d 3fcbc8e0
D (8755) esp_core_dump_elf: Add TCB for task 0x3fcbcaf4: addr 0x3fcbcaf4, sz 368
D (8756) esp_core_dump_elf: Add stack for task 0x3fcbcaf4: addr 0x3fcbc820, sz 704
D (8758) esp_core_dump_port: Task (TCB:3fcad088) EXIT/PC/PS/A0/SP 40377ac4 4037f0b3 60230 8037f0d4 3c2ebc40
D (8761) esp_core_dump_elf: Add TCB for task 0x3fcad088: addr 0x3fcad088, sz 368
D (8763) esp_core_dump_elf: Add stack for task 0x3fcad088: addr 0x3c2ebb80, sz 1104
D (8765) esp_core_dump_port: Task (TCB:3fcad724) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3db450
D (8767) esp_core_dump_elf: Add TCB for task 0x3fcad724: addr 0x3fcad724, sz 368
D (8769) esp_core_dump_elf: Add stack for task 0x3fcad724: addr 0x3c3db390, sz 800
D (8771) esp_core_dump_port: Task (TCB:3fcad5b4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3dc630
D (8773) esp_core_dump_elf: Add TCB for task 0x3fcad5b4: addr 0x3fcad5b4, sz 368
D (8775) esp_core_dump_elf: Add stack for task 0x3fcad5b4: addr 0x3c3dc570, sz 800
D (8777) esp_core_dump_port: Task (TCB:3fcac0c8) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3c3d9a10
D (8779) esp_core_dump_elf: Add TCB for task 0x3fcac0c8: addr 0x3fcac0c8, sz 368
D (8781) esp_core_dump_elf: Add stack for task 0x3fcac0c8: addr 0x3c3d9950, sz 1104
D (8783) esp_core_dump_port: Task (TCB:3fcacaac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3c3cacc0
D (8786) esp_core_dump_elf: Add TCB for task 0x3fcacaac: addr 0x3fcacaac, sz 368
D (8788) esp_core_dump_elf: Add stack for task 0x3fcacaac: addr 0x3c3cac00, sz 912
D (8790) esp_core_dump_port: Task (TCB:3fccafc0) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60e30 80385dec 3fccad50
D (8792) esp_core_dump_elf: Add TCB for task 0x3fccafc0: addr 0x3fccafc0, sz 368
D (8794) esp_core_dump_elf: Add stack for task 0x3fccafc0: addr 0x3fccac90, sz 784
D (8796) esp_core_dump_port: Task (TCB:3fcaba48) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3fcc4b90
D (8798) esp_core_dump_elf: Add TCB for task 0x3fcaba48: addr 0x3fcaba48, sz 368
D (8800) esp_core_dump_elf: Add stack for task 0x3fcaba48: addr 0x3fcc4ad0, sz 976
D (8802) esp_core_dump_port: Task (TCB:3fcbdc84) EXIT/PC/PS/A0/SP 40377ac4 4037f0b3 60030 8037f0d4 3fcbda50
D (8804) esp_core_dump_elf: Add TCB for task 0x3fcbdc84: addr 0x3fcbdc84, sz 368
D (8806) esp_core_dump_elf: Add stack for task 0x3fcbdc84: addr 0x3fcbd990, sz 736
D (8808) esp_core_dump_port: Task (TCB:3fcb73bc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60d30 80385dec 3fcb7180
D (8811) esp_core_dump_elf: Add TCB for task 0x3fcb73bc: addr 0x3fcb73bc, sz 368
D (8813) esp_core_dump_elf: Add stack for task 0x3fcb73bc: addr 0x3fcb70c0, sz 736
D (8814) esp_core_dump_port: Task (TCB:3fcacec0) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3fcbfbe0
D (8817) esp_core_dump_elf: Add TCB for task 0x3fcacec0: addr 0x3fcacec0, sz 368
D (8819) esp_core_dump_elf: Add stack for task 0x3fcacec0: addr 0x3fcbfb20, sz 752
D (8821) esp_core_dump_port: Task (TCB:3fcd9e44) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60330 80385dec 3fcd9a60
D (8823) esp_core_dump_elf: Add TCB for task 0x3fcd9e44: addr 0x3fcd9e44, sz 368
D (8825) esp_core_dump_elf: Add stack for task 0x3fcd9e44: addr 0x3fcd99a0, sz 1168
D (8827) esp_core_dump_port: Task (TCB:3fccc6bc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60930 80385dec 3fccc420
D (8829) esp_core_dump_elf: Add TCB for task 0x3fccc6bc: addr 0x3fccc6bc, sz 368
D (8831) esp_core_dump_elf: Add stack for task 0x3fccc6bc: addr 0x3fccc360, sz 832
D (8833) esp_core_dump_port: Task (TCB:3fcac73c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60c30 80385dec 3c317d80
D (8836) esp_core_dump_elf: Add TCB for task 0x3fcac73c: addr 0x3fcac73c, sz 368
D (8837) esp_core_dump_elf: Add stack for task 0x3fcac73c: addr 0x3c317cc0, sz 912
D (8839) esp_core_dump_port: Task (TCB:3fce4790) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60f30 80385dec 3fce44a0
D (8842) esp_core_dump_elf: Add TCB for task 0x3fce4790: addr 0x3fce4790, sz 368
D (8844) esp_core_dump_elf: Add stack for task 0x3fce4790: addr 0x3fce43e0, sz 912
D (8846) esp_core_dump_port: Task (TCB:3fcab3ac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60630 80385dec 3fcc1a90
D (8848) esp_core_dump_elf: Add TCB for task 0x3fcab3ac: addr 0x3fcab3ac, sz 368
D (8850) esp_core_dump_elf: Add stack for task 0x3fcab3ac: addr 0x3fcc19d0, sz 1200
D (8852) esp_core_dump_port: Task (TCB:3fcab6e4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3fcc3400
D (8854) esp_core_dump_elf: Add TCB for task 0x3fcab6e4: addr 0x3fcab6e4, sz 368
D (8856) esp_core_dump_elf: Add stack for task 0x3fcab6e4: addr 0x3fcc3340, sz 848
D (8858) esp_core_dump_port: Task (TCB:3fcabd80) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3c3bbae0
D (8860) esp_core_dump_elf: Add TCB for task 0x3fcabd80: addr 0x3fcabd80, sz 368
D (8862) esp_core_dump_elf: Add stack for task 0x3fcabd80: addr 0x3c3bba20, sz 928
D (8864) esp_core_dump_port: Task (TCB:3fcabef4) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3c3c8370
D (8867) esp_core_dump_elf: Add TCB for task 0x3fcabef4: addr 0x3fcabef4, sz 368
D (8869) esp_core_dump_elf: Add stack for task 0x3fcabef4: addr 0x3c3c82b0, sz 816
D (8870) esp_core_dump_port: Task (TCB:3fcac920) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60b30 80385dec 3c3d8240
D (8873) esp_core_dump_elf: Add TCB for task 0x3fcac920: addr 0x3fcac920, sz 368
D (8875) esp_core_dump_elf: Add stack for task 0x3fcac920: addr 0x3c3d8180, sz 848
D (8877) esp_core_dump_port: Task (TCB:3fcd715c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60930 80385dec 3fcd6ef0
D (8879) esp_core_dump_elf: Add TCB for task 0x3fcd715c: addr 0x3fcd715c, sz 368
D (8881) esp_core_dump_elf: Add stack for task 0x3fcd715c: addr 0x3fcd6e30, sz 784
D (8883) esp_core_dump_port: Task (TCB:3fcb7d4c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60030 80385dec 3fcb7b10
D (8885) esp_core_dump_elf: Add TCB for task 0x3fcb7d4c: addr 0x3fcb7d4c, sz 368
D (8887) esp_core_dump_elf: Add stack for task 0x3fcb7d4c: addr 0x3fcb7a50, sz 736
D (8889) esp_core_dump_port: Task (TCB:3fce93dc) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3fcecc40
D (8892) esp_core_dump_elf: Add TCB for task 0x3fce93dc: addr 0x3fce93dc, sz 368
D (8893) esp_core_dump_elf: Add stack for task 0x3fce93dc: addr 0x3fcecb80, sz 784
D (8895) esp_core_dump_port: Task (TCB:3fcb913c) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60430 80385dec 3fcb8f00
D (8898) esp_core_dump_elf: Add TCB for task 0x3fcb913c: addr 0x3fcb913c, sz 368
D (8900) esp_core_dump_elf: Add stack for task 0x3fcb913c: addr 0x3fcb8e40, sz 736
D (8902) esp_core_dump_port: Task (TCB:3fccf2ac) EXIT/PC/PS/A0/SP 40377ac4 400559e0 60230 80385dec 3fccf040
D (8904) esp_core_dump_elf: Add TCB for task 0x3fccf2ac: addr 0x3fccf2ac, sz 368
D (8906) esp_core_dump_elf: Add stack for task 0x3fccf2ac: addr 0x3fccef80, sz 784
D (8908) esp_core_dump_elf: Found 0 bad task out of 27
D (8909) esp_core_dump_elf: ================ Processing coredump info ================
D (8911) esp_core_dump_elf: Application SHA256='0fcc9d18e9a02807', length=17.
D (8913) esp_core_dump_elf: Core dump tot_len=51964
D (8914) esp_core_dump_elf: ============== Data size = 51964 bytes ============
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x42010a9a  PS      : 0x00060f34  A0      : 0x8200f3de  A1      : 0x3fcaac10  
0x42010a9a: esp_core_dump_write_elf at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/espcoredump/src/core_dump_elf.c:585

A2      : 0x0000cae8  A3      : 0xa5a5a5a5  A4      : 0x3fcaad14  A5      : 0x3fca7808  
A6      : 0x3fca9efc  A7      : 0x0000cafc  A8      : 0x82010a9a  A9      : 0x3fcaabc0  
A10     : 0x00000054  A11     : 0x3fca6948  A12     : 0x3fca7808  A13     : 0x0000cafc  
A14     : 0x0000cae8  A15     : 0x0000c9b4  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0xa5a5a5a5  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffd  
0x400556d5: strlen in ROM

0x400556e5: strlen in ROM



Backtrace: 0x42010a97:0x3fcaac10 0x4200f3db:0x3fcaac50
0x42010a97: esp_core_dump_write_elf at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/espcoredump/src/core_dump_elf.c:582

0x4200f3db: esp_core_dump_write at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/espcoredump/src/core_dump_common.c:157





ELF file SHA256: 0fcc9d18e9a02807

Re-entered core dump! Exception happened during core dump!
Rebooting in  4 seconds...
Rebooting...

More Information.

This is my sdkconfig

CONFIG_BOOTLOADER_WDT_ENABLE=y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_MONITOR_BAUD=460800
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0xf000
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=2048
CONFIG_COMPILER_STACK_CHECK_MODE_ALL=y
CONFIG_COMPILER_STACK_CHECK=y
CONFIG_COMPILER_WARN_WRITE_STRINGS=y

CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=8
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=5120
CONFIG_BT_NIMBLE_NVS_PERSIST=y
CONFIG_BT_NIMBLE_USE_ESP_TIMER=y

CONFIG_EFUSE_CUSTOM_TABLE=y
CONFIG_EFUSE_CUSTOM_TABLE_FILENAME="../jcommon/efuses/esp_efuse_custom_table.csv"
CONFIG_EFUSE_VIRTUAL=y
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
CONFIG_EFUSE_VIRTUAL_LOG_ALL_WRITES=y

CONFIG_HTTPD_MAX_REQ_HDR_LEN=2048
CONFIG_HTTPD_MAX_URI_LEN=2048
CONFIG_HTTPD_WS_SUPPORT=y

CONFIG_SPIRAM=y
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
CONFIG_SPIRAM_CLK_IO=30
CONFIG_SPIRAM_CS_IO=26
CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=94
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=40960
CONFIG_ESP_CONSOLE_USE_PSRAM=y

CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32S3_DATA_CACHE_16KB=y
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y
CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=4
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192

CONFIG_ESP_CONSOLE_UART_CUSTOM=y
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
CONFIG_ESP_CONSOLE_UART_TX_GPIO=43
CONFIG_ESP_CONSOLE_UART_RX_GPIO=44
CONFIG_ESP_CONSOLE_UART_BAUDRATE=460800

CONFIG_ESP_INT_WDT_TIMEOUT_MS=10000
CONFIG_ESP_TASK_WDT_PANIC=y
CONFIG_ESP_TASK_WDT_TIMEOUT_S=60
CONFIG_ESP_IPC_TASK_STACK_SIZE=2048
CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096

CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=6
CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y
CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0
CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8
CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32
CONFIG_ESP_WIFI_TX_BA_WIN=8
CONFIG_ESP_WIFI_RX_BA_WIN=12

CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
CONFIG_ESP_COREDUMP_CHECKSUM_CRC32=y
CONFIG_ESP_COREDUMP_ENABLE=y
CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64
CONFIG_ESP_COREDUMP_USE_STACK_SIZE=y
CONFIG_ESP_COREDUMP_STACK_SIZE=1280

CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
CONFIG_FATFS_FS_LOCK=16
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y

CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=3
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1880
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y

CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_FREERTOS_ISR_STACKSIZE=2096
CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER=y
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y

CONFIG_HEAP_POISONING_COMPREHENSIVE=y
CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS=y

CONFIG_LWIP_MAX_SOCKETS=16
CONFIG_LWIP_MAX_ACTIVE_TCP=32
CONFIG_LWIP_MAX_LISTENING_TCP=32
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=6500
CONFIG_LWIP_TCP_WND_DEFAULT=6500
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096

CONFIG_MBEDTLS_HARDWARE_AES=n
CONFIG_MBEDTLS_MPI_USE_INTERRUPT=n

CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096

CONFIG_MDNS_TASK_STACK_SIZE=3072
CONFIG_MONITOR_BAUD=460800

CONFIG_CXX_EXCEPTIONS=y
CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE=2048
CONFIG_STACK_CHECK_ALL=y
CONFIG_STACK_CHECK=y
CONFIG_WARN_WRITE_STRINGS=y
@chipweinberger chipweinberger added the Type: Bug bugs in IDF label Feb 21, 2024
@chipweinberger chipweinberger changed the title [release/v5.1] "Re-entered core dump! Exception happened during core dump!" [release/v5.1] coredump crashes in write_cfg->prepare Feb 21, 2024
@chipweinberger
Copy link
Contributor Author

I'll be debugging this further, give me 30 mins

@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 21, 2024
@github-actions github-actions bot changed the title [release/v5.1] coredump crashes in write_cfg->prepare [release/v5.1] coredump crashes in write_cfg->prepare (IDFGH-12169) Feb 21, 2024
@chipweinberger
Copy link
Contributor Author

write_cfg 0xa5a5a5a5

uh oh. the write_cfg struct is corrupt memory

@chipweinberger
Copy link
Contributor Author

chipweinberger commented Feb 21, 2024

So i added a bunch of logs:

ESP_COREDUMP_LOG_PROCESS("write_cfg %p", write_cfg);

adding the logs solved it somehow

@chipweinberger
Copy link
Contributor Author

specificaly, it is these 3 logs that somehow fix the coredump crash. When they're there, the coredump works. When they're not there, it crashes.

inline void esp_core_dump_write(panic_info_t *info, core_dump_write_config_t *write_cfg)
{
    ESP_COREDUMP_LOG_PROCESS("write_cfg199 %p", write_cfg);

#ifndef CONFIG_ESP_COREDUMP_ENABLE_TO_NONE
    esp_err_t err = ESP_ERR_NOT_SUPPORTED;
    s_exc_frame = (void*) info->frame;

    esp_core_dump_setup_stack();

ESP_COREDUMP_LOG_PROCESS("write_cfg198%p", write_cfg);

    esp_core_dump_port_init(info);


ESP_COREDUMP_LOG_PROCESS("write_cfg197 %p", write_cfg);

#if CONFIG_ESP_COREDUMP_DATA_FORMAT_BIN
    err = esp_core_dump_write_binary(write_cfg);
#elif CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF
    err = esp_core_dump_write_elf(write_cfg);
#endif
    if (err != ESP_OK) {
        ESP_COREDUMP_LOGE("Core dump write binary failed with error=%d", err);
    }
    esp_core_dump_report_stack_usage();
#endif
}

@chipweinberger chipweinberger changed the title [release/v5.1] coredump crashes in write_cfg->prepare (IDFGH-12169) [release/v5.1] coredump crashes in write_cfg->prepare, 0xa5a5a5a5 (IDFGH-12169) Feb 21, 2024
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Feb 21, 2024

so! the crash is caused by these kconfigs. afaict, it crashes every time if these kconfigs are set.

CONFIG_COMPILER_STACK_CHECK_MODE_ALL=y
CONFIG_COMPILER_STACK_CHECK=y

I also checked to see whether inline mattered, but it appears to not matter.

note: this is my compiler, GCC 12.2.0

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc
-- Check for working C compiler: /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc - skipped
-- Check for working CXX compiler: /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-g++ - skipped

@chipweinberger chipweinberger changed the title [release/v5.1] coredump crashes in write_cfg->prepare, 0xa5a5a5a5 (IDFGH-12169) [release/v5.1] coredump crashes in write_cfg->prepare, 0xa5a5a5a5, COMPILER_STACK_CHECK_MODE_ALL(IDFGH-12169) Feb 21, 2024
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Feb 21, 2024

I wont be debugging this further:

  1. it's kind of out of my expertise. probably should compare the assembly next
  2. the ESP_COREDUMP_LOG_PROCESS workaround is sufficient for my needs

But this is clearly a pretty severe bug somewhere, probably in GCC

@andylinpersonal
Copy link
Contributor

andylinpersonal commented Feb 21, 2024

Possibly related issue:
#13219

Because following flags will increase the stack usage.

CONFIG_COMPILER_STACK_CHECK_MODE_ALL=y
CONFIG_COMPILER_STACK_CHECK=y

@chipweinberger
Copy link
Contributor Author

True, but I've no idea why adding print statements reliably fixes things

ESP_COREDUMP_LOG_PROCESS("write_cfg199 %p", write_cfg);

@erhankur
Copy link
Collaborator

@chipweinberger Thanks for reporting. I will check it.

@erhankur
Copy link
Collaborator

I can reproduce the same issue. Calling esp_rom_printf or selecting Place panic handler code in IRAM config option avoid the exception.

I don't have a clear explanation yet.

@chipweinberger
Copy link
Contributor Author

any updates?

@chipweinberger
Copy link
Contributor Author

chipweinberger commented May 29, 2024

fixed here? 9046bf1

or here? 91586bb

@o-marshmallow

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Cannot Reproduce Issue cannot be reproduced and removed Status: Opened Issue is new labels Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Cannot Reproduce Issue cannot be reproduced Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants