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

CCS to assembler

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



Joined: 09 Feb 2009
Posts: 28

View user's profile Send private message

CCS to assembler
PostPosted: Wed Feb 11, 2009 1:06 pm     Reply with quote

Is there any way to compile CCS C to assembler? I would like to open source my code and as CCS isn't free I would like the people to be able to download an asm version of my code.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 1:11 pm     Reply with quote

The .LST file is generated when you compile your program. It's in
assembler. But it's a listing, and it's not ready for MPASM. You would
have to edit it extensively. There is no "ASM ready" output from the
compiler.
Doug99



Joined: 13 May 2004
Posts: 6

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 3:46 pm     Reply with quote

You could compile your C code to a hex file then (in MPLAB) click File->Import, open your .hex file. Then click View->Program Memory and voila, pure assembler without all the benefits of high level programming language like C.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: CCS to assembler
PostPosted: Wed Feb 11, 2009 4:15 pm     Reply with quote

test153 wrote:
Is there any way to compile CCS C to assembler? I would like to open source my code and as CCS isn't free I would like the people to be able to download an asm version of my code.

What are you planning on giving people? Do you want to provide them source code that they can run as-is without modification? Or do you want to provide them something that they could link with code of their own? If it is the later, then forget it. The CCS code that is produced makes certain assumptions about memory allocation that are not apparent from the listing. There is no "safe" way to allocate more memory outside of the CCS environment. This is just one example. I'm sure there are others. The only safe thing you can distribute is the complete program, without the ability to modify it or combine it with anything else. And as long as you are doing only that, you might as well just distribute the HEX file. It is just as useful for that purpose as the ASM file - maybe moreso.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
test153



Joined: 09 Feb 2009
Posts: 28

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 4:22 pm     Reply with quote

I was thinking of giving people the asm source code so they can compile it on their own. But you are probably right, the asm code won't do anyone any good assuming that the only way to get it is to decompile the hex file. The decompiled asm code wouldn't be easy to understand... and as RLScott pointed out modifying the asm code wouldn't be such a good idea...
Doug99



Joined: 13 May 2004
Posts: 6

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 5:53 pm     Reply with quote

I don't think you should give up. You made not be able to copy the decompiled program exactly as is, but you could use the .lst file PCM programmer mentioned as a tool to learn some assembly and create it from scratch. Not to mention the data sheets. There are lots of examples on Microchip's website as well.

Good Luck!
Doug
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