In a program I'm working on we have exhausted close to all available RAM. I would like to check if the stack is eating into the data segment.
Of course I could fill the SRAM with a pattern with some .init code, but I would prefer to check the last variable in the data segment rather than an area of unused SRAM (which could be only 1 or 2 bytes, anyway).
I have a variable which is unused in a normal program flow. Now I'm trying to move this variable to the end of the data section.
Since I'm not extremely confident with linker scripts, I have a (stupid) question.
In the standard linker file (avr5.x) the section .noinit follows .bss. If my variable is the only one which is declared as .noinit, then this should be enough to ensure that my variable is linked as the last variable in SRAM. It works for me, but I'm not sure if it is a sound way of doing it.
Are there better ways of doing it, possibly without defining my own linker script?
I'm using avr-gcc (GCC) 4.2.2 (WinAVR 20071221)