Eroror compiling builtin asm

I recently switch from Keil Uvision to my own Makefile
I have an issue compiling a file port.c,
the function in the file :

__asm void vPortSVCHandler( void )

    /* 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
    mov r0, #0
    msr basepri, r0
    bx r14

When compiling I get these errors :

../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

Am I missing an include or a compiler option ?

>Solution :

You use gcc and gcc does not have "asm" functions.

You need to write it in the assembler or write the inline assembly. __asm is also not valid gcc keyword.

Leave a Reply