SW006015 Microchip Technology, SW006015 Datasheet - Page 65

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.7
© 2007 Microchip Technology Inc.
STARTUP AND INITIALIZATION
5.7.1
The following provisions are made regarding the runtime model:
• Kernel mode only
• KSEG1 only
• RAM functions are attributed with __ramfunc__ or __longramfunc__,
5.7.2
The PIC32MX startup code must perform the following:
1. Jump to NMI Handler If an NMI Occurred
2. Initialize Stack Pointer and Heap
3. Initialize Global Pointer
4. Call “On Reset” Procedure
5. Clear Uninitialized Data Sections
6. Copy Initialized Data from Program Flash to Data Memory
7. Copy RAM Functions from Program Flash to Data Memory
8. Initialize Bus Matrix Registers
9. Initialize CP0 Registers
10. Trace Control 2 Register (TraceControl2 – CP0 Register 23, Select 2)
11. Call “On Bootstrap” Procedure
12. Change Location of Exception Vectors
13. Call Main
5.7.2.1
If an NMI caused entry to the reset vector, a jump to an NMI handler procedure
(_nmi_handler) occurs. A weak version of the NMI handler procedure is provided
that performs an ERET. The _nmi_handler function must be attributed with
nomips16 [e.g., __attribute__((nomips16))] since the startup code jumps to
this function.
5.7.2.2
The Stack Pointer (sp) register must be initialized in the startup code. To enable the
startup code to initialize the sp register, the linker script must initialize a variable which
points to the end of KSEG1 data memory
can change the minimum amount of stack space allocated by providing the command
line option --defsym _min_stack_size=N to the linker. _min_stack_size is
provided by the linker script with a default value of 1024.
On a similar note, the user may wish to utilize a heap with their application. While the
startup code does not need to initialize the heap, the standard C libraries (sbrk) must
be made aware of the heap location and its size. The linker script creates a variable to
identify the beginning of the heap. The location of the heap is the end of the utilized
KSEG1 data memory. This variable is named _heap. The user can change the
minimum amount of heap space allocated by providing the command line option
--defsym _min_heap_size=M to the linker. _min_heap_size is provided by the
1. The end of data memory are different based on whether RAM functions exist. If RAM functions exist, then
meaning that all RAM functions end up in the .ramfunc section
part of the DRM must be configured for kernel program to contain the RAM functions, and the Stack
Pointer is located one word prior to the beginning of the DRM kernel program boundary address. If RAM
functions do not exist, then the Stack Pointer is located at the true end of DRM.
Provisions
PIC32MX Startup Code
JUMP TO NMI HANDLER IF AN NMI OCCURRED
INITIALIZE STACK POINTER AND HEAP
1
. This variable is named _stack. The user
DS51686A-page 61

Related parts for SW006015