Hello
I'm using a PIC24F16KA101 with the AN1157 bootloader. The bootloader and application works fine als long as i program the application over the bootloader. Now i tried to combine these two hex files into one. My idea is that the application starts running when turning on the device.
I'm using the screc_cut.exe to merge the files together.
1. I cut out the following parts of the hex files: Bootloader: 0x0...0x1400, Application 0x1400...0x1F0'001F.
-> When i program this merged hex file, the application doesn't work. However the bootlaoder is working fine and i can program the application over the bootloader. After that the application works fine too.
2. I analysed the difference of the hex files and noticed that the address 0x100 (USER_PROG_RESET) and the 0x102 (DELAY_TIME_ADDR) are different:
-> Hex before programming the application: ":10020000FFFFFF00FFFFFF007609000076090000F6"
-> Hex after programming the application: ":10020000000A000000000000FFFFFF00FFFFFF00EA"
For sure when the address 0x100 is "FFFF" the application can't be started because the application reset is not set. It will be set by the bootloader after programming the application.
My Question
How can I make sure that my combined hex-File already contains the value "0xA00" at address 0x100 and that the delay at address 0x102 is set to "0x0000"? Or am I on the wrong way an there is an easier way to solve the problem?
Thanks for your help!
Linker Script Bootloader
data (a!xr) : ORIGIN = 0x800, LENGTH = 0x600
reset : ORIGIN = 0x0, LENGTH = 0x4
ivt : ORIGIN = 0x4, LENGTH = 0xFC
aivt : ORIGIN = 0x104, LENGTH = 0xFC
program (xr) : ORIGIN = 0x200, LENGTH = 0x800
Linker Script Application
data (a!xr) : ORIGIN = 0x800, LENGTH = 0x600
reset : ORIGIN = 0x0, LENGTH = 0x4
ivt : ORIGIN = 0x4, LENGTH = 0xFC
aivt : ORIGIN = 0x104, LENGTH = 0xFC
program (xr) : ORIGIN = 0xA00, LENGTH = 0x29FE
BLreset : ORIGIN = 0x100, LENGTH = 0x4