[Top][All Lists]

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

Re: [avr-gcc-list] Array element in inline assembly

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Array element in inline assembly
Date: Tue, 7 Jun 2005 07:04:02 +0200 (MET DST)

Matt McLellan <address@hidden> wrote:

> asm("lds r16, array[element]"::);
> That gives me the following error:
> Error: garbage at end of file

Sure, assembler is not C. ;-)

You'd need to compute the address yourself in assembler.

> I've also tried passing it as an arguement, but can't
> seem to figure out what constraint to use:
> asm("lds r16, %0": "=x" (array[element]):);

lds is probably the wrong operation to try.  If you want
the compiler to do the address calculation on your behalf,
rather let it pass you the fetched value in a register.

p.s.: This is supposed to be a closed list, so without a
subscription, you risk missing answers.
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]