4.3.10.3 Stack Pointer Overflow
The Stack Pointer Limit (SPLIM) register specifies the size of the stack buffer. SPLIM is a
32-bit register, but SPLIM[1:0] is fixed to ‘00
’ because all stack
operations must be long word-aligned.
The stack overflow check is not enabled until a long word write to SPLIM occurs. After this, it can only be disabled by a device Reset. All Effective Addresses (EAs), generated using W15 as a source or destination, are compared against the value in SPLIM. If Effective Addresses (EAs) exceed the contents of the SPLIM register, and a PUSH operation is performed, a stack error trap occurs on a subsequent PUSH operation. For example, if it is desirable to cause a stack error trap when the stack grows beyond address 0x5000 in RAM, initialize the SPLIM with the value 0x4FFC.
CALL
instruction is executed, or
if an interrupt occurs, a stack error trap is generated.If stack overflow checking is enabled, a stack error trap also occurs if the W15 Effective Address calculation wraps over the end of data space.
A pre/post inc/dec operation is performed on W15 that results in EA[1:0] != 0b00 (i.e., not long word aligned). This will detect byte and word pre/post inc/dec operations that are otherwise considered aligned but would result in a misaligned Stack Pointer.