avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Assembler error message


From: Denis Chertykov
Subject: Re: [avr-gcc-list] Assembler error message
Date: 16 Mar 2001 22:13:55 +0300

address@hidden (Robert Rozman) writes:

> Hello,
> 
> thanks for info. I did this and I ran acrross weird behaviour that could be
> also caused by my mistake in macro.
> 
> So, I define macro:
> #define CLEARBIT_CONST(var,mask) \
>  asm volatile (\
>   "cbr %0, %1 "\
>   : /* no outputs */\
>    : "r" ((u08) (var)), \
>     "i" ((u08) (mask)) \
>        )

You have an error because IMHO `cbr' isn't useful command and
GNU assembler (avr-as) don't support relocation for `cbr'.
(`cbr' isn't a command it's a translation to `andi rr, 0xff - NN')


Try to use:

#define CLEARBIT_CONST(var,mask) \
 asm volatile (\
  "andi %0, lo8(0xff - (%1)) "\
  : /* no outputs */\
   : "r" ((u08) (var)), \
    "i" ((u08) (mask)) \
       )


Or:

#define CLEARBIT_CONST(var,mask) \
 asm volatile (\
  "cbr %0, %1) "\
  : /* no outputs */\
   : "r" ((u08) (var)), \
    "i" ((mask)) /* <-------- type casting to u08 removed */ \
       )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]