avr-gcc-list
[Top][All Lists]
Advanced

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

Re: AW: [avr-gcc-list] stack layout


From: John Altstadt
Subject: Re: AW: [avr-gcc-list] stack layout
Date: Fri, 24 Jun 2005 06:31:16 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050327)

Russell Shaw wrote:
> Haase Bjoern (PT-BEU/EMT) * wrote:
> 
>> Joerg Wunsch wrote
>>
>>> No, you cannot perform overlap checks for the stack anyway, at not
>>> least useful ones. [snip] and if
>>> you as the programmer are changing that model, it's your
>>> responsibility to ensure there's enough room for the stack.

>> Actually it seems that there is a feature of gcc (yet unsupported by
>> the AVR port) to switch on stack-checks at runtime each time new space
>> on the stack is needed. Of course this would slow down execution, but
>> I think that implementing this could be *very* helpful for debugging
>> and testing purposes.

> 
> At strategic points you could do:
> 
>   size_t freespace = alloca(0) - sbrk(0) + 1;

A common technique with bigger systems is to write a known value to the
entire stack space at startup and then supply a user test function that
will scan the allocated stack for that value. The upside is that there
is no run-time impact. The downside is that you have to provide some
sort of minimal user interface to run this test function on the bench
and give the tester some meaningful results.




reply via email to

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