[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Weird optimization issue with avr-gcc 4.5.3, re "nake

From: Weddington, Eric
Subject: Re: [avr-gcc-list] Weird optimization issue with avr-gcc 4.5.3, re "naked."
Date: Fri, 27 Jan 2012 18:28:47 -0700

> -----Original Message-----
> From: address@hidden
> address@hidden On Behalf Of
> Westfield
> Sent: Friday, January 27, 2012 4:28 PM
> To: address@hidden
> Subject: Re: [avr-gcc-list] Weird optimization issue with avr-gcc
> "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
> "naked" than I was using (though I guess allowing that behavior is
> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]