从Keil软件转战STM32CubeIDE,转换的过程中遇到了不少问题,在此记录一下,防止以后再踩坑.也给同样有转软件需求的朋友做个参考吧~
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Library/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.o: in function `HAL_MspInit':
D:/workspace/MPT-I/Library/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.c:52: multiple definition of `HAL_MspInit'; ./HardwareDriverLayer/stm32f4xx_hal_msp.o:D:/workspace/MPT-I/HardwareDriverLayer/stm32f4xx_hal_msp.c:65: first defined here
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Library/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.o: in function `HAL_RTC_AlarmAEventCallback':
D:/workspace/MPT-I/Library/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_timebase_rtc_alarm_template.c:252: multiple definition of `HAL_RTC_AlarmAEventCallback'; ./HardwareDriverLayer/HAL_Driver/drv_rtc.o:D:/workspace/MPT-I/HardwareDriverLayer/HAL_Driver/drv_rtc.c:219: first defined here
HAL库提供的模板文件和我们的应用文件冲突导致重复定义


右击工程名->Properties->C/C++ General->Source Location处添加源文件路径(每次新增源文件文件夹需要在此处添加)

原因在于:
typedef CPU_STK __attribute__((aligned(8))) CPU_STK_8BYTE_ALIGNED;
Keil,VS Code等支持8字节对齐, #pragma pack(8),gcc 默认是4字节对齐,且只支持1,2,4字节对齐, #pragma pack(4).
修改如下:
typedef CPU_STK __attribute__((aligned(4))) CPU_STK_8BYTE_ALIGNED;
可以通过scanf和sprintf进行浮点数操作

选择编译器的语法标准,这里我们选用常用的C99标准

解决STMCube IDE 字母与汉字大小显示不一致的问题:

…持续更新…