工程转换:遇到跟中问题

来源:互联网 发布:b2b网站发布软件 编辑:程序博客网 时间:2024/06/05 17:07

不做任何变化,直接都用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
原创粉丝点击