|
程序内容如下 / CMSIS compiler specific defines / ifndef __ASMdefine ASM asmendif/ CMSIS compiler specific defines / 编译报错日志需要如何解决 ../Drivers/CMSIS/Include/cmsis_armcc.h:58:50: error: expected identifier or '(' before '__asm' 58 | #define ASM asm | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:211:57: note: in expansion of macro '__ASM' 211 | attribute((section(".rev16_text"))) STATIC_INLINE __ASM uint32_t REV16(uint32_t value) | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:58:50: error: expected identifier or '(' before '__asm' 58 | #define ASM asm | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:226:57: note: in expansion of macro '__ASM' 226 | attribute((section(".revsh_text"))) STATIC_INLINE __ASM int16_t REVSH(int16_t value) | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:58:50: error: expected identifier or '(' before '__asm' 58 | #define ASM asm | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:413:55: note: in expansion of macro '__ASM' 413 | attribute((section(".rrx_text"))) STATIC_INLINE __ASM uint32_t RRX(uint32_t value) | ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__set_CONTROL': ../Drivers/CMSIS/Include/cmsis_armcc.h:178:43: warning: implicit declaration of function '__isb' [-Wimplicit-function-declaration] 178 | #define ISB() isb(0xF) | ^~~~~ |
ai部署
STM32F407VET6匹配的32.768KHz晶振有什么要求么?
翻找出来一块老板子
STM32H5F/E 相比 STM32F4 系列最大的优势是什么?
STM32F429 跑起来了
寻求 资源互换
stm32 f411偶发性无法启动大神求助
在擦除flash时 同时挂起中断 是否会造成卡死以及相关的卡死机制
STM32F407VET6,使用cubeIDE下载跑不起来
FLASH擦除轮询等待时CPU真的会轮询吗
微信公众号
手机版
去年宏定义字符中间的空格,改成如下试试:
ifndef __ASM
define __ASM
......
endif
<br /> <br />
谢谢 这样试了不行
../Drivers/CMSIS/Include/cmsis_armcc.h:57:2: error: invalid preprocessing directive #ifndef__ASM
57 | #ifndef__ASM
| ^
~~../Drivers/CMSIS/Include/cmsis_armcc.h:58:4: error: invalid preprocessing directive #define__ASM58 | #defineASM asm
| ^
~~../Drivers/CMSIS/Include/cmsis_armcc.h:211:57: error: unknown type name '__ASM'211 | attribute((section(".rev16_text"))) STATIC_INLINE __ASM uint32_t REV16(uint32_t value)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:211:72: error: expected '=', ',', ';', 'asm' or 'attribute' before '__REV16'
211 | attribute((section(".rev16_text"))) STATIC_INLINE __ASM uint32_t REV16(uint32_t value)
| ^
~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:226:57: error: unknown type name '__ASM'226 | attribute((section(".revsh_text"))) STATIC_INLINE __ASM int16_t REVSH(int16_t value)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:226:71: error: expected '=', ',', ';', 'asm' or 'attribute' before '__REVSH'
226 | attribute((section(".revsh_text"))) STATIC_INLINE __ASM int16_t REVSH(int16_t value)
| ^
~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:413:55: error: unknown type name '__ASM'413 | attribute((section(".rrx_text"))) STATIC_INLINE __ASM uint32_t RRX(uint32_t value)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:413:70: error: expected '=', ',', ';', 'asm' or 'attribute' before '__RRX'
413 | attribute((section(".rrx_text"))) STATIC_INLINE __ASM uint32_t RRX(uint32_t value)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_CONTROL':
../Drivers/CMSIS/Include/cmsis_armcc.h:560:42: error: expected '=', ',', ';', 'asm' or 'attribute' before '__ASM'
560 | register uint32_t regControl ASM("control");
| ^~~~~
宏定义命令与字符之间至少需要一个空格,字符内部不能有空格。
ifndef的判断字符要与后一句的字符相同,否则容易出现重定义的错误。
您的判断字符是"__ASM",而之后定义的却是 "ASM asm",这样前面的判断语句就失去了作用。
define ASM asm的意思是定义一个宏"ASM",其值为"asm"。您确定是要这样做吗?
建议复制下列代码:
<br /> <br />
你好
代码如下 还是一样报错
谢谢
ifndef __ASM
define ASM asm
endif
<br /> <br />
改成这样会多出来其他的很多报错
谢谢
../Drivers/CMSIS/Include/cmsis_armcc.h:212:3: error: unknown type name 'rev16'
212 | rev16 r0, r0
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:213:3: error: expected '=', ',', ';', 'asm' or 'attribute' before 'bx'
213 | bx lr
| ^~ ../Drivers/CMSIS/Include/cmsis_armcc.h:225:71: error: invalid storage class for function '__REVSH'
225 | attribute((section(".revsh_text"))) STATIC_INLINE __ASM int16_t REVSH(int16_t value)
| ^
~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__REVSH':../Drivers/CMSIS/Include/cmsis_armcc.h:227:3: error: unknown type name 'revsh'
227 | revsh r0, r0
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:228:3: error: expected '=', ',', ';', 'asm' or 'attribute' before 'bx'
228 | bx lr
| ^~ ../Drivers/CMSIS/Include/cmsis_armcc.h:412:70: error: invalid storage class for function '__RRX'
412 | attribute((section(".rrx_text"))) STATIC_INLINE __ASM uint32_t RRX(uint32_t value)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__RRX':
../Drivers/CMSIS/Include/cmsis_armcc.h:414:3: error: unknown type name 'rrx'
414 | rrx r0, r0
| ^~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:415:3: error: expected '=', ',', ';', 'asm' or 'attribute' before 'bx'
415 | bx lr
| ^~ ../Drivers/CMSIS/Include/cmsis_armcc.h:557:26: error: invalid storage class for function '__get_CONTROL'
557 | STATIC_INLINE uint32_t get_CONTROL(void)
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_CONTROL':../Drivers/CMSIS/Include/cmsis_armcc.h:559:48: error: expected declaration specifiers or '...' before string constant
559 | register uint32_t regControl ASM("control");
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:560:10: error: '__regControl' undeclared (first use in this function)560 | return(__regControl);
| ^
~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:560:10: note: each undeclared identifier is reported only once for each function it appears in../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__RRX':
../Drivers/CMSIS/Include/cmsis_armcc.h:569:22: error: invalid storage class for function '__set_CONTROL'
569 | __STATIC_INLINE void __set_CONTROL(uint32_t control)
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__set_CONTROL':../Drivers/CMSIS/Include/cmsis_armcc.h:571:48: error: expected declaration specifiers or '...' before string constant
571 | register uint32_t regControl ASM("control");
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:572:3: error: '__regControl' undeclared (first use in this function)572 | __regControl = control;
| ^
~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:177:43: warning: implicit declaration of function '__isb' [-Wimplicit-function-declaration]177 | #define ISB() isb(0xF)
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h:573:3: note: in expansion of macro '__ISB'
573 | __ISB();
| ^~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__RRX':
../Drivers/CMSIS/Include/cmsis_armcc.h:582:26: error: invalid storage class for function '__get_IPSR'
582 | STATIC_INLINE uint32_t get_IPSR(void)
| ^
~~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_IPSR':../Drivers/CMSIS/Include/cmsis_armcc.h:584:46: error: expected declaration specifiers or '...' before string constant
584 | register uint32_t regIPSR ASM("ipsr");
| ^
~../Drivers/CMSIS/Include/cmsis_armcc.h:585:10: error: 'regIPSR' undeclared (first use in this function); did you mean 'get_IPSR'?585 | return(__regIPSR);
| ^
~~~~| get_IPSR ../Drivers/CMSIS/Include/cmsis_armcc.h: In function 'RRX':
../Drivers/CMSIS/Include/cmsis_armcc.h:594:26: error: invalid storage class for function '__get_APSR'
594 | STATIC_INLINE uint32_t get_APSR(void)
| ^
~~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_APSR':../Drivers/CMSIS/Include/cmsis_armcc.h:596:46: error: expected declaration specifiers or '...' before string constant
596 | register uint32_t regAPSR ASM("apsr");
| ^
~../Drivers/CMSIS/Include/cmsis_armcc.h:597:10: error: 'regAPSR' undeclared (first use in this function); did you mean 'get_APSR'?597 | return(__regAPSR);
| ^
~~~~| get_APSR ../Drivers/CMSIS/Include/cmsis_armcc.h: In function 'RRX':
../Drivers/CMSIS/Include/cmsis_armcc.h:606:26: error: invalid storage class for function '__get_xPSR'
606 | STATIC_INLINE uint32_t get_xPSR(void)
| ^
~~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_xPSR':../Drivers/CMSIS/Include/cmsis_armcc.h:608:46: error: expected declaration specifiers or '...' before string constant
608 | register uint32_t regXPSR ASM("xpsr");
| ^
~../Drivers/CMSIS/Include/cmsis_armcc.h:609:10: error: '__regXPSR' undeclared (first use in this function)609 | return(__regXPSR);
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__RRX':../Drivers/CMSIS/Include/cmsis_armcc.h:618:26: error: invalid storage class for function '__get_PSP'
618 | STATIC_INLINE uint32_t get_PSP(void)
| ^
~~~~ ../Drivers/CMSIS/Include/cmsis_armcc.h: In function '__get_PSP':../Drivers/CMSIS/Include/cmsis_armcc.h:620:53: error: expected declaration specifiers or '...' before string constant
620 | register uint32_t regProcessStackPointer ASM("psp");
| ^~~~~
这些报错与宏定义关系不大,需要针对相应出错的代码进行检查,尤其是需要在IDE平台检查相应的文件路径是否包含了。宏定义是没有再报错了。
<br /> <br />
这么改不太对 换成iar没这个报错