5.4.5 Startup and Initialization
-mmicromips mode to the xc32-gcc/g++
compilation driver to tell it to link with the microMIPS variant of the runtime start-up
code. If your BOOTISA bit is set to MIPS32 mode, pass the -mno-micromips
option to the compilation driver so that the MIPS32 variant of the runtime start-up code is
linked.The runtime startup code performs initialization tasks that must be
executed before the main() function in the C/C++
program is executed. For information on the tasks performed by this code, see Main, Runtime Start-up and Reset.
The compiler will select the appropriate runtime startup code, based on the selected target device and other compiler options.
- The startup code initializes the L1 cache when available.
- It enables the DSPr2 engine when available.
- It also initializes the Translation Lookaside Buffer (TLB) of the Memory Management Unit (MMU) for the External Bus Interface (EBI) or Serial Quad Interface (SQI) when available. The device-specific linker script creates a table of TLB initialization values that the startup code uses to initialize the TLB at startup.
-mmicromips option to xc32-gcc when linking, and use
the micromips function attribute on all of your Interrupt Service Routines
(ISRs). Using the -mmicromips option and the micromips
attribute ensures that your startup code and ISR code are compiled for the microMIPS ISA
when the BOOTISA Configuration bit is set to micromips. Likewise,
be sure that you linkwith the MIPS32 startup code, and your ISRs are not
micromips attributed when the BOOTISA bit is set to
MIPS32.For C:
There is only one start-up module, which initializes the C runtime environment. To obtain a copy of this file, follow the directions in How Do I Customize the C Runtime Startup Code?. Multilib versions of these modules exist in order to support architectural differences between device families.
For C++:
Code from five object files link sequentially to create a single initialization routine, which initializes the C++ runtime environment.
The PIC32M precompiled startup objects are located in the following location:
<install-directory>/pic32m/lib/
The files have the following names: cpprt0.o, crti.o, and
crtn.o.
The GCC precompiled startup objects are located in the following location:
<install-directory>/lib/gcc/pic32m/<gcc-version>/.
The files have the following names: crtbegin.o and
crtend.o.
Multilib variations of these modules exist in order to support architectural differences between device families and also optimization settings.
For more information about what the code in these start-up modules actual does, see Runtime Start-Up Code.
