cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple inline Assembler-Commands with IAR

nafaazayen
Associate II
Posted on December 07, 2007 at 13:44

Multiple inline Assembler-Commands with IAR

2 REPLIES 2
nafaazayen
Associate II
Posted on May 17, 2011 at 09:48

Hi

I want to execute multiple inline-assembler-commandos one after

another, so i tried it this way:

static inline int FASTABS(int x)

{

int t=0;

asm ('' eor t, x, x, asr #31 ''

''sub t, t, x, asr #31 '');

return t;

}

Unfortunately the IAR Embedded Workbench says

Error[Og005]: Unknown symbol in inline assembly: ''t''

Error[Og005]: Unknown symbol in inline assembly: ''x''

Error[Og006]: Syntax error in inline assembly: ''Error[0]: Invalid syntax''

...

Thank you in advance

zouhair
Associate II
Posted on May 17, 2011 at 09:48

Hi,

You can use inline assembly if you don't reference any symbols because there are several limitations to using inline assembler:

-Auto variables cannot be accessed

- Alternative register names, mnemonics, and operators are not supported

-...

So,

''Inline assembler is therefore often best avoided. If there is no suitable intrinsic function available, we recommend the use of modules written in assembler language instead of inline assembler, because the function call to an assembler routine normally causes less performance reduction.'' from EWARM compiler reference guide.

For more information, refer to EWARM compiler reference guide(Mixing C and assembler page 69)