View previous topic :: View next topic |
Author |
Message |
test153
Joined: 09 Feb 2009 Posts: 28
|
CCS to assembler |
Posted: Wed Feb 11, 2009 1:06 pm |
|
|
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
|
|
Posted: Wed Feb 11, 2009 1:11 pm |
|
|
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
|
|
Posted: Wed Feb 11, 2009 3:46 pm |
|
|
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
|
Re: CCS to assembler |
Posted: Wed Feb 11, 2009 4:15 pm |
|
|
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
|
|
Posted: Wed Feb 11, 2009 4:22 pm |
|
|
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
|
|
Posted: Wed Feb 11, 2009 5:53 pm |
|
|
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 |
|
|
|