工程转换:遇到core_cm3版本过低等问题

不做任何变化,直接都用iar7.4加载相应的文件,报错如下:
Error[Pe147]: declaration is incompatible with "__nounwind __interwork __softfp unsigned long __get_PSP(void)"  F:\QPBOC认证\QPBOC_L2........\Source\CMSIS\Core\CM3\core_cm3\core_cm3.h 667 

分析:core_cm3.c 文件版本过低 。查看一下 keil工程之前使用的是1.20的版本。而iar7.4使用的是4.00的。core_cm3.c 文件低版本中的一些函数已经被去掉了,所以报错。
解决方法:
step1: 去掉core_cm3.c 文件和core_cm3.h 文件。

step2: option->c/c++ Compiler ->preprocessor中的additional include directories:中core_cm3文件的路径去掉。
step3: General Options ->Library Configuration ->CMSIS   把Use CMSIS 勾上。

编译后出现新的错误如下:
Error[Pe077]: this declaration has no storage class or type specifier F:\......\Source\SelfLib\icc\iccard_hal.h 178 

错误原因是:__inline 的问题,在整个工程搜索__inline发现iar7.4 自带的core_cm3.h文件与 老版本不同新的定义如下:

#if   defined ( __CC_ARM )
  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
  #define __STATIC_INLINE  static __inline
#elif defined ( __GNUC__ )
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
  #define __STATIC_INLINE  static inline
#elif defined ( __ICCARM__ )
  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
  #define __STATIC_INLINE  static inline
#elif defined ( __TMS470__ )
  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler       */
  #define __STATIC_INLINE  static inline
#elif defined ( __TASKING__ )
  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
  #define __STATIC_INLINE  static inline
#elif defined ( __CSMC__ )
  #define __packed
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler      */
  #define __INLINE         inline                                    /*use -pc99 on compile line !< inline keyword for COSMIC Compiler   */
  #define __STATIC_INLINE  static inline
#endif

iar编译器使用的是  __ICCARM__这个define   所以把__inline改成inline

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值