编译内置 asm 时出错
Eroror compiling builtin asm
我最近从 Keil Uvision 切换到我自己的 Makefile
我在编译文件 port.c 时遇到问题,
文件中的函数:
__asm void vPortSVCHandler( void )
{
PRESERVE8
/* Get the location of the current TCB. */
ldr r3, =pxCurrentTCB
ldr r1, [r3]
ldr r0, [r1]
/* Pop the core registers. */
ldmia r0!, {r4-r11, r14}
msr psp, r0
isb
mov r0, #0
msr basepri, r0
bx r14
}
编译时出现这些错误:
../port.c:52:7: error: expected '(' before 'void'
52 | __asm void vPortSVCHandler( void )
| ^~~~
| (
../port.c:64:13: error: stray '#' in program
64 | mov r0, #0
我是否缺少包含或编译器选项?
您使用 gcc
并且 gcc 没有“asm”函数。
你需要在汇编器中编写或者编写内联汇编。 __asm
也是无效的 gcc
关键字。
我最近从 Keil Uvision 切换到我自己的 Makefile 我在编译文件 port.c 时遇到问题, 文件中的函数:
__asm void vPortSVCHandler( void )
{
PRESERVE8
/* Get the location of the current TCB. */
ldr r3, =pxCurrentTCB
ldr r1, [r3]
ldr r0, [r1]
/* Pop the core registers. */
ldmia r0!, {r4-r11, r14}
msr psp, r0
isb
mov r0, #0
msr basepri, r0
bx r14
}
编译时出现这些错误:
../port.c:52:7: error: expected '(' before 'void'
52 | __asm void vPortSVCHandler( void )
| ^~~~
| (
../port.c:64:13: error: stray '#' in program
64 | mov r0, #0
我是否缺少包含或编译器选项?
您使用 gcc
并且 gcc 没有“asm”函数。
你需要在汇编器中编写或者编写内联汇编。 __asm
也是无效的 gcc
关键字。