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

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

[avr-gcc-list] Address of address of address ...


From: Maurizio Ferraris
Subject: [avr-gcc-list] Address of address of address ...
Date: Sun, 17 Apr 2005 17:03:08 +0200

Hi all,
I have been trying to make a table of addresses of other tables that contain pointers to strings. Everything in code area.
Let's see the code:

/////////////// The strings
u08 string1[] PROGMEM = "Some text 1";
u08 string2[] PROGMEM = "Some text 2";
u08 string3[] PROGMEM = "Some text 3";
u08 string4[] PROGMEM = "Some text 4";

/////////////// Now the tables of string pointers
PGM_P strTable1[] PROGMEM = {
  string1,
  string2
};
PGM_P strTable2[] PROGMEM = {
  string3,
  string4
};

///////////////  Now the table of table pointers
<<<don't knok what>>> strTableOfTables[] PROGMEM = {
  strTable1,
  strTable2
};

In place of <<<don't knok what>>> I tried almost any combination of PGM_P, PROGMEM, __attribute__(??), and a variable number of '*', but I coudn't eliminate the warning: "initialization from incompatible pointer type" or "initialization discards qualifiers from pointer target type". The nice thing is that, examinating the flash contents, it looks as if it were working:

00002431 <string1>:
 2431:  53 6f 6d 65 20 74 65 78 74 20 31 00     Some text 1.
0000243d <string2>:
 243d:  53 6f 6d 65 20 74 65 78 74 20 32 00     Some text 2.
00002449 <string3>:
 2449:  53 6f 6d 65 20 74 65 78 74 20 33 00     Some text 3.
00002455 <string4>:
 2455:  53 6f 6d 65 20 74 65 78 74 20 34 00     Some text 4.
00002461 <strTable1>:
 2461:  31 24 3d 24                             1$=$
00002465 <strTable2>:
 2465:  49 24 55 24                             I$U$
00002469 <strTableOfTables>:
 2469:  61 24 65 24                             a$e$

The questions are:
- how to avoid the warning ?
- are there other sublte things to worry about ?

Thanks all.
Mau.





reply via email to

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