15.3.5 Stack Usage Limitations

Static estimation of the maximum stack usage is inaccurate if the application contains functions falling in at least one of the following categories:

  • Functions for which the stack usage information is not available (not compiled/assembled with -mchp-stack-usage).
  • Functions containing indirect calls to other functions (the callees can not be identified).
  • Functions containing variable stack adjustments, inline assembly, or stack-usage information generated by the assembler (which might be inaccurate).
  • Recursive functions (direct or indirect) - only if at least one of the functions in the cycle has non-zero stack consumption.

For each of these cases, a list of the involved functions is provided.

Be aware that the stack-usage estimation for assembly files may be inaccurate if your assembly code adjusts the stack. Be sure to take these adjustments into account when estimating your stack usage.