On Tue, Jul 3, 2012 at 2:21 PM, Weddington, Eric <eric.wedding...@atmel.com> wrote:
> Avr-libc user manual, section on Memory Sections: > > http://www.nongnu.org/avr-libc/user-manual/mem_sections.html > > According to that, it looks like .init2. I'm very familiar wit that section. It says the stack pointer is set, so call/returns can be used thereafter etc. Beyond that it does not say anything about the frame pointer. As all of this .initX stuff is not standard C, other than bss being zeroed before main() starts, there may be no reason that the frame pointer should be valid at this point, and this is simply a documentation issue that should have a warning added. > A disassembly of the whole program should allow you to verify what happens in > the .initX sections. Did that, that is where the code I posted came from. Looks to me like r28/r29 is set in .init2, however it does not seem to be preserved until main() sets it again, then it is preserved there after. > I'm not sure why your program doesn't seem to work... It does not work because the code I posted is overwriting a structure array that was initialized in an earlier .init8 section, and is now filed with zeros because of the errant frame pointer. Its not a question of why my code is broken, but a question of should it be broken? All my, relevant to this issue, code is in C. I'm not doing anything with the registers. Is the frame pointer guaranteed to be preserved from the time it is set in .init2 until it is used in main(), across all of the .initX sections (which are *not* proper functions with the normal epilog/prologs that would push/pop the r28/r29 pair)? It does not look like it is from the listing, and certainly does not behave like it is. I make heavy use of the .initX sections, however only the one has anything put on the stack, which is what I posted. -- http://blog.softwaresafety.net/ http://www.designer-iii.com/ http://www.wearablesmartsensors.com/ _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list