task memory stack size

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Thu Dec 15 19:13:57 UTC 2005

Samuel Bitton wrote:
> Hi
> I've recently had a problem with my software which was due to the fact that I was not allocating sufficient stack size for a task.
> If not enough stack size is allocated to a task when created, I would have expected rtem_task_create to return the error RTEMS_INVALID_SIZE, but it was not the case.
> So is there a way of finding out that the stack size allocated to tasks is sufficient?

The RTEMS minimum stack size is only intended to be sufficient
to run hello world and do things like call printf() from the
top level task.  If you have deep call chains, recurision, or
large data allocated on the stack, all bets are off on how much
you will need.

Actual stack usage is completely application dependent.

You can confiure the stack checker and periodically
print reports of usage.  This is important when making sure
you aren't getting close.  Also it checks for stack overflow
on each context switch so there is a good chance, it will detect
overflow situations.

> Thanks
> Sam

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list