ISO C99 and above do not support implicit function declaration

77 Views Asked by At

i am trying to make a uart code for nuvorton m0516LAN but i am facing this issue

RTE/Device/M0516LAN/retarget.c(337): error: call to undeclared function 'asm'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

here is the handler function

void HardFault_Handler(void)
{
    asm("MOVS    r0, #4                        \n"
        "MOV     r1, LR                        \n"
        "TST     r0, r1                        \n" /*; check LR bit 2 */
        "BEQ     1f                            \n" /*; stack use MSP */
        "MRS     R0, PSP                       \n" /*; stack use PSP, read PSP */
        "MOV     R1, LR                        \n" /*; LR current value */
        "B       Hard_Fault_Handler            \n"
        "1:                                    \n"
        "MRS     R0, MSP                       \n" /*; LR current value */
        "B       Hard_Fault_Handler            \n"
        ::[Hard_Fault_Handler] "r" (Hard_Fault_Handler) // input
    );
    while(1);
}
0

There are 0 best solutions below