I am analyzing a binary taken from a STM32 SoC (ArmV6) and it uses a to me unknown calling convention for small functions. First argument in r0, second argument in r3 and return in r1. (In my binary no call with three arguments seem to use this convention)
As an example, a trivial check_if_bit_is_set function:
*************************************************************
* FUNCTION
*************************************************************
bool check_if_bit_is_set (uint * addr , byte bit )
bool r1:1 <RETURN>
uint * r3:4 addr
byte r0:1 bit
08001230 1a 68 ldr r2,[addr ,#0x0 ]
08001232 01 21 movs r1,#0x1
08001234 81 40 lsls r1,bit
08001236 11 40 ands r1,r2
08001238 c1 40 lsrs r1,bit
0800123a 70 47 bx lr
Why would this be done, is this a known calling convention or used by a specific compiler?