我在vscode 的 esp-idf 插件下使用gdb调试 esp32s3时,程序无法在断点 app_main 处停下,会直接运行 flash中的应用程序。
请教一下 esp32s3 的gdb 无法在断点处停下的原因是什么?
环境如下:
主机环境: ubuntu20.04
开发环境: vscode + esp-idf v5.3.2 插件(5.3 release版本)
硬件环境: 立创实战派ESP32-S3开发板
详细描述:
需求:想使用gdb调试一下 https://github.com/espressif/esp-idf/t ... rted/blink 这个应用程序。
编译工程时已经正确设置了工程的 target 为 esp32s3.
当使用 esp-idf 插件 工具栏中的 Debug 工具调试时,发现程序无法在断点处停下来。
于是手动输入调试命令,现象一样,仍然无法停下来,gdb 的调试信息如下:
终端1:
Code: Select all
duan@duan-ThinkCentre-M72e:~/work/code/examples/get-started/blink$ openocd -f board/esp32s3-builtin.cfg
Open On-Chip Debugger v0.12.0-esp32-20241016 (2024-10-16-14:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp_usb_jtag: serial (E8:06:90:A3:23:54)
Info : esp_usb_jtag: Device found. Base speed 40000KHz, div range 1 to 255
Info : clock speed 40000 kHz
Info : JTAG tap: esp32s3.tap0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.tap1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] Examination succeed
Info : [esp32s3.cpu1] Examination succeed
Info : [esp32s3.cpu0] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
Info : Set GDB target to 'esp32s3.cpu0'
Info : [esp32s3.cpu1] Target halted, PC=0x400003C0, debug_reason=00000001
Info : [esp32s3.cpu1] Reset cause (3) - (Software core reset)
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : [esp32s3.cpu0] Target halted, PC=0x4038CB86, debug_reason=00000001
Info : Flash mapping 0: 0x100020 -> 0x3c1c0020, 2268 KB
Info : Flash mapping 1: 0x340020 -> 0x42000020, 1735 KB
Info : Auto-detected flash bank 'esp32s3.cpu0.flash' size 16384 KB
Info : Using flash bank 'esp32s3.cpu0.flash' size 16384 KB
Info : [esp32s3.cpu0] Target halted, PC=0x4038CB86, debug_reason=00000001
Info : Flash mapping 0: 0x100020 -> 0x3c1c0020, 2268 KB
Info : Flash mapping 1: 0x340020 -> 0x42000020, 1735 KB
Info : Using flash bank 'esp32s3.cpu0.irom' size 1736 KB
Info : [esp32s3.cpu0] Target halted, PC=0x4038CB86, debug_reason=00000001
Info : Flash mapping 0: 0x100020 -> 0x3c1c0020, 2268 KB
Info : Flash mapping 1: 0x340020 -> 0x42000020, 1735 KB
Info : Using flash bank 'esp32s3.cpu0.drom' size 2272 KB
Info : New GDB Connection: 1, Target esp32s3.cpu0, state: halted
Warn : Prefer GDB command "target extended-remote :3333" instead of "target remote :3333"
Info : JTAG tap: esp32s3.tap0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32s3.tap1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : [esp32s3.cpu0] requesting target halt and executing a soft reset
Info : [esp32s3.cpu0] Debug controller was reset.
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
Info : [esp32s3.cpu0] Core was reset.
Info : [esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Debug controller was reset.
Info : [esp32s3.cpu1] Core was reset.
Info : [esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
Info : [esp32s3.cpu1] Reset cause (3) - (Software core reset)
Info : [esp32s3.cpu0] Reset cause (3) - (Software core reset)
终端2:
Code: Select all
~/work/code/examples/get-started/blink$ xtensa-esp32s3-elf-gdb -q -x build/gdbinit/symbols -x build/gdbinit/prefix_map -x build/gdbinit/connect build/blink.elf
Reading symbols from build/blink.elf...
add symbol table from file "/home/duan/work/code/examples/get-started/blink/build/bootloader/bootloader.elf"
0x500000ef in ?? ()
add symbol table from file "/home/duan/.espressif/tools/esp-rom-elfs/20240305/esp32s3_rev0_rom.elf"
JTAG tap: esp32s3.tap0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32s3.tap1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
[esp32s3.cpu0] requesting target halt and executing a soft reset
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Reset cause (3) - (Software core reset)
[esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Reset cause (3) - (Software core reset)
[esp32s3.cpu0] Reset cause (3) - (Software core reset)
Hardware assisted breakpoint 1 at 0x42009188: file ../main/blink_example_main.c, line 92.
vscode 工程使用默认配置:
Code: Select all
duan@duan-ThinkCentre-M72e:~/work/code/examples/get-started/blink$ ls .vscode/
settings.json
duan@duan-ThinkCentre-M72e:~/work/code/examples/get-started/blink$ cat .vscode/settings.json
{
"idf.customExtraVars": {
"IDF_TARGET": "esp32s3"
},
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
]
}d