安装vscode扩展vscode-embedded-tools
json文件中的 ${command:vscode-embedded.st.gdb}由扩展提供路径
launch.json 内容
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceFolder}",
"type": "cortex-debug",
"request": "launch",
"name": "openocd-stm32f407",
"servertype": "openocd",
"gdbPath": "${command:vscode-embedded.st.gdb}",
"executable": "${command:cmake.launchTargetPath}",
"runToEntryPoint": "main",
// "breakAfterReset": true,
"showDevDebugOutput": "none",
"preLaunchTask": "Build",
"configFiles": [
"interface/cmsis-dap.cfg",
"target/stm32f4x.cfg"
],
"svdFile": "${command:vscode-embedded.st.svd}/STM32F407.svd",
"liveWatch": { //运行查看全局和静态变量值
"enabled": true,
"samplesPerSecond": 1
}
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.launchTargetPath}",
"name": "PyOCD-stm32f407",
"request": "launch",
"type": "cortex-debug",
"gdbPath": "${command:vscode-embedded.st.gdb}",
"runToEntryPoint": "main",
"showDevDebugOutput": "none",
"servertype": "pyocd",
"svdPath": "${command:vscode-embedded.st.svd}/STM32F407.svd",
"targetId": "stm32f407ve",
"preLaunchTask": "Build",
// "breakAfterReset": true,
"debuggerArgs": [],
"liveWatch": {
"enabled": true,
"samplesPerSecond": 1
}
},
{
"name": "Launch",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.launchTargetPath}",
"MIMode": "gdb",
"miDebuggerPath": "${command:vscode-embedded.st.gdb}",
"miDebuggerServerAddress": "localhost:3333",
"debugServerPath": "${command:vscode-embedded.st.gdbserver}",
"debugServerArgs": "--stm32cubeprogrammer-path ${command:vscode-embedded.st.cubeprogrammer} --swd --port-number 3333",
"serverStarted": "Waiting for connection on port .*\\.\\.\\.",
"stopAtConnect": true,
"postRemoteConnectCommands": [
{
"text": "load build/release/build/T3_BMCP.elf"
}
],
"logging": {
"engineLogging": true
},
"preLaunchTask": "Build",
"svdPath": "${command:vscode-embedded.st.svd}/STM32F407.svd"
}
]
}
通过vcpkg来安装依赖工具,根目录创建文件vcpkg-configuration.json,内容如下
{
"registries": [
{
"name": "microsoft",
"kind": "artifact",
"location": "https://aka.ms/vcpkg-ce-default"
},
{
"name": "arm",
"kind": "artifact",
"location": "https://aka.ms/vcpkg-artifacts-arm"
}
],
"requires": {
"microsoft:tools/kitware/cmake": "^3.25.2",
"microsoft:tools/ninja-build/ninja": "^1.10.2",
"arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.0.0-0",
"arm:compilers/arm/armclang": "^6.20.0",
"microsoft:tools/microsoft/openocd": "*",
"arm:compilers/arm/arm-none-eabi-gcc": "*"
}
}

Comments | NOTHING