Mě se zdá, že to, co tam píšou, mi dává za pravdu v sekci "
Storing and Retrieving Data in the Program Space": nejdřív píšou, že se k deklaraci přidá PROGMEM, na tom jsme se já i ty shodli. Pak píšou
Now that your data resides in the Program Space, your code to access (read) the data will no longer work. The code that gets generated will retrieve the data that is located at the address of the mydata array, plus offsets indexed by the i and j variables. However, the final address that is calculated where to the retrieve the data points to the Data Space! Not the Program Space where the data is actually located. It is likely that you will be retrieving some garbage. The problem is that AVR GCC does not intrinsically know that the data resides in the Program Space.
což odpovídá tvému pozorování. A hned pak se píše, že
The solution is fairly simple. The "rule of thumb" for accessing data stored in the Program Space is to access the data as you normally would (as if the variable is stored in Data Space), like so:
byte = mydata[i][j];
then take the address of the data:
byte = &(mydata[i][j]);
then use the appropriate pgm_read_* macro, and the address of your data becomes the parameter to that macro:
byte = pgm_read_byte(&(mydata[i][j]));
The pgm_read_* macros take an address that points to the Program Space, and retrieves the data that is stored at that address. This is why you take the address of the offset into the array. This address becomes the parameter to the macro so it can generate the correct code to retrieve the data from the Program Space. There are different pgm_read_* macros to read different sizes of data at the address given.
Já tomu rozumím tak, že na přístup k PROGMEM datům nemůžeš použít normální Cčkový konstrukce, ale musíš použít ty jejich makra.
S těma řetězcema si dokážu představit, že by stačilo deklarovat je v PROGMEM a pak to používat jakože normálně, ale v takovém případě podle mě musí být ten zvláštní přístup schovaný v té funkci, co vezme string a zobrazí ho na displeji (kterážto by následně nemohla fungovat s řetězci uloženými v RAM).
(přiznávám nicméně, že jsem to včera psal po paměti, jen jsem vyhledal ten odkaz na pgmspace.h. Ale když jsem si to dneska přečetl pořádně, tak mám stejně pořád pocit, že jsem měl pravdu - takže by mě docela zajímal kód, kde ti to fakt funguje jen s deklarací a pak normálním přístupem)