This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS-RTOS: stack size to create a thread > 8000

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?