SLAA534A June 2013 – June 2020
There are at least two cases that require a standardized layout for the local frame and ordering of callee-saved registers. They are exception handling and debugging.
This section describes conventions for managing the stack, the general layout of the frame, and the layout of the callee-saved area.
The stack grows toward zero. The SP points to the lowest-addressed location within this function's frame. That is, 0(SP) is allocated, but -1(SP) is not.
Objects in the frame are accessed using SP-relative addressing with positive offsets.
A compiler is free to allocate one or more "frame pointer" registers to access the frame. The TI compiler does not use a frame pointer, so a single call frame is limited to 0xffff bytes.
Insofar as a frame pointer is not part of the linkage between functions, the choice of whether to use a frame pointer, which register to use, and where it points is up to the discretion of the toolchain. However, the exception handling stack unwinding instructions assume that no frame pointer is available.
The stack frame of a function contains the following areas:
Before the frame is allocated, SP points to the return address (SR for interrupt functions).