I have quite a few progmem constants in my sketch and am thinking about making an include file to keep them all in one place for easier debug. However, this means they will be accessible globally. Is this a bad approach or does it matter since it is stored in progmem anyway? Some functions that I would link to this include file will not use all of the constants so I am concerned that perhaps performance may suffer.
DavidOConnor:
The scope will not change if you put the include statement in the same place that the variable declarations were.
True.
Perhaps a better way to word my question:
Is there a downside to making a program memory constant global vs having it local to only those functions in which the constant is used?
Public and private writable variables are stored in SRAM and the c++ runtime code will create SRAM copies of non-PROGMEM variables at initialization of the program. PROGMEM therefore saves SRAM at the expense of a few more machine cycles, 4 (I believe) for each read only access.
If they were "static const" and NOT "PROGMEM", they would probably be completely optimized away in favor of "immediate mode" constant instructions, which are more efficient (spacewise) than PROGMEM, and MUCH more execution time efficient. Putting them in PROGMEM is probably not a good idea unless you need global access.