Task stack size?

Hi, Does any one know how to determine a stack size when I create a task? Or tell me what factors need to be consider for calculating a task stack size? I have read it from FreeRTOS web stie, but I am still not clear how. I used the demo of Cortex_LM3Sxxxxx_Keil. I tried to figure out how the demo does to determine a stack size. For example, the default configMINIMAL_STACK_SIZE is 70, but I modified it to 250.  I wonder if it is a proper setting.  Also the mainBASIC_WEB_STACK_SIZE for uIP web server was set to configMINIMAL_STACK_SIZE * 3 which the original was 70*3=210. However, since I modified to 250, now it is 250*3=750. Is it waste memory space? Any help will be appreciated.

Task stack size?

As you know, the stack size is determined during the creation of the task.  Determining stack size has never been an automated process. For instance, FreeBSD has a default of 64MB stack for each application thread, and RedHat has 10MB user, and 8kB kernel, etc…  Generally, you should estimate the required stack space for each thread.  If you do have any recursive calling code within your task, you will need to program them for a maximum recursion depth.  FreeRTOS does have a compile mode supporting stack overflow detection, and I plan on having it compiled in automatically with the DEBUG build. -W

Task stack size?

You can also use the uxTaskGetStackHighWaterMark function to determine how much stack has actually been used and fine tune it. Important is that interrupts also use the stack of the task that is interrupted (although I’m not sure if all ports do this) so their usage needs to be added to the task’s own usage.

Task stack size?

Just remember that in FreeRTOS, the stack size is specified as an unsigned portSHORT, which generally means 65535 words max.  -W