SW006012 Microchip Technology, SW006012 Datasheet - Page 79

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
4.10
© 2007 Microchip Technology Inc.
THE C STACK USAGE
MPLAB C30 C Compiler Runtime Environment
The C compiler uses the software stack to:
• Allocate automatic variables
• Pass arguments to functions
• Save the processor status in interrupt functions
• Save function return address
• Store temporary results
• Save registers across function calls
The runtime stack grows upward from lower addresses to higher addresses. The
compiler uses two working registers to manage the stack:
• W15 – This is the Stack Pointer (SP). It points to the top of stack which is defined
• W14 – This is the Frame Pointer (FP). It points to the current function’s frame.
FIGURE 4-3:
The C runtime startup modules (crt0.o and crt1.o in libpic30.a) initialize the
Stack Pointer W15 to point to the bottom of the stack and initialize the Stack Pointer
Limit register to point to the top of the stack. The stack grows up and if it should grow
beyond the value in the Stack Pointer Limit register, then a stack error trap will be taken.
The user may initialize the Stack Pointer Limit register to further restrict stack growth.
The following diagrams illustrate the steps involved in calling a function. Executing a
CALL or RCALL instruction pushes the return address onto the software stack. See
Figure 4-4.
to be the first unused location on the stack.
Each function, if required, creates a new frame at the top of the stack from which
automatic and temporary variables are allocated. The compiler option
-fomit-frame-pointer can be used to restrict the use of the FP.
Stack grows
toward
greater
addresses
STACK AND FRAME POINTERS
Function Frame
SP (W15)
FP (W14)
DS51284F-page 73

Related parts for SW006012