Hi
I am using the new CMSIS-RTOS and seem to have a stack problem that I don't understand. In order to create even the simple of task (one that just polls a CAN interface) that will not cause a hard fault when created I cannot use a default thread stack size of 512 or even 4096. I have to declare a user stack size of 8000 bytes just to keep it from causing a hard fault when it is created.
Since the thread itself does not require hardly any memory at all, I assume it is the RTOS that requires the memory in order to start the thread. It does not make any sense to me why so much memory is needed.
I have had to declare user stacks for all of my threads in order to get them created without a hard fault. The system works fine if I do this.
Unfortunately I want to use 14 threads so I cannot continue to use this "work around" or avoid figuring out why the threads need such large stack sizes. This is because there apparently is a limit as to the number of user defined stacks.
Error: "too many threads with user-provided stack size"
My simple thread does not use any buffers and just a few local ints I cannot blame the threads themselves in that they are using too much memory. There is something more central that is causing this minimum of 8000 bytes for me to create a task.
I just cannot figure out what setting or whatever is causing the RTOS to want so much memory.
Does anyone have any ideas as to what I must have set up wrong in RTX_Conf_CM.c or what might be the cause of this per thread memory?
Thanks for your thoughts on this. I am using the new CMSIS-RTOS and not RTX. RTX is the older version.
I did find that I can increase the number of tasks that can have user defined stacks to up to 250 by editing the OS header file. It allows me to continue as I was without diving into why so much memory is required just to make a simple task.
As long as I still have RAM left of course.
Hi Steve,
Did you ever find out what caused the high stack usage? It looks like I'm having the same problem.
I'm now trying to use the user-provided stack size configuration, but no luck yet. Still getting Hard faults.
Dirk