Jan M. schrieb:
> Ohne das PROGMEM funktioniert es, das habe ich auch herausgefunden.
> Allerdings sehe ich noch nicht, wo genau der Unterschied zur Definition
> von PGM_P liegt.
> <avr/progmem.h>:
>>#define PGM_P const prog_char *
>>typedef char PROGMEM prog_char
Hier steht explizit, dass es sich um chars handelt, welche im Flash
stehen.
Diese im Flash stehenden chars werden dann benutzt um einen Pointer
darauf zu instatieren.
> Läuft das nicht auch prinzipiell auf das Konstrukt
>>const char PROGMEM*
> hinaus?
Nicht ganz.
So wie ich das sehe, ist es völlig egal, wo das PROGMEM steht. In der
Datentypdefinition, in der das PROGMEM vorkommt, und zwar ganz egal an
welcher Stelle, bedeutet es: dieser Datentyp steht im Flash.
PROGMEM ist kein Modifizierer, wie const oder volatile, der
positionsabhängig eine andere Bedeutung hat.
typedef const struct font_info PROGMEM* FONT_P;
typedef const struct font_info * FONT_P PROGMEM;
typedef const PROGMEM struct font_info * FONT_P;
ist alles dasselbe. Ein Pointer der auf struct font_info zeigt und im
Flash ist (der Pointer und nicht die struct)