Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the nesting limits of function calls on 8-bit PIC devices?

0
Posted

What are the nesting limits of function calls on 8-bit PIC devices?

0

For PIC18 and mid-range PIC devices, the function call depth is the same as the depth of the hardware return address stack. Check the datasheet for the device you are using. Baseline PIC devices have a very small hardware stack depth (2 calls) and to work around this, the compiler can employ a call mechanism based on lookup tables. This allows a much larger level of function nesting, with no theoretical limit. Use of the alternate call mechanism is automatic. The call graph produced by the compiler (shown in the assembly list file for compiler versions 9.70 and above, or the map file for earlier compilers) can be used as a guide to stack depth, but this shows only a static analysis and so may not reflect actual usage. See your compiler manual for more information on function calls, and the fastcall qualifier.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123