I am not quite sure what you are asking here, but there are two crucial things that I believe you are misunderstanding. Program space is separate from SRAM. they are in two different address buses. AVR actually provides an instruction to copy data from program space into RAM because of this separation [making it a modified Harvard architecture]. Then, there is also the thing that any globally declared variable will either reside in the .bss section or .data sections of SRAM [this is actually part of the C standard]. The __do_copy_data
and __do_clear_bss
sections of the final executable take care of that [they are automatically added into the .init4 section]. You can override this mechanism using compiler flags, however, the address of each global variable is known from the time the program starts executing [something that happens out of flash memory, not SRAM].
Now, placing things into SRAM, I suggest you take a look at this page on the avr-libc manual. It deals with memory sections in general and how to tweak them. Cheers.