News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

comparing hex file from chip and laptop

Started by Yves, Jul 19, 2022, 12:04 PM

Previous topic - Next topic

Yves

Hello all,

I have wrote  4 different codes for the same application. Unfortunately I have not formally given a formal version number (my bad). I can retrieve the hex code from my apparatus using pickit 3  but don't know which version of the 4 slightly different codes that is in my laptop. My question is how could I compare the hex from my apparatus and the code on my laptop using a simple free app? Any idea how to compare the files. I'm using win10 64bit.

Yves

 
Yves

joesaliba

Try Winmerge. One of the best apps to compare files. I use it to compare code.

Regards

Joe

tumbleweed

I guess the first thing is do you have the original hex files for the 4 versions?

If not, you'll have to build each of them again using the same version of the compiler as you used to originally program the apparatus, and save each hex file.

When you read the contents of your device using the PK3 you'll get the entire memory space, including all the "blank" areas, so when you save that as a hex file it won't directly match up to what the compiler generated, but using winmerge you should be able to tell what's what.

tumbleweed

Once you have all the hex files it might be easier to load each one into the programming app and try to verify them against the programmed chip

Mapo

I use Notepad ++ with "compare" plugin to make comparisons, it works well

TimB


Yves

Thank you all for your suggestions. I found a nice app that is easy to use and free called AptDiff https://download.cnet.com/AptDiff/3000-2248_4-10699723.html. I found my original code.
 
One more question: Is it possible to Code a reference as single byte number on the chip so it can be referenced to its original code?

Regards,

Yves
Yves

tumbleweed

QuoteIs it possible to Code a reference as single byte number on the chip so it can be referenced to its original code?
Sure, but you'd either need to put it at a fixed location in program memory or precede it with some string you could recognize so you could find it (ie "Version = A").

If your device supports it you could also put it into the UserID area.

John Lawton


Yves

Yes thank you, I got it using 18F25k22, it works

Yves
Yves

keytapper

There are 16 bytes, specifically tailored for the version. But there isn't anything handy to make such location useful. So the writing on there is totally left to the user, manually.
For the 18f family and newer MCU I can't assure they still available.
Ignorance comes with a cost