Coldfire Inline Assembler issues
Dear All,
I am not able to compile the assembly code in port.c file for mcf5272 port. I am compiling using Codewarrior C Compiler. Can anyone guide me as to what can be done.
Some of the code i am listing below.
asm volatile ( "move.l %%d1,-8(%%sp) nt"
"clr.l %%d1 nt"
"move.w %%sr,%%d1 nt"
"ori.l %0,%%d1 nt"
"andi.l %1,%%d1 nt"
"move.l %%d1,%%sp@- nt"
"move.l -4(%%sp),%%d1 nt"
: /* no output */
: "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)),
"n" (~STATUS_I(7)) );
asm volatile ( "move.l %d0,%sp@- nt"
"move.l %d1,%sp@- nt"
"move.l %d2,%sp@- nt"
"move.l %d3,%sp@- nt"
"move.l %d4,%sp@- nt"
"move.l %d5,%sp@- nt"
"move.l %d6,%sp@- nt"
"move.l %d7,%sp@- nt"
"move.l %a0,%sp@- nt"
"move.l %a1,%sp@- nt"
"move.l %a2,%sp@- nt"
"move.l %a3,%sp@- nt"
"move.l %a4,%sp@- nt"
"move.l %a5,%sp@- nt"
"move.l %a6,%sp@- nt"
"move.l pxCurrentTCB,%a0 nt"
"move.l %sp,(%a0) nt" );
Regards
Vivek Agarwal
Coldfire Inline Assembler issues
I’m not familiar with the ColdFire port but might be able to help if you can provide some of the compiler error messages.
Which compiler are you using? The port was written with gcc-m68k v2.95.3.
Coldfire Inline Assembler issues
I am using Metrowerks Codewarrior IDE and C Compiler for Coldfire for compiling and debugging.
the list of error are :-
Error : illegal use of asm inline function
port.c line 200 ove.l %sp@+,%d2 nt" "move.l %sp@+,%d1 nt" "move.l %sp@+,%d0 nt" );
Error : illegal use of asm inline function
port.c line 204 asm volatile ( "rte" );
Error : illegal use of asm inline function
port.c line 228 asm volatile ( "unlk %fp" );
Error : illegal use of asm inline function
port.c line 233 asm volatile ( "move.l %%d1,-8(%%sp) nt"
Error : ‘;’ expected
port.c line 241 : "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)),
Error : call of non-function
port.c line 242 "n" (~STATUS_I(7)) );
Error : illegal use of asm inline function
port.c line 244 %a6,%sp@- nt" "move.l pxCurrentTCB,%a0 nt" "move.l %sp,(%a0) nt" );
Error : illegal use of asm inline function
port.c line 246 ove.l %sp@+,%d2 nt" "move.l %sp@+,%d1 nt" "move.l %sp@+,%d0 nt" );
Error : illegal use of asm inline function
port.c line 248 asm volatile ( "rte" );
Error : illegal use of asm inline function
port.c line 271 asm volatile ( "move.l %%a7,%%d1 nt"
Error : illegal use of asm inline function
port.c line 305 asm volatile ( "unlk %fp" );
Error : illegal use of asm inline function
port.c line 307 %a6,%sp@- nt" "move.l pxCurrentTCB,%a0 nt" "move.l %sp,(%a0) nt" );
Error : illegal use of asm inline function
port.c line 310 ove.l %sp@+,%d2 nt" "move.l %sp@+,%d1 nt" "move.l %sp@+,%d0 nt" );
Error : illegal use of asm inline function
port.c line 312 asm volatile ( "rte" );
Coldfire Inline Assembler issues
The syntax is GCC specific and will have to be converted to the syntax for your compiler.
Coldfire Inline Assembler issues
Any idea where can i get some info on this conversion. also is there any tools anybody knows of.
Any idea what the last 4 lines of the below inline mean starting from :
asm volatile ( "move.l %%d1,-8(%%sp) nt"
"clr.l %%d1 nt"
"move.w %%sr,%%d1 nt"
"ori.l %0,%%d1 nt"
"andi.l %1,%%d1 nt"
"move.l %%d1,%%sp@- nt"
"move.l -4(%%sp),%%d1 nt"
: /* no output */
: "n" (EXSF_FORMAT(4) | EXSF_VECTOR(VECTOR_TMR0)),
"n" (~STATUS_I(7)) );
also what the last line in below routine mean
asm volatile ( "move.l %%a7,%%d1 nt"
"move.l %0,%%a7 nt"
"movec.l %%a7,%%vbr nt"
"move.l %%d1,%%a7 nt"
: : "n" (VBR) : "d1" );
Basically the use of : in inline assembly is unknow to me.
it would great if u could tell the above. i can then write the same according to my compiler.
Coldfire Inline Assembler issues
Maybe this helps:
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Constraints.html#index-operand-constraints_002c-_0040code_007basm_007d-1696
Here there is documentation for some of the asm features. I know the arm port uses the ‘m’ constraint as:
asm volatile ( "LDR R0, %0" : : "m" (pxCurrentTCB) );
to get the address of pxCurrentTCB.
The GCC inline assembler is very powerful and therfore unfortunately complex.
Also:
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Extended-Asm.html#Extended-Asm
Coldfire Inline Assembler issues
any idea what the below code does
what is fp. it is taken from port.c of mcf5272 port.
#ifndef OMIT_FRAME_POINTER
asm volatile ( "unlk %fp" );
#endif