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

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

Re: [avr-gcc-list] Stack size question


From: John Yannakopoulos
Subject: Re: [avr-gcc-list] Stack size question
Date: Mon, 28 Jun 2004 18:59:50 +0300 (EET DST)

Hi Teo.

Yes, this is good if you have a multitasking OS, i.e. you reserve RAM
space for each task and you know exactly the ram space (from the
heap...) that each task stack utilizes. I do not have a multitasking
program. I have a monolithic kernel, where interrupts are not nested
(interrupt depth = 1). My scheduler uses a priority queue data structure
where functions may be scheduled from both interrupt and non-interrupt
context. There are some points in time that my kernel crashes and I cannot
find the reason. I'm 99% sure that I do not have race conditions.
Using the 8535, the resources are so tight, having a RAM utilization of
479 bytes (in 512 bytes). That's why I guess it is a stack overflow
problem, but I cannot find a way to determine the point in my code where
the overflow possibly occurs.

Any further suggestion?

Best regards,

--
John Y.

On Mon, 28 Jun 2004, Theodore A. Roth wrote:

> On Mon, 28 Jun 2004, John Yannakopoulos wrote:
>
> > Hi all!
> >
> > I have the following question: Can I determine the maximum stack size
> > of my program? My at90s8535 resets and I suspect that a stack overflow
> > occurs. Is there a tool (maybe from binutils) or some utility to check
> > against stack size?
>
> One trick I use with my multitasking OS is to fill each stack with 0xaa
> at startup. Then I go into a debugging session with the JTAGICE after
> the program has run for a while and do a memory dump of the stack. It's
> usually obvious how much of the stack has been used.
>
> Of course, you can't use JTAGICE with the 8535, but you might be able to
> do something similar in a simulator.
>
> ---
> Ted Roth
> PGP Key ID: 0x18F846E9
> Jabber ID: address@hidden
>


reply via email to

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