4.6.4 How Do I Know If the Stack Has Overflowed?
The DSC devices use a stack that's upper address boundary can be set in the SPLIM register. Therefore, it is possible to set a stack level to prevent overflow.
Other stack errors, besides overflow, may be trapped and identified in code. For more information about using the software stack, see the following sections of this guide:
11.2.3 Auto Variable Allocation and Access, "Software Stack"
11.2.3 Auto Variable Allocation and Access, "The C Stack Usage"
See the software stack in your device data sheet.