avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] revised:problem with inline assembly


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] revised:problem with inline assembly
Date: Tue, 20 Sep 2005 07:17:45 +0200
User-agent: Mutt/1.4.2.1i

As varsha wrote:

Foreword:

This "revised" in your subject doesn't make sense, as long as you
don't note *what* you changed.  You don't expect us to put your two
mails side by side, do you?  Better followup to yourself, using
standard email quoting style, and just add the remark you think you
need to add.

Also, this is a bit of the wrong list for your question.  It's the
developer's list where people discuss development issues.  For user
questions, please subscribe to the avr-gcc-list, and ask there.  There
would have a been a number of people around there who could have
answered your question, so in effect, you'd have gotten a faster
reply.

> register unsigned char counter asm("r3");

> so that assembler will use register r3 when we do operations with
> counter variable...

No, the *compiler* will use register r3 when using the "counter"
variable.

> but i tried it one program but doesn't work....!!

Please supply a bit of the generated asm code that makes you think it
doesn't work.

> if i specify say 4 variables in my c program crc0,crc1,crc3and
> crc4...as

That's kinda hard.  You are going to steal 4 out of 32 registers from
the compiler's available regs.  This is likely to force the compiler
to use memory locations in situations where it could normally use a
register.

> register unsigned char crc0 asm("r11");

Also, better start assigning register variables at r2.

> __asm__ __volatile__
>    (
>     "lsl crc0"     "\n\t"

That's not the way it is supposed to work.

Either simply write

      "lsl r11\n\t"

as you basically know that crc0 is living in r11, or use the
proper constraint:

      "lsl %0\n\t"
      ...
      : "r" (crc0):)

> ***********************Confidentiality Notice***************************

If you could avoid that kind of overly verbose footer when writing to
a public mailing list, I'd be happy.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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