I am thinking about modifying the ChibiOS AVR port to work with the xmega. One thing I need to do is put the initial value of the program counter (either two or three bytes) onto the stack so "ret" can be called.
Looking at the AVR Instruction Set PDF this is what it gives for "RET"
PC(15:0) <- STACK, SP <- SP + 2 (16 bit PC)
PC(21:0) <- STACK, SP <- SP + 3 (22 bit PC)
This does not really tell me what order the bytes of the PC are stored on the stack when "CALL" or variants are executed. Is there another manual I should be reading? I could look at examples but I would rather find the source of the information.