[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Function pointers on > 128 KiB devices, how to?
From: |
Stu Bell |
Subject: |
RE: [avr-gcc-list] Function pointers on > 128 KiB devices, how to? |
Date: |
Wed, 20 Jan 2010 11:40:19 -0700 |
Cool idea, Dale! I may give this a try in my code as it would make some
other problems simpler.
Best regards,
Stu Bell
DataPlay (DPHI, Inc.)
> -----Original Message-----
> On Behalf Of Dale Whitfield
> Sent: Wednesday, January 20, 2010 8:54 AM
>
> Hi Joerg
> >@2010.01.20_15:53:55_+0200
>
> This will create an explicit trampoline. The rest of your
> code would remain the same. I've used this technique in a
> slightly different way previously. Caution: Compiled and
> inspected but not tested/simulated!
>
> #define JMP_TABLE_ENTRY(x) __asm__ __volatile__ ("jmp "#x)
>
> void jumptable_fn(void) __attribute__ ((naked)); void
> jumptable_fn(void) {
> JMP_TABLE_ENTRY(foo);
> JMP_TABLE_ENTRY(bar);
> JMP_TABLE_ENTRY(mumble);
> }
>
> fptr jumptable[] __attribute__((progmem)) = {
> jumptable_fn+0, // foo
> jumptable_fn+4, // bar,
> jumptable_fn+8, // mumble,
> };
>
> An advanced use for this is to allow creation of a 'jump
> table' that can call functions that are not all of type fptr,
> ie. void fn(void).
>