View previous topic :: View next topic |
Author |
Message |
echo
Joined: 02 Aug 2011 Posts: 3
|
c30 to ccsc assembler problem |
Posted: Tue Aug 02, 2011 12:37 am |
|
|
I attempt from the C30 assembler to transform to CCSC assembler,
but compile error:
Is C30 asm code example:
1)asm("MOV %0, W5" : :"g"(buffer_in)); // put 16 MSBs of buffer_in value into W5
2)asm("MOV W5, %0" : "=g"(buffer_out)); // send 16 MSBs to buffer_out
Change to ccsc assembler:
Code: |
#asm
MOV %0, W5" : :"g"(buffer_in); //compile error
MOV W5, %0" : "=g"(buffer_out); //compile error
#endasm
|
How can change ccsc correct assembler?
Any help would be much appreciated. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Tue Aug 02, 2011 5:19 am |
|
|
Are you trying to convert inline assembler to CCS C code or convert another C compiler's code that has inline assembler(machine code) into CCS C code?
The two methods are very different !
If you're trying to 'include' ...MOV %0, W5 into a CCS C program then just look in the onscreen help (press F11) or read the manual for examples(they are there).
Without more information, it's difficult to give you a precise answer.
CCSC is not an assembler , rather a compiler.Assembler normally refers to writing programs using machine code instructions( the instruction set) whereas a compiler allows you to create a program in a higher level language(C, Basic, Forth,etc.) and then it( the compiler) translates the program into assembler( machine code) that then gets burned into the microcomputer. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Aug 02, 2011 8:54 am |
|
|
C30 uses a specific inline assembler syntax, that isn't understood by CCS C. To learn about the inline assembler syntax of CCS 16 bit compiler PCD, consult the manual. |
|
|
echo
Joined: 02 Aug 2011 Posts: 3
|
|
Posted: Tue Aug 02, 2011 7:17 pm |
|
|
Thank All
I'm reading manual, not discovered the detailed explanation.
I am hope that original C30 these 2 lines codes may work on the ccsc-PCD.
Convert the C code writing, or the assembly writing to PCD.
Thanks again |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Aug 03, 2011 2:28 am |
|
|
Basically, PCD has similar methods to use C variables in the inline assembly code, but the syntax is different. If you understand the meaning of the code, translating it to CCS C or inline assembler shouldn't be an issue. As a first point, you have to consider the data type of the involved C variables.
In the present case, a simple C assignment should do the same. What's the reason to use inline assembler?
Code: | buffer_out = buffer_in; |
|
|
|
echo
Joined: 02 Aug 2011 Posts: 3
|
|
Posted: Wed Aug 03, 2011 3:07 am |
|
|
Hi FvM. Thank you very much.
This C30 code only an assembler example, behind has some digital
operation on the dsp mode.
Is Others' based on C30 old code work is good.
Now I study based on the ccsc-pcd, I try directly:
Code: |
MoV buffer_in,W5; //but the result is wrong
|
That must study the C30/assembly again ? oh, God.
Pls help me.
Thanks again. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Aug 04, 2011 3:15 am |
|
|
As I already said, the data type of buffer_in must be known to understand what the code does. You also didn't clarify, what's wrong in the PCD result. Generally, you should look at the list file to check for correct operation.
I wonder, if inline assembler will be of much use without exactly understanding the involved operations. |
|
|
|