2020-12-05 10:19 AM
Hi,
I'm using STM32H745 and CM4 core runs with RTOS. I am not able to create the second task because xtaskcreate() does not return pdPASS. It seems like it can't allocate enough memory. I tried to create 2 tasks with stack depth equal to 1024. If I reduced the size to 2x 512, the task runs properly.
What is the reasons of this behavior? The stack is too small? Can I somehow fix this behaviour and create more tasks?
Ragards,
2020-12-05 02:26 PM
How is your HEAP SIZE in rtos conf ? You need increase it ...
2020-12-06 02:34 AM
the configTOTAL_HEAP_SIZE in FreeRTOSConfig.h is defined as ((size_t)15360).
2020-12-06 02:51 AM
We can help quick when you show code, have you default task + 2? When yes how size is defalt task stack ?
Set TOTAL%HEAP to 32768 dont help ?
???
2020-12-06 09:03 AM
I have default task that starts other tasks and then it is deleted. The stack of the default task is 512. I tried to start 2 taks with 1024 inside the default task. I will try to increase total heap size but it seems to be enough for this 2 tasks.
2020-12-06 10:46 AM
Im not expert on rtos, but idea create task in other task after osStart and then delete creator task is maybe source of your troubles.
My usag eis exactly in main prepare all tasks, then start OS , and leave all task do jobs.
2020-12-07 09:27 AM
It can't be. It is common used technique to keep your code clean when you have to start a lot of tasks.
I debug more deeply and I realized that I'm going out of the defined total heap sized as you said. I didn't expect this behavior because on the nucleo-f103rb the total heap was defined much less and everything worked fine. On stm32h7 even 15360 for 2 task 1024 is not enough. This problem is fixed but unfortunatelly that core hangs somewhere where I am trying to take semaphore. After reducing stack size again to 512 everything start working fine.
For now thanks for your engagement.
Ragards,
2020-12-07 10:05 AM
Heap size is in bytes when i right rememmber, and stack is words 32 then two task with 1024 need 8192 bytes HEAP, but as you say , dynamic creating tasks is possible, but need clean release resources. Maybe bug or bad setup rtos, but i dont help with this.8)