Microchip Technology SW006023-1N Data Sheet
MPLAB
®
XC32 C/C++ COMPILER
USER’S GUIDE
2012 Microchip Technology Inc.
DS51686E-page 175
Chapter 17. Linking Programs
17.1
INTRODUCTION
The compiler will automatically invoke the linker unless the compiler has been
requested to stop after producing an intermediate file.
requested to stop after producing an intermediate file.
Linker scripts are used to specify the available memory regions and where sections
should be positioned in those regions.
should be positioned in those regions.
The linker creates a map file which details the memory assigned to sections. The map
file is the best place to look for memory information.
file is the best place to look for memory information.
17.2
REPLACING LIBRARY SYMBOLS
Unlike with the Microchip MPLAB XC8 compiler, not all library functions can be
replaced with user-defined routines using MPLAB XC32 C/C++ Compiler. Only weak
library functions (see Section 6.12 “Variable Attributes”) can be replaced in this way.
For those that are weak, any function you write in your code will replace an identically
named function in the library files.
replaced with user-defined routines using MPLAB XC32 C/C++ Compiler. Only weak
library functions (see Section 6.12 “Variable Attributes”) can be replaced in this way.
For those that are weak, any function you write in your code will replace an identically
named function in the library files.
17.3
LINKER-DEFINED SYMBOLS
The 32-bit linker defines several symbols that may be used in your C code develop-
ment. Please see the “MPLAB
ment. Please see the “MPLAB
®
Assembler, Linker and Utilities for PIC32 MCUs User’s
Guide”(DS51833) for more information.
The linker defines the symbols _ramfunc_begin and _bmxdkpba_address, which
represent the starting address in RAM where ram functions will be accessed, and the
corresponding address in the program memory from which the functions will be copied.
They are used by the default runtime start-up code to initialize the bus matrix if ram
functions exist in the project, see Section 10.3 “Allocation of Function Code”.
represent the starting address in RAM where ram functions will be accessed, and the
corresponding address in the program memory from which the functions will be copied.
They are used by the default runtime start-up code to initialize the bus matrix if ram
functions exist in the project, see Section 10.3 “Allocation of Function Code”.
The linker also defines the symbol _stack, which is used by the runtime start-up code
to initialize the stack pointer. This symbol represents the starting address for the
software stack.
to initialize the stack pointer. This symbol represents the starting address for the
software stack.
All the above symbols are rarely required for more programs, but may assist you if you
are writing your own runtime start-up code.
are writing your own runtime start-up code.