关于低版本移植到高版本报错

发布于:2024-07-30 ⋅ 阅读:(140) ⋅ 点赞:(0)

Rebuild started: Project: RTC
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Users\Administrator\AppData\Local\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'RTC'
assembling startup_stm32f10x_md.s...
compiling misc.c...
..\..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c: 1 warning, 1 error
compiling stm32f10x_can.c...
..\..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h(298): error:  #67: expected a "}"

报这样的错误。

一时手足无措,百度一下。发现只要在项目设置中STM32F10X_HD去掉就行了,据说是已经包含了这个。先试试

c++这里有个,STM32F10X_HD,去掉。

然后编译正常。

研究了一下,这个STM32F10X_HD其实是个启动文件。

.s启动文件
  ST提供的3个启动文件,分别适用于不同容量的STM32芯片。
    这三个文件为: 
        startup_stm32f10x_ld.s
        startup_stm32f10x_md.s
        startup_stm32f10x_hd.s
    其中,ld.s适用于小容量 产品;md.s适用于中等容量产品;hd适用于大容量产品;
    这里的容量是指FLASH的大小.判断方法如下:
       小容量:FLASH≤32K
       中容量:64K≤FLASH≤128K
       大容量:256K≤FLASH
————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/ddidi111/article/details/139442942