python-intelhex / intelhex

Python IntelHex library
BSD 3-Clause "New" or "Revised" License
201 stars 107 forks source link

larger size after merge hex file #27

Closed linvis closed 4 years ago

linvis commented 5 years ago

I use script hexmerge.py to merge two hex file, but after merging, I find the merged file size is larger than other tool. For example, I have 3 files, 924k(0x8000000\~0x8003AF0), 460k(0x8009000\~0x80039210), 512k(0x8080000\~0x80FFB30), first I use intelhex to merge, the merged file is 2.0M, than I use another tool named srecord, the merged file is 1.7M, but both of them work well. I notice, the merged file used by intelhex like this: :10000000288000205102000859020008ED1800085D and srecord like this: :20000000288000205102000859020008ED1800085D0200085F020008610200080000000012 I guess maybe there some format that intelhex used make it difference?

bialix commented 5 years ago

Sorry for not working on your issue. I'm looking for a new maintainer for Python IntelHex project. I hope someone will help.

RufusVS commented 4 years ago

The first 2 digits is number of data bytes per line. So you can see, intelhex writes 0x10 (16) bytes per line, while the sercord default is 0x20 (32) data bytes per line. This is where the difference is. I believe either of the program will let you set the default data bytes per line, so they can be the same. srecord also has srec_cmp.exe with which you could compare the two hex file binary images, which should tell you that despite the formats, the file contents are actually the same. But since srecord is putting more data per line, there is less overhead (colon, length, start address, record type) per line and fewer lines.