一、烧录配置
1.1 OpenOcd
{
"version": "2.0.0",
"tasks": [
{
"label": "Flash",
"type": "shell",
"command": "openocd",
"args": [
"-s", "D:\\Tools\\OpenOCD\\xpack-openocd-0.11.0-3\\scripts",
"-f", "E:\\code\\HammerFirmware\\gd32h7xx.cfg",
"-c", "tcl_port disabled",
"-c", "gdb_port disabled",
"-c", "program \"E:\\\\code\\\\HammerFirmware\\\\build\\\\HammerFirmware.elf\"",
"-c", "reset",
"-c", "shutdown"
],
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": []
}
]
}
1.2 openocd
1.3 stlink
二、在线调试launch.json
2.1 Stm32Cube套件
{
"version": "0.2.0",
"configurations": [
{
"name": "gdbtest",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/zephyr/zephyr.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"debugServerPath": "/opt/st/stm32cubeide_1.2.0/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64_1.1.0.201910081157/tools/bin/ST-LINK_gdbserver",
"debugServerArgs":"-d -v -cp /opt/st/stm32cubeide_1.2.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.1.0.201910081157/tools/bin/",
"miDebuggerPath": "/usr/local/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
"miDebuggerServerAddress": "localhost:61234"
}
]
}
2.2 openocd
{
"version": "0.2.0",
"configurations": [
{
"name": "gdbtest",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/HammerFirmware.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
// "debugServerPath": "/opt/st/stm32cubeide_1.2.0/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64_1.1.0.201910081157/tools/bin/ST-LINK_gdbserver",
// "debugServerArgs":"-d -v -cp /opt/st/stm32cubeide_1.2.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_1.1.0.201910081157/tools/bin/",
"debugServerPath": "openocd",
"debugServerArgs": "-s \"D:/Tools/OpenOCD/xpack-openocd-0.11.0-3/scripts\" -f \"E:/code/HammerFirmware/gd32h7xx.cfg\"",
"miDebuggerPath": "arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:3333",
"filterStderr": true, // 为什么这条对启动openocd 的degug至关重要
}
]
}