Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Tool that can show the diff between two Intel Hex files?

Status
Not open for further replies.

vsmGuy

Advanced Member level 2
Advanced Member level 2
Joined
Jun 26, 2006
Messages
503
Helped
44
Reputation
88
Reaction score
15
Trophy points
1,298
Location
VddVss
Activity points
3,882
Do you know of some tool that can show the diff between two Intel Hex files?

If it is customzed for PIC/AVR in some way - even better!
 

i think you can use 'diff' for that.

srizbf
2ndjuly2010
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
You can try Winmerge
https://winmerge.org/

It is a very powerful tool for text files comparison and you can use it also to compare ASCII hex files, though it is not its main purpose.

Regards
Mowgli
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
WinMerge is a better option than commandline diff.

However - note that hex files can be unordered.

For example, one hex file might be like:

a
b
c

and the other

b
a
c

.. and they would technically be the same hex file - but show up as different using the said options :)

We can sort both files before beginning comparison - but I think there should be better ways?
 

winmerge is a full fledged app(with unicode and ...).

for your simple requirement 'diff' based difference is sufficient.
a gui for 'diff' is enough in most cases even to diff many sources and 'user friendly'.

the unordered hex is unique.
you may have to write one for that.
may be someone would have written for such.

srizbf
3rdjuly2010
 

Reordering is not the only one problem. You can have single line from first file splitted into multiple lines (records) in second file and both files will represent same valid content. There are even tools for intel hex repacking like packihx used with sdcc.
Convert hex to bin and then use diff. Create batch file if this is inconvenient.
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
for (i=0: i< lenFile1; i++) {
if file1 <> file2
print "intruder alert"
}

You could try C PHP BASIC etc.
Not too difficult I wouldn't think
Do it yourself and you can take into account any ordering you like
if thats an issue

jack
 

Don't compare the intel hex files, but instead create another format where the output is always the same, like a final hex-ascii of the memory that you want to compare.

You don't say what is your source, but if it is a linker, then most likers have the ability to produce multiple output types, thus consider dumping another output format for these types of comparisons.

In the past, I've compiled a project, and then produced 2 different output formats: one for debugging and one for burning an image into a EPROM / FLASH device.
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
Enlightenment said:
Don't compare the intel hex files, but instead create another format where the output is always the same, like a final hex-ascii of the memory that you want to compare..

All right - nice answers and we are finally going somewhere, so more details:

Consider the output of the compiler to be one source of a hex file.

The other source would be reading the uC with a programmer.

I want to write a program that would tell me whether a hex file has been programmed into a uC correctly.
 

you must addecuate both intel-hex files, as some tools make it 16 byte width and others make it 32-byte width,
also some compilers(linkers) build them unoredered (like sdcc) but mostly, readers get them truly ordered...

so I build myself a tool to re-order and make it 16byte width, a long time ago, (just for the same task :D) (the sad new is that i lost to source of it, and of course, it's as is, no warrant or anything....)

EDIT: ok, i found the source (I think) checking it, it has an ovious limitation of 64K hex file, the command line should be

hexo [input_file.hex] [output.hex]
no need for extention, but it search a correct Intel-hex file.

attached is an quick example of
Code:
hexo input.hex out.hex
after reordering both files, you can compare with a normal text comparition tool...
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
If I had a choice on outputs, I prefer to work with Motorola S files over Intel files, because the addresses are OBVIOUS and easily support 32-bit addresses.

Intel hex file format:
https://en.wikipedia.org/wiki/Intel_HEX

**broken link removed**

Motorola hex file format:
http://en.wikipedia.org/wiki/SREC_(file_format)
 

so you want to compare two hex files , one from your compiler output and one read from the programmed controller ?

for that purpose why not you straight away use 'verify ' feature of the programmer .?

srizbf
4thjuly2010
 

srizbf said:
so you want to compare two hex files , one from your compiler output and one read from the programmed controller ?

for that purpose why not you straight away use 'verify ' feature of the programmer .?

That's because the programmer in question is being developed by a group of friends and I would like to add this very feature.
 

well, have you seen my HEX-o program (sorry most comments in spannish) but it loads the program in memory(array), if you really want to compare, and fast, I suggest to compare on memory (load on 2 arrays and compare them according MAX size) it's faster than comparing ASCII- Intel-HEX files...

just an idea...
 

    vsmGuy

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top