[Top][All Lists]

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

[avr-gcc-list] undefined reference to 'r15' with inline assembler

From: Christian Troedhandl
Subject: [avr-gcc-list] undefined reference to 'r15' with inline assembler
Date: Wed, 4 Jul 2001 16:55:06 +0200 (METDST)

I am trying to use lds and sts instructions with inline assembler.
The following code results in an error in the linking stage:
(gcc version 3.0 20010605 (prerelease) (linux RPM on combio.de))
#include <io.h>

uint8_t foo;

int main(void)
  uint8_t i;

  asm("lds %0, %1": "=d" (i): "label"(foo));

This generates the following assembler code:
/* prologue: frame size=1 */
        ldi r28,lo8(__stack - 1)
        ldi r29,hi8(__stack - 1)
        out __SP_H__,r29
        out __SP_L__,r28
/* prologue end (size=4) */
        lds r15,foo
/* #APP */
        lds r24, r15
/* #NOAPP */
        std Y+1,r24
/* epilogue: frame size=1 */
        rjmp __stop_progIi__

My question: Why does the compiler include the line "lds r24, r15" before
the inline function and why is r15 passed as second parameter to the
lds instruction and not "foo" ?
What would be the correct way to supply lds with a label?


reply via email to

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