[CW6.1] Inline ASM

cancel
Showing results for 
Search instead for 
Did you mean: 

[CW6.1] Inline ASM

6,127 Views
ColdFireHot
Contributor I
How can I compile inline assembly without the following error?
 
Error  : illegal use of asm inline function
List.cpp line 172        or.l    d2,d0;
 
The error seems to be related to the "or.l" instruction.  If I replace with "ori.l #" then it works.  Could the compiler/assembler have an issue with the keyword "or"?
 
Here is the code from list.cpp around line 172.
 
extern "C" {
  void DisableInt(WORD);
  void EnableInt(void);
}
void DisableInt(WORD wIntMask)
{
  asm
  {
   move.w   sr, d0;
   move.w   d0, -(a7);
   move.w   wIntMask, d2
   or.l     d2, d0;
   move.w   d0, sr;
  }
}
void EnableInt(void)
{
  asm
  {
   move.w (a7)+, d0;
   move.w d0, sr;
  }
}
Labels (1)
0 Kudos
4 Replies

325 Views
rd
Contributor I
Hi ColdFireHot,
I'm using CW6.3 and I'm experiencing the same error you described.
If I use "asm" keyword in C, the compiler doesn't recognize some assembler opcode
For example:
asm
{
lea.l (60,sp), a0
}
The compiler doesn't recognize ".l"
If I leave this suffix:
lea (60,sp), a0
the compiler doesn't recognize the (60,sp) addressing mode

Did you solved your problem?
Maybe this could help me.

Thank you

Roberto
0 Kudos

325 Views
ColdFireHot
Contributor I
rd,
   The issue I had was resolved by using upper case OR.
 
you may want to try
 
   lea      60(a7),a0
 
Mark
 
0 Kudos

325 Views
rd
Contributor I
Thank you ColdFireHot,
in fact I realize that the asm syntax knew by the compiler
is different than the one described from the "Coldfire Family
Programmer's Reference Manual"
Hovewer I haven't yet found a doc describing these differences, like:

Ref manual -> compiler
lea.l -> lea
or.l -> or
...
(60,A0) -> 60(A0)
...

Regards,
Roberto
0 Kudos

325 Views
CrasyCat
Specialist III

Hello

Rewriting DisabelInt routine as follows seems to be accepted by CodeWarrior for Coldfire V6.2:

void DisableInt(WORD wIntMask)
{
 asm
 {
  move.w   sr, d0;
  move.w   d0, -(a7);
  move.w   wIntMask, d2
  OR     d2, d0;
  move.w   d0, sr;
 }
}

However this looks like an issue in the compiler. Can you please submit a service request around that through our support web page.

Go to following URL:
https://www.freescale.com/webapp/sps/site/homepage.jsp?nodeId=054670&tid=FSH

and click on Submit a service request.

CrasyCat

0 Kudos