Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Discussion Groups | Freescale DSPs | 56800e Inline assembler and inline functions

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

56800e Inline assembler and inline functions - jack...@motec.com.au - Mar 8 1:45:00 2006



Hi,
  I have a couple of questions about inline assembler and inline functions in the 56800E
compiler under CW5.6
 
Question 1:
Is there anyway to use members of a C struct in the assembler code?
I can use local or static variables in assembler functions eg.
         int32 myVar;
         asm {
         move.l myVar,A
          }
 
but is there a way to use a pointer to a struct to access struct elements in inline assembler,
without having to hard code the offsets of elements? I don't want to have to change the
assembler every time the struct is changed.
 
Question 2:
The following example function works correctly, loading a return value into Y0 and returning.
ctUINT16 MyFunc (ctUINT32 myInt32) { 
   asm{   
     LSRR.L #2,A   
     MOVE.W A1,Y0  //Load return value into Y0  
   }
}
 
ctUINT16 MyFunc2(void) { 
 return MyFunc(1234); 
} 
 
This compiles to:
  subroutine "FMyFunc"
  lsrr.l      #<2,A
  move.w      A1,Y0
  rts         
 
  subroutine "FMyFunc2"
  move.l      #1234,A
  jsr         >FMyFunc
  rts         
 
Unfortunately this does NOT work when I make MyFunc an inline function:
ctUINT16 MyFunc (ctUINT32 myInt32) { 
   asm{   
     LSRR.L #2,A   
     MOVE.W A1,Y0  //Load return value into Y0  
   }
}
 
ctUINT16 MyFunc2(void) { 
 return MyFunc(1234); 
} 
 
This compiles to:
  subroutine "FMyFunc2"
  lsrr.l      #<2,A
  move.w      A1,Y0
  move.w      B1,Y0
  rts
	which is totally wrong. Is there a way to inline a function containing inline assambler?
	


(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )