SPRAB89A September 2011 – March 2014
Local variables of a procedure, i.e. variables with C storage class auto, are allocated either on the stack or in registers, at the compiler's discretion. Variables on the stack are addressed either via the stack pointer (B15), or in cases where the offset is too large, via a temporary frame pointer register (A15) that points to the activation frame and can support greater offsets.
The stack is allocated from the .stack section, and is part of the data segment(s) of the program.
The stack grows from high addresses toward low addresses. The stack pointer must always remain aligned on a 2-word (8 byte) boundary. The SP points at the first aligned address below (less than) the currently allocated stack.
Section 4.5 provides more detail on the stack conventions and local frame structure.