I ran into some trouble a while back where certain locations in the SRAM upon power up contained some bogus values and this was traced to having a USB-Serial converter plugged in when power was cycled. In effect, the converter was powering the AVR through the protection diodes.
In my current project I rely on the .noinit section to save state across an external reset. The problem is now I cannot fully rely on the SRAM being initialised to 0 when power is applied. I can differentiate a power on reset from an external reset so I suppose one way to do this is put all my variables that reside in the .noinit section in one module and initialise these when I detect the power on reset flag but I would like to know if I can use a more elegant method, something like how the AVR libc initialises the .bss section upon reset. Particularly if I go on to develop other programs that might have a lot more data residing in the .noinit section.
I know the .noinit section is defined within a linker script so are there any variables I can access (by marking with extern) that can tell me the offset and size of particular sections?
Thanks for any help