Variables to Modify Command Lines
The following _PRE and _POST variables are optional. They exist simply to allow customization of the command line. You can run a make without defining any of them.
MP_EXTRA_CC_PRE MP_EXTRA_CC_POST
MP_EXTRA_BC_PRE MP_EXTRA_BC_POST
MP_EXTRA_AS_PRE MP_EXTRA_AS_POST
MP_EXTRA_AR_PRE MP_EXTRA_AR_POST
MP_EXTRA_LD_PRE MP_EXTRA_LD_POST

Many compilers (such as gcc-based ones) use their main shell program to call the linker/assembler. These command lines, then, are formed of a first section (where MP_EXTRA_XX_PRE is located), and a second section, which is typically passed to the linker/assembler (where MP_EXTRA_XX_POST is located). That is why two macros per each tool are needed to allow you to modify the behavior of that tool.

An example of a link line in a gcc-based compiler is:

${MP_CC}  -omf=elf  ${MP_PROCESSOR_OPTION_LD} ${MP_EXTRA_LD_PRE} -o dist/$(CND_CONF}/${IMAGE_TYPE}/Explorer16PIC24DSC_1.${IMAGE_TYPE}.elf ${OBJECTFILES} -Wl,--defsym=__MPLAB_BUILD=1,--report-mem, -Tp24FJ128GA010.gld${MP_EXTRA_LD_POST}

In this case, the MP_EXTRA_LD_PRE is issued to the shell (before -Wl) and the MP_EXTRA_LD_POST is issued after. You need to pass valid options – see your language tool documentation. For the options to be included before the -Wl, you need a space as a separator:
MP_EXTRA_LD_PRE= -D_FOO -D_BAR

And for the options to be included after -Wl, you need a comma as a separator:
MP_EXTRA_LD_POST=--defsym=_FOO,--defsym=_BAR

If the toolchain does not support the use of a driver shell (like gcc), then simply use the _PRE variables.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.