Hi,
I am trying to create a new task using a statically allocated stack.
Here is my code:
static struct task_tcb_s tcb;
static uint8_t stack[CONFIG_NETWORK_THREAD_STACKSIZE]
void start_my_thread()
{
memset(&tcb, 0, sizeof(struct task_tcb_s));
tcb.cmn.flags = TCB_FLAG_TTYPE_TASK;
int ret = nxtask_init(&tcb, "Network", CONFIG_NETWORK_THREAD_PRIORITY,
stack, CONFIG_NETWORK_THREAD_STACKSIZE, network_th, NULL);
if (ret < 0)
{
//error handling...
}
nxtask_activate(&tcb.cmn);
}
This new thread seems to be working OK (I haven't done any extensive
testing yet), but running ps in nsh yields:
5 80 FIFO Task --- Ready 00000000 008156 008156
100.0%! Network
The stack is always reported as 100% full. I tried increasing it to
excessive numbers but it still.
I believe that I have configured something wrong? Or this is not the
correct way to init a task with a static stack?