Ubuntu下vscode cmake jlink stm32 开发环境搭建
安装gcc-arm-none-eabi JLink或者stm32cubeide自带前面两者
安装vscode 扩展 CMake Tools Cortex-Debug
修复vscode爆红
.vscode/c_cpp_properties.json
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "STM32F103xB" ], "compilerPath": "/usr/bin/arm-none-eabi-gcc", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "gcc-arm" } ], "version": 4 }
修改默认CMake Generator
项目根目录下CMakePresets.json
{ "version": 3, "configurePresets": [ { "name": "default", "hidden": true, "generator": "Unix Makefiles", "binaryDir": "${sourceDir}/build/${presetName}", "toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake", "cacheVariables": { } },