I am maintaining an old project that had a bootloader code and app code. They were working great but upon adding some features to the app code (few if statements), I notice that my bootloader code is being overwritten in the device somehow. App code independently works just fine if I load it using the pickit programmer.
I checked out my hex file to see what really is the change at the memory locations: see hex_diff.png attached.
[W/O if statements] :020000040000FA :060000007CEF7DF0120010 :060008009DEF51F0120013 :060018009DEF51F0120003 :010FFF00AB46
[W/if statements] :020000040000FA :0600000039EF7EF0120052 :06000800E7EF51F01200C9 :06001800E7EF51F01200B9 :010FFF00AB46
Among other differences, regions in this memory range in the picture above should not have changed at all by me adding couple of if statements in the app code. In my linker file I have clearly defined that region to have the bootstrap code: CODEPAGE NAME=bootloader START=0x0 END=0xFFF PROTECTED
[Questions] I am not sure how to go about debugging this issue. Has someone encountered this issue? If not, would you guys have some leads into it?
Thanks for your help and suggestions in advance!
[EDIT] MPLABX v1.85 Compiler C18 v3.44 MPLink v4.45 MicroController: PIC18F46J50