我正在尝试使用新的微型探针调试 RP2040。 当我执行以下命令时
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
OpenOCD 可以正常工作。
我只需要在我的 launch.json 中添加 -c "adapter speed 5000" 就可以了。 我累了 "args": ["arg1", [arg2], ... ] 但它失败了,不考虑。
这是我的 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" for some previous builds
"gdbPath" : "gdb-multiarch",
//"gdbPath" : "arm-none-eabi-gdb",
"device": "RP2040",
"configFiles": [
// This may need to be "interface/picoprobe.cfg" for some previous builds
"interface/cmsis-dap.cfg",
"target/rp2040.cfg"
],
"preLaunchCommands": [
"adapter speed 5000"
],
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
"runToEntryPoint": "main",
// Work around for stopping at main on restart
"postRestartCommands": [
"break main",
"continue"
]
}
]
}
当我执行以下命令时
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
OpenOCD 可以正常工作。
我只需要在我的 launch.json 中添加 -c "adapter speed 5000" 就可以了。 我累了 "args": ["arg1", [arg2], ... ] 但它失败了,不考虑。
你要找的字段是
openOCDLaunchCommands
,取命令集合。
我通过在
configurations
块中开始一个新行并按 ctrl+space 调出自动完成菜单找到了这个。如果有人有文档链接,可以帮助以不太偶然的方式解决这个问题,请分享。
将此添加到
configurations
块
{
"version": "0.2.0",
"configurations": [
{
"name": "Pico Debug",
"cwd": "${workspaceRoot}",
...
"openOCDLaunchCommands": [
"adapter speed 5000"
]
}
]
}
非常感谢,这解决了我的问题