【发布时间】:2022-12-18 12:24:11
【问题描述】:
我正在尝试使用 picoprobe 从 vscode 调试 raspberry pi pico。在经历了很多痛苦之后,我设法让所有东西都从 msys2 mingw64 shell 运行(我在那个 shell 中构建了 openocd)。但是,从 vscode 进行调试会导致弹出窗口显示OpenOCD:GDB 服务器意外退出.我的调试控制台读取
Cortex-Debug: VSCode debugger extension version 1.6.7 git(b0f5563). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from arm-none-eabi-objdump --syms -C -h -w C:/VSARM/sdk/pico/pico-examples/build/blink/blink.elf
Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p C:/VSARM/sdk/pico/pico-examples/build/blink/blink.elf
Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2
1-gdb-version
Launching gdb-server: "C:/VSARM/debug_tools/openocd/src/openocd.exe" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "C:V/SARM/debug_tools/openocd/tcl" -f "c:/Users/micha/.vscode/extensions/marus25.cortex-debug-1.6.7/support/openocd-helpers.tcl" -f interface/cmsis-dap.cfg -f target/rp2040.cfg
Please check TERMINAL tab (gdb-server) for output from C:/VSARM/debug_tools/openocd/src/openocd.exe
Finished reading symbols from objdump: Time: 86 ms
Finished reading symbols from nm: Time: 115 ms
OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.
我的终端(在 vscode 设置中设置为 msys2 mingw64 终端)读取
[2022-12-05T14:08:43.239Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:/VSARM/debug_tools/openocd/src/openocd.exe" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "C:V/SARM/debug_tools/openocd/tcl" -f "c:/Users/micha/.vscode/extensions/marus25.cortex-debug-1.6.7/support/openocd-helpers.tcl" -f interface/cmsis-dap.cfg -f target/rp2040.cfg
[2022-12-05T14:08:43.310Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
我的 launch.json 是
{
"version": "0.2.0",
"configurations": [
{
"name": "Pico Debug",
"cwd": "${workspaceRoot}",
"executable": "${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
// This may need to be arm-none-eabi-gdb depending on your system
"gdbPath" : "arm-none-eabi-gdb",
"device": "RP2040",
"configFiles": [
"interface/cmsis-dap.cfg",
"target/rp2040.cfg"
],
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
"runToMain": true,
// Work around for stopping at main on restart
"postRestartCommands": [
"break main",
"continue"
],
"searchDir": ["C:/VSARM/debug_tools/openocd/tcl"],
"showDevDebugOutput": "raw",
}
]
}
有人看到我的设置有误吗?
目前,我最好的猜测是存在某种依赖性,仅在 msys2 mingw64 中满足,而在终端(windows power shell?)中不满足,vscode 用于运行 gdb/openocd 服务器。
有人知道我如何强制 vscode(或 cortex-debug 扩展)使用 msys2 mingw64 shell 来运行 openocd 吗?
我看到的另一种可能的解决方案/解决方法是在 msys2 mingw64 中手动启动 openocd 服务器。然后我可以从 vscode 连接到 openocd 服务器。有人知道我是否以及如何做到这一点吗?我只找到了 vscode 启动 gdb 和 openocd 服务器的解决方案。
谢谢您的帮助。
【问题讨论】:
标签: visual-studio-code gdb vscode-debugger raspberry-pi-pico openocd