4.3.5.4 Why Should I Place a Function Into its Own Section?
The MPLAB XC-DSC Object Linker will place functions into sections efficiently. Since manual placement of functions into program memory may reduce the linker's ability to do this with maximum efficiency, most applications should not include manual placement of functions into program memory. However, bootloader applications are special. They require application firmware to reside higher in memory than the bootloader, which requires manual placement of functions to avoid conflicts with the bootloader application.
Also, applications that require code placement in secure sections need custom placement of program functions using the boot or secure attributes. Address attributes can be applied to functions, as well.
To place a function into its own section with the
section
attribute, to place a function with the
boot
or secure
attributes, or to place a function
with an address
attribute, see the following section of this user’s
guide: