未找到 OpenOCD GDB 可执行文件 "arm-none-eabi-gdb"。请正确配置"cortex-debug.armToolchainPath"

OpenOCD GDB executable "arm-none-eabi-gdb" was not found. Please configure "cortex-debug.armToolchainPath" correctly

我正在使用 Raspberry Pico 并尝试在 Raspberry Pi 4 上使用来自 VSCode 的 VS Code 中的调试工具,但我收到以下错误:

OpenOCD GDB executable "arm-none-eabi-gdb" was not found. Please configure "cortex-debug.armToolchainPath" correctly.

我对 launch.json

进行了以下配置
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "TempSensor",
            "cwd": "${workspaceRoot}",
            "executable": "/home/pi/pico/devices/build/tempSensor/tempSensor.elf",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            // This may need to be arm-none-eabi-gdb depending on your system
            "gdbpath": "gdb-multiarch",
            "device": "RP2040",
            "configFiles": [
                "interface/raspberrypi-swd.cfg",
                "target/rp2040.cfg"
            ],
            "svdFile": "/home/pi/pico/pico-sdk/src/rp2040/hardware_regs/rp2040.svd",
            "runToMain": true,
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ]
        }
    ]
}

和下面的代码 settings.json

{
    // These settings tweaks to the cmake plugin will ensure
    // that you debug using cortex-debug instead of trying to launch
    // a Pico binary on the host
    "cmake.statusbar.advanced": {
        "debug": {
            "visibility": "hidden"
        },
        "launch": {
            "visibility": "hidden"
        }
    },
    "cmake.buildBeforeRun": true,
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "cmake.configureOnOpen": false
}

文档中最近有一个修复程序。

如本 link 中所述:https://github.com/raspberrypi/pico-examples/issues/8

按照入门指南中的说明设置 Raspberry Pi 时,启动调试器时会出现两个问题:

在 launch.json 中设置“gdbpath”被标记为不允许 启动时忽略设置,使用arm-none-eabi-gdb,不可用 好像设置"cortex-debug.gdbpath"只能设置在settings.json

所以删除。

"gdbpath" : "gdb-multiarch" from launch.json 并添加 "cortex-debug.gdbPath": "gdb-multiarch" to settings.json.