Microchip Technology SW006022-1N Data Sheet
MPLAB
®
XC16 C Compiler User’s Guide
DS52071B-page 124
2012 Microchip Technology Inc.
FIGURE 7-4:
PUSH CALLEE-SAVED REGISTERS
7.3.2.3
AUTO VARIABLE SIZE LIMITS
If a program requires large objects that should not be accessible to the entire program,
consider leaving them as local objects, but using the static specifier. Such variables
are still local to a function, but are no longer auto and are allocated permanent storage
which is not in the software stack.
consider leaving them as local objects, but using the static specifier. Such variables
are still local to a function, but are no longer auto and are allocated permanent storage
which is not in the software stack.
The auto objects are subject to the similar constraints as non-auto objects in terms
of maximum size, but they are allocated to the software stack rather than fixed memory
locations. Section 7.3.1.3 “Non-Auto Variable Size Limits” which describes defining
and using large arrays is also applicable to auto objects.
of maximum size, but they are allocated to the software stack rather than fixed memory
locations. Section 7.3.1.3 “Non-Auto Variable Size Limits” which describes defining
and using large arrays is also applicable to auto objects.
7.3.3
Changing Auto Variable Allocation
As auto variables are dynamically allocated space in the software stack, using the
address attribute or other mechanisms to have them allocated at a non-default location
is not permitted.
address attribute or other mechanisms to have them allocated at a non-default location
is not permitted.
Stack grows
toward
greater
addresses
toward
greater
addresses
SP (W15)
FP (W14)
Callee-Saved
Return addr [15:0]
Parameter 1
:
Parameter n-1
Parameter n
Caller Frame
Return addr [23:16]
Registers
Previous FP
Local Variables
and Temporaries
and Temporaries
[W14+n] accesses
local context
local context
[W14-n] accesses
function parameters
stack-based