[avr-libc-dev] PSTR() in static initialisers

2018-01-31 Thread Paul "LeoNerd" Evans
I want to write static struct MenuLevel { uint8_t (*get)(void); void (*set)(uint8_t); uint8_t max; const char *name; } menu[] = { { .get = &get_mode, .set = &set_mode, .max = MODE_MAX, .name = PSTR("MODE"), }, { .get = &get_sense, .set = &set_sense, .max = 1,

Re: [avr-libc-dev] PSTR() in static initialisers

2018-01-31 Thread Joerg Wunsch
As Paul "LeoNerd" Evans wrote: > Does anyone have a suggestion on how I can have a string pointer to a > flash-stored string in a static initialiser? This only works by allocating each of the string into a variable (well, constant actually) in flash by itself, and then mention their names in the

Re: [avr-libc-dev] PSTR() in static initialisers

2018-01-31 Thread Paul "LeoNerd" Evans
On Wed, 31 Jan 2018 21:04:55 +0100 Joerg Wunsch wrote: > As Paul "LeoNerd" Evans wrote: > > > Does anyone have a suggestion on how I can have a string pointer to > > a flash-stored string in a static initialiser? > > This only works by allocating each of the string into a variable > (well, co

Re: [avr-libc-dev] PSTR() in static initialisers

2018-01-31 Thread Joerg Wunsch
As Paul "LeoNerd" Evans wrote: > Hrm; that's upsettingly annoying. Is there perhaps a way this can be > convinced into working? I could not find a way. You want to initialize a flash pointer, and for that to work, you need an (array) object already in flash. A string literal defaults to end up