Holding data in flash

Coming from the AVR/ARDUINO world, I’m used to using PROGMEM to hold constant data in flash instead of having it copied to ram. Of course, most example code these days is for Arduini,

If I specify

static const uint8_t initcmd[] = { bla, bla, bla};

At runtime, is this kept in the flash or copied to relatively scarce ram?

As long as it’s const it won’t be copied to RAM. Essentially everything that’s const works the same as PROGMEM.

1 Like

Cool. Thanks.

I’ll happily edit out PROGMEM. Or maybe I’ll just define PROGMEM to be nothing.

You can use the Arduino.h header which will do exactly that - along side with other things (e.g. for the F() macro, pin-to-port mapping, …).

1 Like

Oh. Thanks!