You can pass up to four parameters easily. Just write a C function and use inline assembler to call the supervisor:
#define svc(code) asm volatile ("svc %[immediate]"::[immediate] "I" (code)) #define SVC_WRITE_DATA 1 void sv_call_write_data(char *string, int length) { svc(SVC_WRITE_DATA); }
See point 3 how to extract those parameters in the supervisor call handler.
You can get the values from the user mode stack directly. Use inline assembler to determine the stack used by the caller:
asm volatile( "tst lr, #4\t\n" /* Check EXC_RETURN[2] */ "ite eq\t\n" "mrseq r0, msp\t\n" "mrsne r0, psp\t\n" "b %[sv_call_handler_main]\t\n" : /* no output */ : [sv_call_handler_main] "i" (sv_call_handler_main) /* input */ : "r0" /* clobber */ );
Since I'm currently hassling around with this too, I wrote a blog post about it. Your IDE uses GCC, so this should apply for you too: http://falstaff.agner.ch/2013/02/18/cortex-m3-supervisor-call-svc-using-gcc/