4.4.3 Objects in Program Space

Objects that have static storage duration and that are defined using const and any one of the __flash, __flashn, __memx qualifiers, or using const and the progmem attribute are always placed in program memory. When the compiler's const-in-progmem feature is enabled (the default state, or made a state explicit by using the -mconst-data-in-progmem option, see 3.6.1.5 Const-data-in-progmem Option) objects defined using just the const type qualifier are also placed in program memory.

The -mno-const-data-in-progmem option disables the const-in-progmem feature and forces all objects defined using just the const type qualifier to instead be located in data memory.

The avrtiny and avrxmega3 device families can easily access program-memory objects, since this memory is mapped into the data address space. For other device families, program memory is distinct and is accessed via different code sequences.

The -mconst-data-in-config-mapped-progmem option (see 3.6.1.4 Const-data-in-config-mapped-progmem Option) can be used with those devices that support this memory mapping feature to have the linker place all const-qualified data in one 32 KB section and automatically initialize the relevant SFR register to ensure that these objects are mapped into data memory, where they can be accessed more efficiently.