Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 4 months ago.
Number of Threads limit on FRDM-KL25Z
I am using FRDM-KL25Z. My program is multi threaded. Currently I have a total of 6 threads including main. The program works fine. But when I add 7th thread, my program stops working(may be crashing immediately). I read a few question/answers in this forum and found that there is a define OS_TASKCNT which sets the maximum tasks/threads. The define in the mbed-rtos is currently set to 6. So this justifies why adding a 7th thread crashes the program.
So I modified the OS_TASKCNT to say 10. However the program still crashes. I think there is something more that should be changed such as INITIAL_SP (stack pointer). Of course just changing OS_TASKCNT or INITIAL_SP to an arbitrary value is not a solution, because such a change may clash with other configuration parameters such as SP.
Also my multi threaded program is minimal. But a real-life program would need more RAM, which will make the situation worse.
What are those defines in the mbed-rtos that control the number of threads limit in a given target? I need some working real-life solution.
Thanks in advance. -Hemant
Can you not use RTOS and incorporate the threads in your main program. I found it far easier to debug problems by doing this. Not so sure the KL25 is a good chip for RTOS, its a bit slow and short on RAM. Have you tried the same code on your F446 ?
posted by Paul Staron 12 Apr 2016I can always do a single threaded program (only main). Multi threaded approach has + and -. But for my current app need, there is good concurrency which I want to capture in my program. KL25Z is good for my need. Any M4 such as F441 might solve the problem. But I think the problem has nothing to do with whether I use M0 or M4.
posted by Hemant Joshi 12 Apr 2016