[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Linker options to report RAM overflow
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Linker options to report RAM overflow |
Date: |
Mon, 14 Sep 2009 15:22:32 -0600 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Vaclav Peroutka
> Sent: Monday, September 14, 2009 10:33 PM
> To: address@hidden
> Subject: [avr-gcc-list] Linker options to report RAM overflow
>
> Hello all,
>
> today I did some experiments with long buffers and
> accidentally set buffers longer than 1kB on ATMEGA16. The
> only visible problem was that printf() stopped working. One
> hour later I noticed that I have too long buffers.
>
> Can I force linker to shout in such situation ?
>
Take a look at the first diagram on this page in the avr-libc user manual:
http://www.nongnu.org/avr-libc/user-manual/malloc.html
The stack grows downwards, and there is no way to set in the toolchain a bottom
value to that stack. Also, if you use dynamic memory allocation (malloc) the
heap grows upward, again without a preset boundary. This means that there is
not a way that the toolchain will know that there is a stack overflow, or data
overflow, because that is only discovered at run-time.