I have a bootloader to PIC18F4550 that was written using Mikro C for PIC and I have two firmware applications, one was written using Mikro C for PIC and the other using MPLAB X with XC8 compiler. With the bootloader installed, I can upload the application written in Mikro C without problem, but, with the same bootloader installed, when I try to upload the application written in MPLABX I can't. I load untill 100% but, in the end, it crashes.
In the bootloader code there is the following code:
const unsigned long BOOTLOADER_SIZE = 8000;//7432;
const unsigned long BOOTLOADER_START = (( __FLASH_SIZE - BOOTLOADER_SIZE) /
_FLASH_ERASE) * _FLASH_ERASE;
const unsigned char RESET_VECTOR_SIZE = 4;
I suspecting that the firmware application is interfering in the part of the instruction space that the bootloader occupies. I did nothing in the XC8 application to ensure it does not overlap the bootloader already present in the device, I just compiled it and use the .hex file to be uploaded.
At this moment, my firmware application does not need to invoke the bootloader and does not need to use any I/O resources that are also used by the bootloader.
I tried to modify linker comands, in a .map file, but I don't know if this is the way. I didn't put it here because it is too extensive
Does someone know, or has a tip, of how to configure MPLABX, or write in the application's firmware, to guarantee it does not overlap ?
Following are two images of the configuration project that MPLABX provides. Remembering this is the project of the application firmware.