# stm32_std **Repository Path**: cui250384093/stm32_std ## Basic Information - **Project Name**: stm32_std - **Description**: CLion采用标准库 - **Primary Language**: C - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-09-23 - **Last Updated**: 2025-09-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. 芯片不同有些设备不支持 FMC外设 代码 stm32f4xx_fmc.h、stm32f4xx_fmc.c 在Libraries中分别删除 2.syscalls.c 、sysmem.c 在标准库中查询copy到文件中 3.标准库在CMakeLists.txt修改如下 include_directories(Core/Inc Libraries/Inc System/Inc User/Inc) file(GLOB_RECURSE SOURCES "Libraries/*.*" "System/*.*" "User/*.*" "Startup/*.*") add_definitions(-DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx) 查看 关于-DSTM32F40_41xxx的内容,可以到stm32f4xx.h中第61行的位置,根据自己芯片的型号来选择 如果不需要使用printf函数或者scanf函数请忽略这一段: add_link_options(-specs=nano.specs -u _printf_float -lm) 4.编译时候重复定义 为了向上兼容 /******************** Bit definition for DBGMCU_APB2_FZ register ************/ //#define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((uint32_t)0x00000001) //#define DBGMCU_APB2_FZ_DBG_TIM8_STOP ((uint32_t)0x00000002) //#define DBGMCU_APB2_FZ_DBG_TIM9_STOP ((uint32_t)0x00010000) //#define DBGMCU_APB2_FZ_DBG_TIM10_STOP ((uint32_t)0x00020000) //#define DBGMCU_APB2_FZ_DBG_TIM11_STOP ((uint32_t)0x00040000) 5. 修改stm32f4xx_it.c中 SysTick_Handler函数 void SysTick_Handler(void) { } 6.高级设置中勾选:为所有项目启用调试服务器 7.设置---》调试器--》调试服务器中新增st-link,SWD,8000kHz 8.晶振修改代码 stm32f4xx.h -->137行 #define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */ 改为 #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */ 9.修改 PLL 锁相环相关的参数 system_stm32f4xx.c -->364行 #define PLL_M 25 改为 #define PLL_M 8 jetbrains配置GDB配置 https://www.jetbrains.com/zh-cn/help/clion/2025.1/embedded-gdb-server.html#create_GDB_config