Workq stack size confusion


Christoph Schramm <schramm@...>
 

Dear All,

 

I’m really confused about the workqs at the moment.

I want to implement a modem driver and for that I need a Workq to process AT commands sequentially. Idea was, to have multiple structs carrying info about the stacks, so I tried to create a “device context struct” like this:

 

struct uart_dev_ctx {

  struct k_thread rx_thread;
  struct _k_thread_stack_element* rx_thread_stack;

}

 

But it seems this is not legal, because when accessing the stack, I immediately get MPU faults.

 

This is how I simply assign it:

dev_ctx.rx_thread = quectelmdm_rx_thread;
dev_ctx.
rx_thread_stack = quectelmdm_rx_stack;

 

I checked with

STACK_ANALYZE("RX stack", dev_ctx.rx_thread_stack);

And it gives “4” (which is the alignment size)

 

While

STACK_ANALYZE("RX stack", quectelmdm_rx_stack);

gives 1024 which is correct and the real size

 

Any suggestions how I can share Stacks with structs?

 

Thanks,

Chris

Join devel@lists.zephyrproject.org to automatically receive all group messages.