Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 )
{
    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
}

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 ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading