Microchip Technology SW006023-2N Data Sheet

Page of 238
Linking Programs
 2012 Microchip Technology Inc.
DS51686E-page 189
17.4.4.23 .RAMFUNC SECTION
The linker now dynamically collects the ‘ramfunc’ attributed and “.ramfunc” named 
sections and allocates them sequentially in an appropriate range of memory. The first 
ramfunc attributed function is placed at the highest appropriately aligned address.
The presence of a ramfunc section causes the linker to emit the symbols necessary for 
the crt0.S start-up code to initialize the PIC32 bus matrix appropriately.
/*    
 * RAM functions go at the end of our stack and heap allocation.
 * Alignment of 2K required by the boundary register (BMXDKPBA).
 *
 * RAM functions are now allocated by the linker. The linker generates
 * _ramfunc_begin and _bmxdkpba_address symbols depending on the
 * location of RAM functions.
 */
_bmxdudba_address = LENGTH(kseg1_data_mem) ;
_bmxdupba_address = LENGTH(kseg1_data_mem) ;
17.4.4.24 STACK LOCATION
A symbol is defined to represent the location of the Stack Pointer (_stack). As 
described previously, the heap and the stack are now allocated to the largest available 
gap of memory after other sections have been allocated.
For PIC32 devices with more than 64K of data memory, GP relative addressing mode 
should not be used. To avoid conflict of using GP-relative addressing to the linker gen-
erated symbols, allocate the symbols in section “_linkergenerated”: extern 
unsigned int __attribute__((section(“_linkergenerated”))) 
_splim;