在使用keil编码STM32的时候,由于选错了编译器的版本,导致编译报了一大堆错误。错误的内容很多,摘取一部分贴出来,如下:
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB() { __ASM volatile ("dsb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
compiling stm32f10x_adc.c...
warning: unknown warning option '-Wno-reserved-identifier'; did you mean '-Wno-reserved-id-macro'? [-Wunknown-warning-option]
../Library/src/stm32f10x_cec.c(23): warning: In file included from...
../Library/inc\stm32f10x_cec.h(32): warning: In file included from...
../System\stm32f10x.h(478): warning: In file included from...
../System/core_cm3.h(1204): error: unknown type name 'inline'
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB() { __ASM volatile ("dsb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
compiling stm32f10x_cec.c...
warning: unknown warning option '-Wno-reserved-identifier'; did you mean '-Wno-reserved-id-macro'? [-Wunknown-warning-option]
../Library/src/stm32f10x_can.c(23): warning: In file included from...
../Library/inc\stm32f10x_can.h(32): warning: In file included from...
../System\stm32f10x.h(478): warning: In file included from...
../System/core_cm3.h(1204): error: unknown type name 'inline'
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1204): error: expected identifier or '('
static __INLINE void __enable_irq() { __ASM volatile ("cpsie i"); }
^
../System/core_cm3.h(1205): error: unknown type name 'inline'
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1205): error: expected identifier or '('
static __INLINE void __disable_irq() { __ASM volatile ("cpsid i"); }
^
../System/core_cm3.h(1207): error: unknown type name 'inline'
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1207): error: expected identifier or '('
static __INLINE void __enable_fault_irq() { __ASM volatile ("cpsie f"); }
^
../System/core_cm3.h(1208): error: unknown type name 'inline'
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1208): error: expected identifier or '('
static __INLINE void __disable_fault_irq() { __ASM volatile ("cpsid f"); }
^
../System/core_cm3.h(1210): error: unknown type name 'inline'
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1210): error: expected identifier or '('
static __INLINE void __NOP() { __ASM volatile ("nop"); }
^
../System/core_cm3.h(1211): error: unknown type name 'inline'
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1211): error: expected identifier or '('
static __INLINE void __WFI() { __ASM volatile ("wfi"); }
^
../System/core_cm3.h(1212): error: unknown type name 'inline'
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1212): error: expected identifier or '('
static __INLINE void __WFE() { __ASM volatile ("wfe"); }
^
../System/core_cm3.h(1213): error: unknown type name 'inline'
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1213): error: expected identifier or '('
static __INLINE void __SEV() { __ASM volatile ("sev"); }
^
../System/core_cm3.h(1214): error: unknown type name 'inline'
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
^
../System/core_cm3.h(1214): error: expected identifier or '('
static __INLINE void __ISB() { __ASM volatile ("isb"); }
^
../System/core_cm3.h(1215): error: unknown type name 'inline'
static __INLINE void __DSB() { __ASM volatile ("dsb"); }
^
../System/core_cm3.h(751): note: expanded from macro '__INLINE'
#define __INLINE inline /*!< inline keyword for GNU Compiler */
出现这个问题,大概率是keil使用了编译器V6的版本了。
解决版本是如果没有安装V5版本,就安装一个V5版本的,如果V5和V6都安装了,那么就选择一下V5版本,重新编译就好了。
如果没有V5版本,就到官网下载一个V5版本的。我下载的是MDK526.EXE。