I set up some values in the .noinit section but when I call srand() they are overwritten. The disassembly and memory map shows why:
00007BDA LDI R26,0x00 Load immediate 00007BDB LDI R27,0x00 Load immediate 00007BDC STS 0x2009,R24 Store direct to data space 00007BDE STS 0x200A,R25 Store direct to data space 00007BE0 STS 0x200B,R26 Store direct to data space 00007BE2 STS 0x200C,R27 Store direct to data space 00007BE4 RET Subroutine return
.noinit 0x00802008 0x6 0x00802008 PROVIDE (__noinit_start, .) *(.noinit*) .noinit 0x00802008 0x6 rtc.o 0x00802008 RTC_valid 0x00802009 rtc_time_AT 0x0080200e PROVIDE (__noinit_end, .) 0x0080200e _end = .
Note that I forced .noinit to address 0x2008 because I also have a bootloader that needs to run without trashing that section, and if you just leave the compiler to assign it then it ends up at some random position that can't be replicated.
Is there any way to fix this? The only thing I can think of is to relocate .noinit to somewhere else, perhaps the top of SRAM, but that could cause other problems. Actually there is another way; write my own rand() and srand() functions.