Indeed I was expecting arm_usestack() to do the colorization, but apparently it doesn't.
I cannot have my application code to colorize the stack, as a call to arm_stack_color() is needed. This is not exposed to the application as far as i can tell. > Also Assuming ARM it has to be 8 byte aligned. So you need attributes on > your variable called stack to set the alignment. Indeed I have actually aligned the stack, but didn't include it in the example code. Στις Σάβ, 6 Φεβ 2021 στις 4:49 μ.μ., ο/η David Sidrane < david.sidr...@nscdg.com> έγραψε: > You have to init the memory used for the stack: > > Have a look in the normal tasking init , and you will see the call out to > init the stack, that you neeed to call. > > Also Assuming ARM it has to be 8 byte aligned. So you need attributes on > your variable called stack to set the alignment. > > David > -----Original Message----- > From: Fotis Panagiotopoulos [mailto:f.j.pa...@gmail.com] > Sent: Saturday, February 06, 2021 6:08 AM > To: dev@nuttx.apache.org > Subject: Task with statically allocated stack > > 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? >