Hi, I'm creating a table of pointers to functions, where each function is like: void func(void) { ... }
When I place the table into RAM, I can access elements, and dereference those elements to execute the corresponding functions. This works fine. For example: void (*func_tab[])() = { func1, func2, ... }; void main () { void (*funcptr)(void); ... funcptr = func_tab[1]; (*funcptr)(); ... } But when I place the table into flash instead, my program goes off into the boonies when I try to invoke the function: #include <avr/pgmspace.h> void (*func_tab[])() = { func1, func2, ... }; void (*func_tab_flash[])() PROGMEM = { func1, func2, ... }; void main () { void (*funcptr)(void); ... funcptr = func_tab[1]; // the variable holds 0x90 (*funcptr)(); // this works just fine funcptr = func_tab_flash[1]; // the variable holds 0 (*funcptr)(); // this sends us into the boonies } Surely it can't be too hard to place a table of function pointers into flash, retrieve function pointers from this table, and 'call' them. What am I doing wrong? Otherwise, what workarounds are available? Cheers David _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list