[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Solution to function pointers in program memory-FYI
From: |
Harald Kipp |
Subject: |
Re: [avr-gcc-list] Solution to function pointers in program memory-FYI |
Date: |
Mon, 07 May 2001 12:17:45 +0100 (MEZ) |
How about
#define pgm_rw(addr) ({ \
u16 __word; \
__asm__ ( \
"lpm\n\t" \
"mov %A0, r0\n\t" \
"adiw r30, 1\n\t" \
"lpm\n\t" \
"mov %B0, r0\n\t" \
: "=&r" (__word) \
: "z" ((u16)(addr)) \
: "r0" ); \
__word; \
})
The clobbered r0 need not to be specified. However,
I'd leave it, because otherwise the macro depends
on r0 defined as __tmp_reg__. As far as I know,
putting r0 in the clobber list won't hurt.
Harald Kipp
egnite Software GmbH TEL +49 (0)2323-925375
Westring 303 FAX +49 (0)2323-925374
44629 Herne
Germany
Embedded Ethernet - http://www.egnite.de/