18.3.6.2 Variables to Control Processor Selection

The MP_PROCESSOR_OPTION is the main variable that is used to control the processor name. Be aware that different compilers expect the name of the processor to be different. Some append "PIC", some use small “f”, etc. The Makefiles created by MPLAB® X IDE have the correct values. When you override these values by using MP_PROCESSOR_OPTION, you must ensure names are correct.

Note: The generated Makefiles for the MPLAB XC C compilers cannot be used with different processors by simply changing the value of MP_PROCESSOR_OPTION. This is only for the debug images. You can still produce different hex files for different devices by changing the MP_PROCESSOR_OPTION value.

The debug image is produced by a link line which includes the list of memory regions allocated to the debugger. This list is device dependent. For example, the link line below can be used to create the debug image on an MPLAB XC16 project.

"C:\Program Files\Microchip\xc16\v1.70\bin\xc16-gcc.exe"   -o dist/default/debug/dsPIC33_OutsideIDE.X.debug.elf  build/default/debug/main.o      -mcpu=33FJ128GP710        -D__DEBUG=__DEBUG   -omf=elf -DXPRJ_default=default  -legacy-libc     -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F   -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,,,--script=p33FJ128GP710.gld,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,-Map="dist/default/debug/dsPIC33_OutsideIDE.X.debug.map",--report-mem,--memorysummary,dist/default/debug/memoryfile.xml  -mdfp="C:/Program Files/Microchip/MPLABX/v6.00/packs/Microchip/dsPIC33F-GP-MC_DFP/1.3.64/xc16" 

The reserve areas (-mreserve above) may change from device to device. If you want to produce different debug images for different processors, it is preferable to change the processor in the IDE and use prjMakefilesRegenerator to recreate the Makefiles.

These are the versions that support the -mreserve keyword or that pass the list of debug regions by using other means. To generate a debug image with the correct debug ranges passed to the linker, you need to run prjMakefilesRegenerator. You cannot simply change MP_PROCESSOR_OPTION.

Toolchain First version supported*
XC8 1.00
XC16 1.21
XC-DSC 3.00
XC32 1.30
* All versions greater or equal to this version issue -mreserve.