4

I am using the Keil uVision4 IDE to program an NXP LPC1768. I need recommendations for combining two hex files. The two files are going to be a boot loader and an application that will be used for production programming. Currently, I am successfully able to program each file to the device independently. This is done by running a build on each project and loading via the Keil uVision4 IDE.

Also, is it a valid approach to program the microcontroller with just the boot loader and then use the boot loader to upload the application file?

In regards to effort - I currently have each file built from the IDE. Following each build a hex file is automatically created and then downloaded to the device by using the FLASH->DOWNLOAD option in the IDE. Using the specfic "options for target" within the IDE, I can successfully load the boot at memory address 0x0 and the application at 0x10000.

embedded_guy
  • 1,939
  • 3
  • 24
  • 39
whitedog
  • 95
  • 1
  • 7
  • Can you show your effort? – tod May 07 '14 at 17:11
  • Define what you mean by "hex file" – old_timer May 07 '14 at 17:12
  • Re hex file: Keil target options output tab - create hex file is checked – whitedog May 07 '14 at 17:30
  • Re effort: Each application build is defined in Keil options for target, so following each build there is a hex file created. The hex file is loaded from the IDE with the FLASH->DOWNLOAD. Each application load correctly this way, with boot loader loaded at 0x0 and user app loaded at 0x10000 – whitedog May 07 '14 at 17:34

2 Answers2

4

You can use an application called Hexmate to do this. I think it was created by Microchip a while ago, but you can certainly use it with hex files for other micros. You can find it here: http://www.schmalzhaus.com/Tools/HexmateInstructions.html

The manual is part of the PICC18 manual which can be found here (look at section 5.15): http://ww1.microchip.com/downloads/en/DeviceDoc/manual_STD952.pdf

The command to merge two files, one called "bootload.hex" and one called "mainline.hex" and output them to a file called "merged.hex" is:

hexmate bootload.hex mainline.hex -omerged.hex

Make sure that all 3 files are in the same directory when you execute that line.

Seidleroni
  • 1,044
  • 3
  • 15
  • 31
3

SRECORD can finish this task too.

srec_cat.exe Bootloader.hex -Intel Application.hex -Intel -out Combinded.hex -Intel
netawater
  • 15,214
  • 4
  • 24
  • 21