Hex Decompilers for PIC

Chathuranga Chandrasekara picture Chathuranga Chandrasekara · Jun 3, 2010 · Viewed 18.4k times · Source

I've faced to a problem with a PIC Micro controller.

I have a micro-controller programmed by me long time ago and I lost the relevant source code and the schematic diagrams. Now I need to invert the value of a port. I can do this using some NOT gates but it is a big hassle to do so. or alternatively I will need to write the whole program back.

I don't expect to see the code back in PIC C or MikroC. Having an understandable assembly code would be sufficient.

So do anyone has any experience on a good HEX decompiler that I can use for this purpose? Any comments based on your experience? :)

EDIT : Device PIC 16F84A

Answer

Clifford picture Clifford · Jun 3, 2010

Decompilation is unlikely to be a practical solution, and it is even less likely that a tool for your specific compiler and instruction set combination even exists.

Disassembly however is straightforward, though whether you will be able to make sense of the resulting code is a different matter since no comments or symbols are preserved in the HEX file; if you have the original object code it may render the disassembly more readable. There are many PIC disassemblers available, just Google it; I can't direct you at any specific one because there are a number of PIC families with different instruction sets, and you did not specify.

A simple approach to disassembly would be to simply load your HEX file into MPLAB and select View->Disassembly Listing, then right-click the windows and select "Output to File". This output may need some massaging for it to be suitable for input to an assembler.