[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Stack use - possible bug
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Stack use - possible bug |
Date: |
Wed, 9 Jun 2010 07:16:08 -0600 |
You need to use the "noinline" function attribute on the initialise() function.
See here:
<http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Function-Attributes.html#Function-Attributes>
Eric
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Dale
> Sent: Wednesday, June 09, 2010 6:43 AM
> To: address@hidden
> Subject: [avr-gcc-list] Stack use - possible bug
>
> Hi
>
> Stumbled onto this due to dire shortage of ram and monitoring stack
> usage. To get an idea of whether it was enough, etc.
>
> I'll try and put together sample code which replicates it but the
> scenario for now is:
>
> static void initialise(void)
> {
> char buf[50]; // some data
>
> // call a bunch of functions
> }
>
> int main(void)
> {
> initialise();
>
> // bunch of stuff
> }
>
> Now, initialise() is only ever called once and therefore is optimised
> and included inline into main().
>
> What I find is that space used by buf[] is never released from the
> stack. There may in fact be more since initialise() calls a
> whole bunch
> of other functions, some of which may or may not have variables on the
> stack and/or be one-off functions and as a result 'rolled-into' code
> that then forms main().
>
> Given my constrained setup, its critical that this stack
> space is freed.
>
> Anyone come across this? Is it a known issue?
>
> --
>
> Cheers,
>
> Dale.
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
Re: [avr-gcc-list] Stack use - possible bug, Dale, 2010/06/09