Function-Level Inline Assembly

The compiler accepts function definitions that are composed entirely of assembly statements. Function-level assembly code uses this syntax:

asm function-definition

A function that uses function-level assembly must end with a bx lr instruction.

Listing: Example Inline Assembly Function

asm void myfunc(int arg1, int arg2)
{

add arg1, arg1, #2

sub arg2, arg1, #-1

bx lr

}