Hi all,
i am totally new to FreeRTOS. Please excuse me if the query below sounds silly.
xTaskCreateStatic()
function accepts as parameter a StackType_t stackbuffer[]
, which the newly created task is going to use as it’s stack. i have the following function -
createNewThread(Function_t, unsigned int stackSize, void * function_parameter)
Function_t - The function to run as the new task.
stackSize - The size of the stackbuffer
to be sent t xTaskCreateStatic()
function_parameters - parameter required the Function_t
From this function i want to call xTaskCreateStatic()
and provide it with a static array StackType_t stackbuffer[] of size unsigned int stackSize
. But declaring static array of non static size is not possible. i cannot declare an array like this - static StackType_t stackbuffer[stackSize]
inside the createNewThread()
.
I want to know that if i create a stackbuffer
of maximum size required for the application and pass it to xTaskCreateStatic()
and with it in the ulStackDepth
parameter of xTaskCreateStatic()
i pass the stackSize (received as parameter in
createNewThread()`` ) that the newly created task should use as its stack, will it work properly or not.
I mean will the task be created in such a way that it will only use that amount of the stack which is specified by the parameter ulStackDepth
?
If not then it would be great if any one can provide me with a suggestion to handle this situation.