Microchip: How to load more then one HEX file in MPLAB X
Question
I use MPLAB X (sometime MPLAB 8) and i get some project to finish. I have these HEX files:
- bootloader.hex
- magic_flag.hex
Bootloader is loaded from address 0x0 to 0x7FF. The magic flag has position in address 0x40 (so in bootloader area).
And now I need setup the project in MPLAB X to load everything (bootloader+magicFlag+app). It is possible to load bootloader, and then magicFlag and then setup Preserved flash memory and work on the application and load only appl area (from 0x800 to 0xFFFF) but it's not much comfortable for me. For example, when I worked with Freescale with WinIDEA IDE from iSYSTEM, I was able to set many SX files to load, very simple, quickly and it was working. But when I try it with MPLAB X I always get error:
(944) data conflict at address 0h between appl.hex and bootloader.hex.
What I tried:
- setup files for loading in Project properties (section Loading)
- setup memory range in project properties (section ICD 3)
But I thing that it is not problem with ICD 3 loading. Because the error came in time when the MPLAB X is creating unified hex file.
And for imagine, this is my part of linker:
CODEPAGE NAME=BootResetVec START=0x000 END=0x007 PROTECTED
CODEPAGE NAME=BootHighISR START=0x008 END=0x017 PROTECTED
CODEPAGE NAME=BootLowISR START=0x018 END=0x029 PROTECTED
CODEPAGE NAME=TRMAGIC START=0x040 END=0x07F PROTECTED
CODEPAGE NAME=BootLoader START=0x080 END=0x07FF PROTECTED
CODEPAGE NAME=page START=0x800 END=0x7D7F
CODEPAGE NAME=debug START=0x7D80 END=0x7FFF PROTECTED
I reminder, that this is not only my project and a just have bootloader with magicFlag and I have only source code from the appl. Of course, it will be better to have bootloader source code with appl in one project.
So, the MPLAB X is killing me, please help me :-)
Solution
You can't load two application to the same memory address space!
You need to recompile magic_flag
application to higher address than you can merge the both in program FLASH memory. Linker can't do it instead you. :)