Combine Hex of Bootloader AN1157 and Application

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

Combine Hex of Bootloader AN1157 and Application

Postby Maniii » Thu Jul 24, 2014 7:58 am

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
Maniii
 
Posts: 1
Joined: Thu Jul 24, 2014 7:50 am
PIC experience: EE Student

Re: Combine Hex of Bootloader AN1157 and Application

Postby Tom Maier » Fri Jul 25, 2014 2:19 pm

1.) Load bootloader.

2.) Load application through bootloader

3.) Download image from the pic of the whole schmear. Call that hex file your production image and you can blow as many as you want from that, or send it off to have it preloaded when you purchase chips for production.

I assume you are wanting to make an image for production, in which you load the bootloader and an example app in one?
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products


Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 16 guests

cron