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

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

[avr-gcc-list] Basic inline asm question


From: cavanus
Subject: [avr-gcc-list] Basic inline asm question
Date: Wed, 23 Nov 2005 10:57:12 -0200

Hello,

In this scenario:

        typedef {
                uint16_t x[10];
                uint8_t  y[4];
        } T;

        T t;

        // ...

        void function()
        {
                register uint16_t addr  __asm__ ("r30");
                register uint8_t  addrl __asm__ ("r30");
                register uint8_t  addrh __asm__ ("r31");

                // ...
        }

        // ...

How to generate in function() this assembly lines (loading address of
global structure [t] in [rZ]) using avr-gcc inline asm?
ldi     r30, lo8(&t)
ldi     r31, hi8(&t)
__asm__ __volatile__("ldi %0, %1" : "=r" (addrl) : "M" (???));
__asm__ __volatile__("ldi %0, %1" : "=r" (addrh) : "M" (???));


I shoud try various typecasts in [???] but the compiler never match
the constraints...


Thanks!


cavanus




reply via email to

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