I am writing an application that uses a battery-backed-up external RAM for non-volatile storage of frequently-changed parameters. We had the heap and all other variables located in internal RAM, and we literally #defined the locations of the specific variables we wanted to live in external RAM.
Up until recently, the majority of the 32k RAM chip was sitting idle, so I'd like to move all variables and the heap to external RAM as well. The problem is, we need to ensure that those specific non-volatile variables continue to live in the same location as before -- at the very beginning of the external RAM -- and that they continue to behave in a non-volatile fashion. I gather that placing these variables in the .noinit section can achieve this.
From what I have read of the discussion of memory sections from the avr-libc FAQ, it appears that the .data section comes first, followed by the .bss section, with the .noinit section coming at the very end of it all, just before the heap.
This concerns me -- if any additional variables are added to or removed from the .data or .bss sections in future revisions, then our non-volatile variables will change locations.
Is it possible to force the .noinit section to the very beginning of external RAM, and place the .data, .bss, and heap to be located further along? If not, can I declare my own memory section, separate from the .noinit section, starting at the beginning of external RAM, before any of the .data or .bss sections, and forced to be non-initialized at start-up?