15.4.4 Interpreting the Report
The stack-usage report is written:
- Directly to standard error (either on terminal for command-line execution or in the MPLAB X output window).
- To the map file.
The same information is available in both places, but the map file can serve as a record for later review.
The report contains:
- The largest stack usage that could be determined by static analysis.
- A list of reasons that the maximum stack usage couldn't be determined, such as recursion or variable adjustment of the stack.
- A list of disjoint and/or interrupt handler functions, which are not called directly by the main flow of the program.
To determine the appropriate stack size for your application:
First, start with the initial value from the reset-handler call graph. In this example, the report shows 72 bytes required for the reset-handler call graph.
Stack Usage Report
============= STACK USAGE GUIDANCE =============
In the call graph beginning at Reset_Handler,
72 bytes of stack are required.
Second, add the listed stack allowances based on the system-level, runtime behavior of your application.
Stack Usage Report
However, the following cautions exists:
1. The following functions cannot be connected to the main call graph.
This is usually caused by some indirection:
frame_dummy uses 8 bytes
Dummy_Handler uses 0 bytes
__libc_init_array uses 40 bytes
You must add stack allowances for those functions.
================================================
Third, add stack allowances for your Interrupt handlers (interrupt service routines) as described in the following section.