Why not just try it yourself and see what the compiler does?
unsigned int fun ( unsigned int a, unsigned int b ) { return(a+b); }
compile object and disassemble
arm-none-eabi-gcc -O2 -c fun.c -o fun.o arm-none-eabi-objdump -D fun.o
and result
00000000 <fun>: 0: e0810000 add r0, r1, r0 4: e12fff1e bx lr
Two inputs a and b are transmitted using r0 and r1. r0-r4 does not need to be stored, in particular r0, because this return value cannot be saved. Since the C code required two operands to be added together, and since the call requirement requires the result to return to r0. r0 = r0 + r1.
The compiler must comply with the convention, otherwise the code that it creates does not work, so you can simply compile the code and parse it to find out a little about the calling convention for a specific compiler and purpose.
old_timer
source share