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 CCS Technical Support

Convert hex file to c

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



Joined: 06 Oct 2009
Posts: 2

View user's profile Send private message

Convert hex file to c
PostPosted: Tue Oct 02, 2012 6:32 am     Reply with quote

When we compile a c file to hex through ccs compiler, again can we convert hex file to c ? This needs somebody send the hex file only. Is it possible?
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Tue Oct 02, 2012 7:10 am     Reply with quote

No.

There are probably at least 20 possible C lines for any particular compiler output, for things like loops etc.. Then add the optimiser, and 'reverse compiling' gets more complex than writing the code in the first place.

Historically for some compilers in the early days of computers people did try to make reverse compilers. Just how successful they were is illustrated by how many exist now. A few free ones do exist for the PC, but all are 'dubious' in the quality of their output.

For a specialist compiler like CCS, the basic work is not there, and to write such a program would be many hundreds of times more complex than writing the PIC program again from scratch. Especially given how rapidly CCS changes.

Compiling is more akin to milling a piece from a lump of stock, than 'translating'. Imagine what is involved in re-creating the piece of metal from the swarf....

Best Wishes
temtronic



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

View user's profile Send private message

PostPosted: Tue Oct 02, 2012 7:19 am     Reply with quote

I made a reverse compiler for my Model III 20+ years ago and it did a fine job...done on a 'bet you can't do it'...took about 2 weeks of long, long nights (as I had a real job back then). Ah the good old dayze !

As Ttelmah points out 'reverse compiling' is a complex task and you can cut new code faster though it can be done. Most 'hobbiest' programs on PICs are not that complicated or long and can easily be 'cloned' or 'mimicked' in just a few hours.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Tue Oct 02, 2012 7:27 am     Reply with quote

The old Tandy TRS-80.

It was easier (slightly) with older compilers, because most did not perform much if any optimisation. Now it is almost impossible to get back the 'original' code, and (of course), no comments, and variable names that have no meaning, mean it can take as long to 'interpret' the output as it took to write the program to generate it....

Best Wishes
temtronic



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

View user's profile Send private message

PostPosted: Tue Oct 02, 2012 10:59 am     Reply with quote

longer !!! sigh......
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Oct 02, 2012 1:05 pm     Reply with quote

You guys crack me up. Ttelmah and your "swarf" -- that's awesome.

To the poster,

Your best bet is to load it up in MPLAB and look at the assembly code (print it out or print to file) and then learn what the assembly is doing.

You're gonna be an assembly expert by the time your done!

Consider yourself lucky!

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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