CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

decompile hex

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
theitalian



Joined: 13 Aug 2015
Posts: 2

View user's profile Send private message

decompile hex
PostPosted: Thu Aug 13, 2015 4:23 pm     Reply with quote

Needing to decompile a hex file to C. The chip is a PIC18f2321 programmed on a ICD-U64.
Anyone have a recommendation?
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Aug 13, 2015 5:15 pm     Reply with quote

decompile to WHAT?

and if i may ask WHY?

and did you bother to GOOGLE?

pic hex decompiler
theitalian



Joined: 13 Aug 2015
Posts: 2

View user's profile Send private message

PostPosted: Thu Aug 13, 2015 5:23 pm     Reply with quote

I think it was programmed in C so I'm wanting to take hex file and convert to C if possible. as for why, want to change/add command set for hardware this is controlling.
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Thu Aug 13, 2015 9:43 pm     Reply with quote

Good luck, you'll need it.

The code burned into any processor is machine/assembly code. The code you write in C is converted to assembly by the compiler. The processor itself doesn't run on or even understand C. It understands one thing only: assembly.

It's not impossible to get an idea of what the code does by looking at the assembly, but you sure won't get C.
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Fri Aug 14, 2015 12:31 am     Reply with quote

This has been asked here before, and a search would have found the answers. Basically 'not possible'. Especially given the optimiser (that deletes code that doesn't actually 'do' anything).
De-compiling, is a lot of work, and even with the right tool (would mean writing one for the particular compiler), is never very successful.
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 15, 2015 7:23 pm     Reply with quote

The quickest way to see the code is to use MPLAB and read the chip into MPLAB. No it will NOT be in 'C', rather assembler but it will all be there.
As for converting assembler into C, well, that's a challenge to say the least.
yes, it can be done, just be sure to have a few pots of coffee available and a LOT of time.
Good news is that chip only has 8K of prgm space so maybe 4k worth of instructions. If there's a lot of 0xFF then the program is smaller !
Since you already know what the program does you've got an 'edge' in decoding the code. Assuming you also have schematics, you'll also know about devices/addresses/etc. that will speed up the process.
Yes, it can be done(BTDT with the TRS80) however it might be faster/easier to cut all new code depending on your level of programming.

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group