Forums

Re: How big should I make my stack

Started by mjames_doveridge November 29, 2007
--- In l..., "karelvergauwe" wrote:
>
> Hello,
>
> I have a RTOS system with multiple tasts, but the size of these stacks
> is very different. How can I know how big I should make the stack for
> it? Is it only depending on local variables inside these processes? Or
> should I also look after the global variables wich I use/change inside
> my process?
>
> So if someone knows how I can calculate the size, please let me know
>
> thx

There has been a discussion recently, in this group, about stack sizes
and stack checking - you should search for it.

The stacks holds local variables, call frames and the like. They may
also hold interrupt stack frames, depending on whether you switch to a
seperate stack upon interrupt. Global variables are, well, global and
are not stack-based.

Guesstimating an initial value is a bit of a black art mixed with
trial and error, especially when opaque library routines are used.

I'm afraid that my current system is 'wait till a thread explodes or
acts funny, then add another 10 words of stack'.

Rgds,
Martin

An Engineer's Guide to the LPC2100 Series