1、重定义错误
d:/software_code/embedded/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/main.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: multiple definition of `tfont24'; CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/freertos.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: first defined here
d:/software_code/embedded/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/stm32f4xx_hal_msp.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: multiple definition of `tfont24'; CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/freertos.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: first defined here
d:/software_code/embedded/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/stm32f4xx_it.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: multiple definition of `tfont24'; CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/freertos.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: first defined here
d:/software_code/embedded/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/usart.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: multiple definition of `tfont24'; CMakeFiles/F4_FreeRTOS_demo.elf.dir/Core/Src/freertos.c.obj:D:\software_code\Embedded\blushless\F4_FreeRTOS_demo\Peripheral/lcd_font.h:433: first defined here
d:/software_code/embedded/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.
解决方法在函数前面加上静态声明。

2、程序卡死在if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

解决方法:
查看cubemx的设置,使用了外部晶振但是是否把HSE设置为旁路晶振,以下为正确设置:


文章主要讨论了在STM32项目中遇到的两个技术问题:一是由于头文件包含导致的重定义错误,解决方法是在函数前添加静态声明;二是程序在HAL_RCC_OscConfig配置时卡死,解决办法是检查Cubemx设置,确保外部晶振未被错误设置为旁路模式。
866

被折叠的 条评论
为什么被折叠?



