In C, how do you calculate stack_size for cogstart ?
twm47099
Posts: 867
In the Propeller C - Functions Tutorial Multicore Example, the General Multicore Setup has the following statements regarding stack size:
"Declare a stack array with 40 longs (required) + extra for local variables and calculations. Be liberal with the extra memory, and use testing to pare it down after your prototyping is done.
Example: unsigned int stack[40 + 25]; "
Are there general rules to calculating stack size (based on things like number and type of parameters, variables, if-statements, etc.)? Is there C-code to evaluate a cog's stack needs once the program is running (like there are for Spin programs)? Or is the method of testing simply trial and error (start big and keep cutting until something bad happens)?
Thanks,
Tom
"Declare a stack array with 40 longs (required) + extra for local variables and calculations. Be liberal with the extra memory, and use testing to pare it down after your prototyping is done.
Example: unsigned int stack[40 + 25]; "
Are there general rules to calculating stack size (based on things like number and type of parameters, variables, if-statements, etc.)? Is there C-code to evaluate a cog's stack needs once the program is running (like there are for Spin programs)? Or is the method of testing simply trial and error (start big and keep cutting until something bad happens)?
Thanks,
Tom
Comments
http://forums.parallax.com/showthread.php/152866-In-C-how-do-you-calculate-stack_size-for-cogstart