My idea is that you take this C30 user's manual and make it your best friend in the world. Then you refer to Chapter 8. Mixing Assembly Language and C Modules.
EXAMPLE 8-2: CALLING AN ASSEMBLY FUNCTION IN C
Code:
/*
** file: call1.c
*/
extern int asmFunction(int, int);
int x;
void
main(void)
{
x = asmFunction(0x100, 0x200);
}
The assembly-language function sums its two parameters and returns the result.
;
; file: call2.s
;
.global _asmFunction
_asmFunction:
add w0,w1,w0
return
.end
And if you absolutely want to use inline asm
EXAMPLE 8-3: PASSING C VARIABLES
This example demonstrates how to use the swap instruction (which the compiler does not generally use) :asm ("swap %0" : "+r"(var));
In addition to the "revolutionary" idea of reading the C30 tools manual. C30 is GNU-C, if you need additional info not contained in the C30 manual, you may also consult the original GCC manual "Using the GNU Compiler Collection".