Stack

Posted by Oren La on March 17, 2008
Hello

I read the the documents about FreeRTOS and i have a some questions
concerning the stack.

I saw that when i call to : xTaskCreate(...) i have to give it a
stack depth parameter.
- What will be saved in this stack?
- Is it true that this stack is create by memory allocation?
- In a context switch the regs,flags,... will be saved to the stack,
how this RTOS handle and position this data to every task?

Thanks

RE: Stack

Posted by Dave on March 17, 2008
The stack used by the task is just like any stack used in a C program. There is nothing special or different about it.

RE: Stack

Posted by Oren La on March 17, 2008
So why do i need the stack depth parameter?

RE: Stack

Posted by JMR on March 18, 2008
You need to specify the stack size for each task so that the OS can reserve this amount from the available heap memory.
The compiler only knows about stack pointer it doesn't do any per task stack allocation. This is done by the RTOS, which doesn't know how much memory a particular task will require during runtime...