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

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

RE: [avr-gcc-list] Global Memory


From: Weddington, Eric
Subject: RE: [avr-gcc-list] Global Memory
Date: Sat, 19 Apr 2008 10:33:31 -0600

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of John Wicking
> Sent: Sunday, April 13, 2008 6:21 PM
> To: Avr List
> Subject: [avr-gcc-list] Global Memory
> 
> I am using a AT90USB1287 with code based on the HOST CDC.
> I have been having a problem with the Watch dog timer.
> It would get tripped but then the MCU ran but would not go 
> back to the reset vector.
> 
> The build was reporting I had used 4671 Bytes of Data memory 
> and this was 57%
> I had a floating point array which had 600 members which was 
> set up as a global.
> I dropped the array size down to 150 entries and the program worked.
> It failed at 300 entries. 
> 
> It looks like there is a limit on global memory since I can 
> set up an array in the main() of
> 450 entries and the Watch Dog runs fine.
> 
> If there is a limit, does anyone know how to adjust it.
> 

According to the avr-libc user manual, your global data is stored in the
lower part of RAM. Your stack starts at the top of RAM and it grows
downward. If you are doing any dynamic memory allocation (malloc()) then
the memory is allocating starting right above the global data and grows
upward (towards the stack).

Considering that your global data is at 57%, and what is left over is
for your stack and any dynamic memory allocation, it sounds like you
might potentially have a stack overflow problem, just with the
information that you've given.

Eric




reply via email to

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