MPLAB® Harmony Bootloader Warning Message - "...addresses that do not exist"

Why does my MPLAB® Harmony bootloader project build successfully, but with the warning message: …contains code that is located at addresses that do not exist? Should it be ignored?

A PIC32 bootloader application generated with MPLAB Harmony may generate the following warning message, however, it is alright to ignore it.
Warning: "dir"/Demo/firmware/Demo.X/dist/default/debug/Demo.X.debug.elf contains code that is located at addresses that do not exist on the PIC32MZ2048ECH144.

The linker file (btl_mz.ld, generated during the build process) contains a section that fills the memory area 0x1FC14000 - 0x1FC1FFF0 with value 0xFF:
.fill1 : { FILL(0xFF); . = ORIGIN(protected_reg3) + LENGTH(protected_reg3) - 1;}
This generates the warning mentioned. But the memory range filled is valid for the PIC32MZ2048ECH144 microcontroller, so the warning can be ignored.

The bootloaders are configured to only -01 optimization (maximum level enabled for the free compiler version), which, for some bootloaders, will exceed the 80 KB available in each boot flash block.

To resolve this, the linker script treats both 80 KB as one 160 KB block and uses a fill command to block the areas that aren't implemented. However, the hex file contains the fill data, and that is why the error occurs.
You can resolve this in multiple ways:

  • Increase optimization, if you have the Pro version of the compiler, remove the fill command, and shrink the boot flash area.
  • Change the fill command line in the linker script:
    .fill1 (NOLOAD):
    That will remove the fill from the hex file and the error should stop. The fix will look like the following:
    .fill1 (NOLOAD): // previously just .fill1: { FILL(0xFF); . = ORIGIN(protected_reg3) + LENGTH(protected_reg3) - 1; BYTE(0xFF) } > protected_reg3 }
© 2018 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.