This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

inline assembler

Good day,

I try to add inline assembler like this:

asm("POP {R12,PC}");

but I have an error:

  Error[Og006]: Error in inline assembly: "Error[401]: Operand syntax error"

I have read that I should change the processor mode in code settings in IAR but I can`t do it because it is gray and unchangeable. How can I solve the problem?

  • This is not a Nordic related question, This is purely ARM related.

    Please read the post about push and pop here

    You cannot use registers after R7 in these operations

    3.4.6. PUSH and POP
    Restrictions In these instructions:

    • reglist must use only R0-R7.
    • The exception is LR for a PUSH and PC for a POP.

    change your asm to asm("POP {R7,PC}"); and it should work.