I'm referring to the Bootloader FAQ document, which tells we can combine 2 hex files (e.g. app.hex and boot.hex) by these 2 ways:
1:
I think the easiest way to combine hex files is with the srec_cat command-line tool. This tools is part of the srecord utilities. It comes with WinAVR and is very easy to install on a Unix like OS. This is the command you would use:
srec_cat app.hex -I boot.hex -I -o combined.hex -I
2:
Cliff explains that you can also manually combined the app.hex and boot.hex files with a small edit: “Every hex file has one last record in it which effectively says “the file ends here”. So after doing a [manual merge] one needs to edit the combined hex file and locate the termination record from the end of app.hex (now somewhere in the middle of the file) and remove it. The record has a type 01 – the type byte of an Intel hex record is the 4th hex byte so the record actually looks like “:00000001FF”. The whole line (the one in the middle, not the one at the end of the file) should be removed.”
I tried both ways. The seconds way seems to work for me, I don't know why but sometimes I get a verify error if I combine hex files by this way. So I wanted to use the srec utilities option which seems safer. But combined files for these 2 ways don't look like the same.
So I wanted to be sure whether it is true or not. So I tried using the srec_cmp to compare them. But I guess I couldn't write the command properly. I either get "misplaced "-Intel" option " error or "file contains no data" error. I attached 2 combined.hex files; combined1 is the file which has been combined by the first way and the combined2 for the second way. Can we say these are same hex files?
srec_cmp -I ihex combined1.hex -O ihex combined2.hex