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

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

RE: [avr-gcc-list] inline assembler, ijmp, X-Register


From: Ben Mann
Subject: RE: [avr-gcc-list] inline assembler, ijmp, X-Register
Date: Fri, 1 Jul 2005 21:49:53 +0800

Have you tried it just using a 'vanilla' C function pointer? Although I
don't use the 128 I had the impression that avrlib did this for you.

ie, to state the obvious:

typedef void (*footype)();

footype fooptr;

void foo1() { ... };
void foo2() { ... };

void bar()
{
        //example, selecting a function pointer
        fooptr = foo1;
}

void callfoo()
{
        //call whichever foo function is loaded
        fooptr();
}

Ben

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Torsten
Mohr
Sent: Friday, 1 July 2005 8:45 PM
To: address@hidden
Subject: [avr-gcc-list] inline assembler, ijmp, X-Register

Hi,

i have a functionpointer that is located in the variable fptr:

uint32_t fptr;

I'd now like to jump to that location.

>From the avr-libc-user-manual-1.2.3 i thought i'd need to put it like this:

asm("ijmp":: "x" (fptr / 2));


As i understood it, fptr/2 would then be loaded into r27:r26 abd then the
instruction ijmp would be executed.

Compiling the program leads to:

src/main.c:149: Fehler: unmögliche Registerbedingung in »asm«
src/main.c:149: Fehler: unmögliche Registerbedingung in »asm«

which translates to something like: "impossible register condition in
'asm'".


Can anybody tell me why this does not work?

Is there an easier way to jump to an address in 128k program space?


Best regards,
Torsten.


_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list







reply via email to

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