【发布时间】:2020-02-17 04:17:58
【问题描述】:
launch.json
...
"preLaunchTask": "startDebug",
"postDebugTask": "closeOpenOCDTerminal"
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "startDebug",
"type": "shell",
"command": "make -j4; openocd -f interface/cmsis-dap.cfg -c 'transport select swd' -f target/stm32f1x.cfg",
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "."
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
},
{
"label": "closeOpenOCDTerminal",
"type": "process",
"command":[
"${command:workbench.action.tasks.terminate}",
// "${command:workbench.action.acceptSelectedQuickOpenItem}" //invalid
]
}
]
}
OpenOCD服务不会像make命令那样自动结束,只需要关闭终端或者执行Ctrl+C即可。 调试后如何自动关闭任务终端? 或者在任务终端自动执行Ctrl+C命令,结束Openocd服务。 目前使用的closeOpenOCDTerminal方法需要手动点击弹出列表。
【问题讨论】:
-
您的
startDebug在launch.json 或tasks.json 中吗?不应该在launch.json中吗?
标签: c