Bootloaders in Loadable Projects in MPLAB® X IDE

Last modified by Microchip on 2023/11/10 11:04

To combine a bootloader with application code:

  1. Create one project for your application and one project for your bootloader.
  2. Load the bootloader project or hex file into the application project. See Projects Window – Loadables Setup or Project Properties Window – Loading Setup for how to do this.

The next time you build your application project, the resulting hex file will be a combined bootloader/application hex file. Any debug files will also be combined.

For build errors, see The Preferred Method to Use Loadables or the sections below.

Consideration #1: MPLAB® C Compiler for PIC18 MCUs (MPLAB C18)
This compiler provides application start-up code (c018x.o) that begins at the reset vector (address 0) for use in initializing the software stack, optionally initializing the idata section, and jumping to main(). If this start-up code is left in an application, there will always be a conflict with the bootloader code reset and you will get a linker error message about a data conflict.

A resolution would be to edit the start-up code to begin at an address other than 0.

Consideration #2: MPLAB® XC8 – PIC18 MCU Example
The Microchip webinar, Linking PIC18 Bootloaders & Applications, details how to combine a bootloader with application code for a PIC18 MCU using MPLAB XC8 and MPLAB X IDE.