[Top][All Lists]

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

Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?

From: Don Kinzer
Subject: Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?
Date: Tue, 3 Jul 2012 15:31:32 -0700

>Is the frame pointer guaranteed to be preserved from the time it is set in 
>.init2 until it is used in main() [...]
The *stack pointer* is initialized in .init2 but the *frame pointer*
is not.  Rather, the frame pointer is set up in the prologue for each
function that needs it (i.e. has local storage or takes the address of
one or more parameters).  As I pointed out in an earlier reply, the
"naked" attribute tells the compiler to omit the function prologue and
epilogue which, apparently, also causes the frame pointer setup to be
omitted as well.

I demonstrated how to work around the issue in my second reply.  It
would be useful to add a caveat to the documentation about using local
variables in naked functions.

Don Kinzer

reply via email to

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