On Thu, 22 Jan 2009 10:17:07 -0700 "larry barello" <la...@barello.net> wrote:
> the compiler is complaining because you have an extra or a missing "const" > in your structure definitions. There is a mismatch between your flash > declaration and the type of pointer within your struct. Probably adding a > const keyword to the pointer within your struct and removing the const in > your declaration will fix the problems. Hi Larry, I tried your suggestion (also suggested to me off-list), but no change sadly. I am really at a loss here ! :-/ So in despair, I attached a cut-down, single file ( < 60 lines), compileable piece of code that reproduces the problem. Make file comes with it. I can't offer a beer for real via e-mail of course, however I am more than willing to send 2 or 3 Euros (via Paypal) to whoever picks his brain on it and can compile it without getting the warnings below, so he can go buy himself a real beer ! :-) menu.c:35: warning: initialization from incompatible pointer type menu.c:36: warning: initialization from incompatible pointer type menu.c: In function ‘menu_run’: menu.c:44: warning: type qualifiers ignored on function return type menu.c:47: warning: assignment makes pointer from integer without a cast menu.c:48: warning: assignment makes pointer from integer without a cast Thanks in advance to all the participants !..... -- Vince, getting desperate indeed
Makefile
Description: Binary data
#include <avr/pgmspace.h> #define NULL 0 struct TMenu; struct TMenuItem { char text[20]; const struct Tmenu *ptr; void (*fptr)(); }; struct TMenu { uint8_t nb; char title[21]; const struct TMenuItem items[]; }; void dummy_fnc(void); struct TMenu menu_sub PROGMEM = { 6, "___Sub Menu_________", { {"Sub Item 1 ",NULL,&dummy_fnc}, {"Sub Item 2 ",NULL,&dummy_fnc} } }; struct TMenu menu_main PROGMEM = { 6, "___Main Menu________", { {"Item 1 ",&menu_sub,NULL}, {"Item 2 ",&menu_sub,NULL} } }; void menu_run(const struct TMenu *p) { void (*FncPtr)(void); const struct TMenu *SubPtr; FncPtr = pgm_read_word( & (p->items[0].fptr) ); SubPtr = pgm_read_word( & (p->items[0].ptr) ); } void dummy_fnc(void) { } void main(void) { }
_______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list