> -----Original Message----- > From: avr-gcc-list-bounces+eric.weddington=atmel....@nongnu.org [mailto:avr- > gcc-list-bounces+eric.weddington=atmel....@nongnu.org] On Behalf Of Bill > Westfield > Sent: Friday, January 27, 2012 4:28 PM > To: avr-gcc-list@nongnu.org > Subject: Re: [avr-gcc-list] Weird optimization issue with avr-gcc 4.5.3,re > "naked." > > > Though I'm not sure I understand why the original complaint was considered a > bug. They appear to have been counting on a naked C function to fall in at the > top and fall out at the bottom, which seems like even more of an abuse of > "naked" than I was using (though I guess allowing that behavior is useful, > especially in init code.)
Well, ideally, it should just be a non-main function that is set up as "naked" and placed in a .initN section. That means it doesn't have a function prologue and epilogue, i.e. it's not called from anywhere and doesn't return anywhere; it just runs "in line", which is what you need to put C code in a .initN section. The main function should still be set up as a "OS_main" function, i.e. it doesn't return anywhere. Subtle differences. But I thought that all this was described in the avr-libc user manual (and/or GCC manual). If not, then maybe we need to add something to the avr-libc FAQ. Eric _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list