chipKIT® Development Platform

Inspired by Arduino™

Retreive Sketch From HEX file

Created Wed, 16 Dec 2015 21:39:53 +0000 by FredCailloux


Wed, 16 Dec 2015 21:39:53 +0000

Hi All, :oops: I lost my Sketch INO file because I was so dumb I forgot to save the most updated version before closing UECIDE. Although, I did Compile and Program the code to my MX7 and it was successfully doing it's job. Hence, the code was valid. I now have an HEX file in the folder which is up to date.

:idea: Is it possible to rebuild some kind of readable sketch from this HEX file ?

Help Help !!


Wed, 16 Dec 2015 22:02:43 +0000

Nope, sorry.

You can possibly disassemble it into assembly language, but that's a far cry from what your sketch looked like.

If you should happen to have a .elf file it may be possible to get some of it back using pic32-objdump -S <elf file>


Thu, 17 Dec 2015 14:37:30 +0000

There are indeed tools out there that can convert from binary back into pseudocode. Hex-Rays decompiler is one example, but sadly it doesn't support MIPS. Such tools are often priced in thousands of EUR, so probably not worth the while to investigate.

Majenko - I presume that UCEIDE doesn't leave temporary files behind? There might be the possibility of undeleting some if the machine has not been used heavily.


Thu, 17 Dec 2015 14:54:01 +0000

It usually cleans up after itself. It sets the "delete on exit" flag in Java on the temporary files, so Java should clean them up afterwards. It doesn't always though. You can have a look around in your temporary folder to see if there is anything there...


Thu, 17 Dec 2015 16:42:44 +0000

Thanks GrahamM242. I already redone the work. Actually, my question had two purposes. One obvious was to save time but the second was for education. I guess we have a 50% success here, I got educated on the subject. But, indeed, it would be, I think, a good feature to include by default. An auto-save choice in the preferences of UECIDE and MPIDE to decide whether to auto-save the last standing sketch in a temp file or something similar. Thank you all for sharing. :!:


Thu, 17 Dec 2015 16:51:51 +0000

I find this option is quite useful:


Only works if you have already saved the sketch once though of course...


Thu, 17 Dec 2015 17:34:07 +0000

Gees :!: There also is an Auto Save before compile option :!: I had it NOT checked but it is now. This would have been the solution to my goof. Thanks :!: