SW006015 Microchip Technology, SW006015 Datasheet - Page 62

C COMPILER MPLAB C32

SW006015

Manufacturer Part Number
SW006015
Description
C COMPILER MPLAB C32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheets

Specifications of SW006015

Supported Families
PIC32MX5, MX6, And MX7
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC32 MCUs
Tool Function
Compiler
Supported Devices
PIC32 MCUs
Tool Type
Compiler
Processor Series
PIC32
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
5.4
DS51686A-page 58
STACK USAGE
®
The MPLAB C32 C compiler dedicates general purpose register 29 as the software
Stack Pointer. All processor stack operations, including function call, interrupts and
exceptions use the software stack. The stack grows downward from high addresses to
low addresses.
By default, the size of the stack is 1024 bytes. The size of the stack may be changed
by specifying the size on the linker command line using the
--defsym_min_stack_size linker command line option. An example of allocating
a stack of 2048 bytes using the command line is:
pic32-gcc foo.c -Wl,--defsym,_min_stack_size=2048
The runtime stack grows downward from higher addresses to lower addresses (see
Figure 5-1). The compiler uses two working registers to manage the stack:
• Register 29 (sp) – This is the Stack Pointer. It points to the next free location on
• Register 30 (fp) – This is the Frame Pointer. It points to the current function’s
FIGURE 5-1:
the stack.
frame. Each function, if required, creates a new frame from which automatic and
temporary variables are allocated. Compiler optimization may eliminate Stack
Pointer references via the Frame Pointer to equivalent references via the Stack
Pointer. This optimization allows the Frame Pointer to be used as a general
purpose register.
STACK FRAME
Caller
FP
Callee
SP
Space for more
arguments if
necessary
Space for argument 4
Space for argument 3
Space for argument 2
Space for argument 1
Local variables and
temporary values
Register save area
Space for arguments
used in function calls
© 2007 Microchip Technology Inc.
Stack grows
toward
lower
addresses

Related parts for SW006015