Problems debugging ESP32-C6 - Espressif IDE
Posted: Mon Aug 12, 2024 6:51 am
I was trying to debug a program for ESP32-C6 in Espressif IDE and the following error was always happening. I coudn'd enter debug:
Info : [esp32c6] Halt cause (5) - (PMP Load access fault)
Warn : Failed to get flash maps (-6)!
Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'.
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.irom' size 0 KB
Info : [esp32c6] Halt cause (5) - (PMP Load access fault)
Warn : Failed to get flash maps (-6)!
Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'.
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.drom' size 0 KB
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : Detected FreeRTOS version: (10.5.1)
[New Thread 1082201628]
[New Thread 1082196548]
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
- Oddly enough, when I tried to debug in VSCode with Espressif extension, it worked!
- Using the command line tools, it also worked!
So, the problem was only happening in Espressif IDE.
I've discovered that if I uncheck the "Flash every time with application binaries" in the "Startup" tab of the Debug configurations dialog, the debug works!
I could even make it flash the firmware before debugging using the "Initialization commands":
mon reset halt
mon program_esp c:/Users/dmgua/esp32workspace/blink-c6-530/build/blink.bin 0x10000 verify
flushregs
set remote hardware-watchpoint-limit {IDF_TARGET_CPU_WATCHPOINT_NUM}
OBS: You can not use \ (backslash) in the arguments of the "program_esp" command, even in Windows! Just /.
Other info:
- In the same computer/IDE, debugging in ESP32-C3 works flawlessly. So, it is something specific to C6.
- The error happened with both IDF 5.2 and 5.3 - The solution was only tested in 5.3.
If someone has a clue why this happened, and maybe a better solution, please, share.
Info : [esp32c6] Halt cause (5) - (PMP Load access fault)
Warn : Failed to get flash maps (-6)!
Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'.
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.irom' size 0 KB
Info : [esp32c6] Halt cause (5) - (PMP Load access fault)
Warn : Failed to get flash maps (-6)!
Warn : Application image is invalid! Check configured binary flash offset 'appimage_offset'.
Warn : Failed to get flash mappings (-4)!
Info : Using flash bank 'esp32c6.drom' size 0 KB
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
Info : Detected FreeRTOS version: (10.5.1)
[New Thread 1082201628]
[New Thread 1082196548]
Info : JTAG tap: esp32c6.cpu tap/device found: 0x0000dc25 (mfg: 0x612 (Espressif Systems), part: 0x000d, ver: 0x0)
Info : [esp32c6] Reset cause (24) - (JTAG CPU reset)
- Oddly enough, when I tried to debug in VSCode with Espressif extension, it worked!
- Using the command line tools, it also worked!
So, the problem was only happening in Espressif IDE.
I've discovered that if I uncheck the "Flash every time with application binaries" in the "Startup" tab of the Debug configurations dialog, the debug works!
I could even make it flash the firmware before debugging using the "Initialization commands":
mon reset halt
mon program_esp c:/Users/dmgua/esp32workspace/blink-c6-530/build/blink.bin 0x10000 verify
flushregs
set remote hardware-watchpoint-limit {IDF_TARGET_CPU_WATCHPOINT_NUM}
OBS: You can not use \ (backslash) in the arguments of the "program_esp" command, even in Windows! Just /.
Other info:
- In the same computer/IDE, debugging in ESP32-C3 works flawlessly. So, it is something specific to C6.
- The error happened with both IDF 5.2 and 5.3 - The solution was only tested in 5.3.
If someone has a clue why this happened, and maybe a better solution, please, share.