RTEMS CPU Architecture Supplement
The AVR architecture supports a simple call and return mechanism.
A subroutine is invoked via the call (call
) instruction.
This instruction saves the return address in the RETS
register
and transfers the execution to the given address.
It is the called funcions responsability to use the link instruction
to reserve space on the stack for the local variables. Returning from
a subroutine is done by using the RTS (RTS
) instruction which
loads the PC with the adress stored in RETS.
It is is important to note that the call
instruction does not
automatically save or restore any registers. It is the responsibility
of the high-level language compiler to define the register preservation
and usage convention.
RTEMS CPU Architecture Supplement
Copyright © 1988-2008 OAR Corporation