前提条件west debug能正常工作,如果不能的话,请参考官方文档进行配置.
安装插件,大概下面这些.
cortex-debug
,C/C++
, Native Debug
,arm
配置cortex-debug
settings.json里面加上下面两行
{
"cortex-debug.armToolchainPath": "/opt/zephyr-sdk/arm-zephyr-eabi/bin/",
"cortex-debug.armToolchainPrefix": "arm-zephyr-eabi"
}
工程配置
下面这些参考了github,各种文档汇总而成.
launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"executable": "${workspaceFolder}/build/zephyr/zephyr.elf",
"name": "stm32f746g-discovery",
"device": "STM32F746NG",
"configFiles": [
"${workspaceFolder}/boards/arm/stm32f746g_disco/support/openocd.cfg"
]
}
]
}
c_cpp_properties.json
{
"env": {
"myZephyrSourcePath": "/home/feilong/workspace/zephyrproject/zephyr/",
"myZephyrSDKPath": "/opt/zephyr-sdk"
},
"configurations": [
{
"name": "Linux",
"includePath": [
"${myZephyrSourcePath}/include/",
"${myZephyrSourcePath}/lib/libc/minimal/include/",
"${myZephyrSourcePath}/arch/arm/include/",
"${myZephyrSourcePath}/build/zephyr/include/generated/"
],
"compilerPath": "${myZephyrSDKPath}/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
west build之后f5就可以了.