c_cpp_properties的配置
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"F:/GCC/9 2020-q2-update/arm-none-eabi/include",
"F:/GCC/9 2020-q2-update/lib/gcc/arm-none-eabi/9.3.1/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"__CC_ARM",
"USE_HAL_DRIVER",
"STM32F103xE" //看makefile文件的# C defines确定
],
"intelliSenseMode": "msvc-x64",
"cStandard": "c99"
}
],
"version": 4
}
launch的配置
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Cortex Debug",
"type": "cortex-debug",
"request": "launch",
"executable": "./build/TEST_TODE.elf", //elf文件看当前工程名称或是看build文件夹下的elf文件名称
"cwd": "${workspaceRoot}",
"servertype": "openocd",
"device":"STM32F103ZE", //当前芯片型号
"interface":"swd",
"configFiles":[
"F:/openocd-0.10.0/scripts/interface/stlink-v2.cfg", //使用ST-LINK
"F:/openocd-0.10.0/scripts/target/stm32f1x.cfg", //根据芯片型号更改/stm32f1x.cfg
]
}
]
}
以上两文件的使用
.vscode文件也可使用于STM32的其他芯片,但需要修改
(1)launch文件中executable后的elf文件要改为当前文件的名字
(2)launch文件中的device要改为当前芯片型号
(3)launch文件中configFile下stm32f1x.cfg改为当前型号
(4)c_cpp_properties中的STM32F103xE要根据makefile中 C defines修改
插入c文件和h文件
在要插入的文件夹上点击右键直接“新建文件”,然后命名时写上后缀.c和.h。
若是出现自己添加的头文件可以使用,且能转到该函数定义处,但是编译却未找到该函数的问题,原因是未能编译到所写的.c文件。在makefile文件的源文件# C sources添加自己写的.c文件即可,如
Src/uartdata.c
记得在上一行末尾加上Tab+\,否则会出现“ *** 遗漏分隔符 。 停止。”的错误。效果如下
Src/system_stm32f1xx.c \