We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I use printf in a thread. like the following code:
void task1(void) { while(1) printf("hello!\n"); }
void task2(void) { while(1); }
Finally, the program run in to OS_ERR_STK_OVF.
increase RTX task stack size...?
OS_TASKCNT set to 6 and OS_STKSIZE set to 50. => the program have OS_ERR_STK_OVF.
OS_TASKCNT set to 2 and OS_STKSIZE set to 50. => the program is ok.
OS_TASKCNT set to 6 and OS_STKSIZE set to 200. => the program is ok.
How size do ARM C lib require? Where i can find this information?
Here the reply that I got once from Keil support for similar question: " The printf/sprintf functions use more stack. I think this depends on the print parameters and print format (%s,%d,... etc).
I cannot tell you the exact usage of stack for printf/sprintf. " (End of citation)
So, you can measure by yourself the stack usage of specific calling, by filling the stack with constant before and examine how much of these values was destroyed after running the function.
I'll be happy to hear about printf implementation that uses less stack or about a way to calculate the stack consuming without actually running the code.
But Moshe, using "--info=summarystack" in the linker tab will generate a lot of useful stack usage related statistics...
Tamir