You can find the AVR GCC documentation for
_memx address space here. It requires GCC version 4.7 or later.
To collect elements into a single large
_memx array, annotate the variables with
__attribute__((section (".progmemx.data"))). Note that the default alignment is two bytes, so the size of each variable/object should be even, or you'll get surprising padding with default linker scripts. Also, the order of such variables/objects is semi-random.
(I've had to do post-processing passes to reorder the data in some cases, for example to sort a command array for binary search or hash table access. It is easy to do using binutils'
avr-objdump,
avr-objcopy if and only if the data does not contain relocations (pointers to other objects); relocations can be retained using a number of different methods, with fixed structure formatted data being relatively easy.)
To find out what linker script is in use, run
avr-gcc -O2 -Wl,--verbose -mmcu=atmega32u4replacing the MCU (
atmega32u4) with the specific one you're using. (This specific one will typically refer to
/usr/lib/avr/bin/../lib/ldscripts/avr5.xn =
/usr/lib/avr/lib/ldscripts/avr5.xn on non-Windows machines.)