SPRAC71A March 2019 – February 2020
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 via the stack pointer (SP).
The stack is allocated from the .stack section, and is part of the data segment(s) of the program.
The stack grows from low addresses toward high addresses. The stack pointer must always remain aligned on a 2-word (32-bit) boundary. The SP points at the next unused memory location.
Section 4.7 provides more detail on the stack conventions and local frame structure.