尝试cmake编译开始

This commit is contained in:
hold the blade 2026-03-05 00:02:57 +08:00
parent f405fc63bc
commit 5196fff078
8 changed files with 230 additions and 1 deletions

11
.clangd Normal file
View File

@ -0,0 +1,11 @@
CompileFlags:
Add:
- '-ferror-limit=0'
- '-Wno-implicit-int'
CompilationDatabase: build/Debug
Diagnostics:
Suppress:
- unused-includes
- unknown_typename
- unknown_typename_suggest
- typename_requires_specqual

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build
mx.scratch
!.settings

View File

@ -0,0 +1,158 @@
{
"resolved": [
{
"name": "cmake",
"version": "4.0.1+st.3",
"platform": "darwin",
"selected_by": [
{
"name": "cmake",
"version": "4.0.1+st.3"
}
]
},
{
"name": "cmake",
"version": "4.0.1+st.3",
"platform": "x86_64-linux",
"selected_by": [
{
"name": "cmake",
"version": "4.0.1+st.3"
}
]
},
{
"name": "cmake",
"version": "4.0.1+st.3",
"platform": "x86_64-windows",
"selected_by": [
{
"name": "cmake",
"version": "4.0.1+st.3"
}
]
},
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2",
"platform": "aarch64-darwin",
"selected_by": [
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2"
}
]
},
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2",
"platform": "x86_64-darwin",
"selected_by": [
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2"
}
]
},
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2",
"platform": "x86_64-linux",
"selected_by": [
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2"
}
]
},
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2",
"platform": "x86_64-windows",
"selected_by": [
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2"
}
]
},
{
"name": "gnu-tools-for-stm32-14_3_1-description",
"version": "1.0.1+st.1",
"platform": "all",
"selected_by": [
{
"name": "gnu-tools-for-stm32-14_3_1-description",
"version": ">=0.0.1"
}
]
},
{
"name": "ninja",
"version": "1.13.1+st.1",
"platform": "darwin",
"selected_by": [
{
"name": "ninja",
"version": "1.13.1+st.1"
}
]
},
{
"name": "ninja",
"version": "1.13.1+st.1",
"platform": "x86_64-linux",
"selected_by": [
{
"name": "ninja",
"version": "1.13.1+st.1"
}
]
},
{
"name": "ninja",
"version": "1.13.1+st.1",
"platform": "x86_64-windows",
"selected_by": [
{
"name": "ninja",
"version": "1.13.1+st.1"
}
]
},
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3",
"platform": "darwin",
"selected_by": [
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3"
}
]
},
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3",
"platform": "x86_64-linux",
"selected_by": [
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3"
}
]
},
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3",
"platform": "x86_64-windows",
"selected_by": [
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"bundles": [
{
"name": "cmake",
"version": "4.0.1+st.3"
},
{
"name": "ninja",
"version": "1.13.1+st.1"
},
{
"name": "gnu-tools-for-stm32",
"version": "14.3.1+st.2"
},
{
"name": "st-arm-clangd",
"version": "19.1.2+st.3"
}
]
}

6
.settings/ide.store.json Normal file
View File

@ -0,0 +1,6 @@
{
"device": "STM32F103C8T6",
"core": "Cortex-M3",
"order": 0,
"toolchain": "GCC"
}

8
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"configurations": [
{
"name": "STM32",
"compileCommands": "${workspaceFolder}/build/Debug/compile_commands.json"
}
]
}

15
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
"cmake.cmakePath": "cube-cmake",
"cmake.configureArgs": [
"-DCMAKE_COMMAND=cube-cmake"
],
"cmake.preferredGenerators": [
"Ninja"
],
"stm32cube-ide-clangd.path": "cube",
"stm32cube-ide-clangd.arguments": [
"starm-clangd",
"--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/14.3.1+st.2/bin/arm-none-eabi-gcc.exe",
"--query-driver=${env:CUBE_BUNDLE_PATH}/gnu-tools-for-stm32/14.3.1+st.2/bin/arm-none-eabi-g++.exe"
]
}

View File

@ -19,6 +19,8 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "main.h" #include "main.h"
#include "spi.h" #include "spi.h"
#include "stm32f1xx_hal.h"
#include "stm32f1xx_hal_conf.h"
#include "usart.h" #include "usart.h"
#include "gpio.h" #include "gpio.h"
@ -92,13 +94,19 @@ int main(void)
MX_USART1_UART_Init(); MX_USART1_UART_Init();
MX_USART2_UART_Init(); MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
char uart_tx_buffer[] = "helloworld";
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Infinite loop */ /* Infinite loop */
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) while (1)
{ {
HAL_UART_Transmit(&huart1, uart_tx_buffer, sizeof(uart_tx_buffer), HAL_MAX_DELAY);
HAL_Delay(500);
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */