Hi,
I am having a hard time with avr-objcopy for the last few days.
The requirement of my app is to have a global, initialized array of bytes, positioned at a specific address in the SRAM. To do this, I declared the array as follows:
unsigned char array_in_sram[] __attribute__ ((section (".custom_segment"))) = {0x80,0x83,0x86,0x89,0x8c,0x8f,0x92,0x95,0x98,0x9c,0x9f, ........};
and told the linker to link this segment at address=0x800100 and the data segment at address=0x800600:
avr-gcc.exe" -mmcu=atmega644pa -Wl,-section-start=.custom_segment=0x800100 -Wl,-section-start=.data=0x800600 -Wl,-Map=MyProg.map -o MyProg.elf MyProg.o
Now I'm at the point where everything works in the debugger the listing and map files looks fine. To transfer the code to the device I generate an Intel HEX file with the avr-objcopy command:
avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "MyProg.elf" "MyProg.hex"
Here comes the problem: the generated file doesn't contain the array variable. I've tried to mess with the -j and -R parameters with no luck.
I know I'm missing something. Hope you know what it is.