把stm32固件库替换过程中出现的问题

USE_STDPERIPH_DRIVER, STM32F10X_HD

compiling stm32f10x_usart.c...

.\CMSIS\stm32f10x.h(96): error:  #35: #error directive: "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:    #error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:     ^

.\CMSIS\stm32f10x.h: FWlib\src\stm32f10x_usart.c: 0 warnings, 1 error

compiling stm32f10x_wwdg.c...

.\CMSIS\stm32f10x.h(96): error:  #35: #error directive: "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:    #error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:     ^

.\CMSIS\stm32f10x.h: FWlib\src\stm32f10x_wwdg.c: 0 warnings, 1 error

compiling SetClock.c...

.\CMSIS\stm32f10x.h(96): error:  #35: #error directive: "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:    #error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"

.\CMSIS\stm32f10x.h:     ^

在这里添加 USE_STDPERIPH_DRIVER, STM32F10X_HD 问题解决

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(59): error:  #101: "DISABLE" has already been declared in the current scope

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                 ^

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(59): error:  #101: "ENABLE" has already been declared in the current scope

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                              ^

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(59): error:  #256: invalid redeclaration of type name "FunctionalState" (declared at line 521 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                                                 C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(23): error:  #256: invalid redeclaration of type name "s32" (declared at line 487 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef signed long  s32;

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                        ^

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(27): error:  #256: invalid redeclaration of type name "sc32" (declared at line 491 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef signed long  const sc32;  /* Read Only */

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                              ^

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(31): error:  #256: invalid redeclaration of type name "vs32" (declared at line 495 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef volatile signed long  vs32;

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                                 ^

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(35): error:  #256: invalid redeclaration of type name "vsc32" (declared at line 499 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef volatile signed long  const vsc32;  /* Read Only */

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:                                       

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h(39): error:  #256: invalid redeclaration of type name "u32" (declared at line 503 of ".\CMSIS\stm32f10x.h")

C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_type.h:   typedef unsigned long  u32;

#include "stm32f10x.h"    //#include "stm32f10x_lib.h"

stm32f10x.h文件中添加stm32f10x_conf.h,并且用 #include "stm32f10x.h"代替#include "stm32f10x_lib.h",问题解决。 

.\FWlib\inc\stm32f10x_adc.h(52): error:  #20: identifier "uint32_t" is undefined

.\FWlib\inc\stm32f10x_adc.h:     uint32_t ADC_Mode;                      /*!< Configures the ADC to operate in independent or

.\FWlib\inc\stm32f10x_adc.h:     ^

.\FWlib\inc\stm32f10x_adc.h(56): error:  #20: identifier "FunctionalState" is undefined

.\FWlib\inc\stm32f10x_adc.h:     FunctionalState ADC_ScanConvMode;       /*!< Specifies whether the conversion is performed in

.\FWlib\inc\stm32f10x_adc.h:     ^

.\FWlib\inc\stm32f10x_adc.h(60): error:  #20: identifier "FunctionalState" is undefined

.\FWlib\inc\stm32f10x_adc.h:     FunctionalState ADC_ContinuousConvMode; /*!< Specifies whether the conversion is performed in

.\FWlib\inc\stm32f10x_adc.h:     ^

.\FWlib\inc\stm32f10x_adc.h(64): error:  #20: identifier "uint32_t" is undefined

.\FWlib\inc\stm32f10x_adc.h:     uint32_t ADC_ExternalTrigConv;          /*!< Defines the external trigger used to start the analog

.\FWlib\inc\stm32f10x_adc.h:     ^

.\FWlib\inc\stm32f10x_adc.h(68): error:  #20: identifier "uint32_t" is undefined

stm32f10x_conf.h文件中添加#include <stdint.h > ,上面问题解决。

这类错误是 因为stm32函数库版本 不同引起的, #include "stm32f10x.h"相互替换#include "stm32f10x_lib.h",问题解决。 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值