P2 ABI
David Betz
Posts: 14,516
in Propeller 2
Has anyone defined an ABI for the P2 yet? What does p2gcc use?
Comments
My understanding is that prop-gcc uses the ARM calling convention, i.e. the propeller is seen as an ARM processor with all its registers, stack, etc.
@Cluso99 has defined how to call his ROM monitor (parameters passed in registers at the end of COG RAM, if I recall correctly). We could try to make p2gcc compatible with that, if it's general enough.
@cgracey, have you given any thought to how your Spin interpreter might call out to PASM routines?
My guess is that we'll probably have at least 2 calling conventions, one using the CALL instruction and the built-in 8 level stack, and another using a general stack (probably CALLA or CALLB). There could also be variations on "pass arguments in registers" or "pass arguments on the stack".
I feel like the 16 register ARM-like convention we used for Prop1 is probably too restrictive. In retrospect having more registers would have been better. Perhaps a 32 register, RISCV like calling convention would work.
No, CALLD is another good alternative. In a way we're presented with too many choices on P2. Coming up with an ABI that everyone will use is going to be a challenge.