This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr stack size configurations

I've added some debug information to the build of my application.  The added stack usage has caused some threads (USB, BLE) to overflow the stack and cause random crashes.  How can we tell what threads will be created and what stack sizes are needed when various config options are set?

I've been looking in the SES threads view (after creating a threads script) to look at the stack sizes, then just making most stack sizes much larger.  Some of the config options I'm trying are shown below.  Most take effect.  The CONFIG_BT_HCI_TX_STACK_SIZE does not seem to take effect though, it is 1024 instead of 4096.  Any idea why?  Or any debug tips on how to tell where and why a config value ends up with its final value after merging?

CONFIG_NO_OPTIMIZATIONS=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_THREAD_MONITOR=y
CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_NAME=y

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_USB_NRFX_WORK_QUEUE_STACK_SIZE=4096
CONFIG_USB_WORKQUEUE_STACK_SIZE=4096
CONFIG_BT_RX_STACK_SIZE=4096
CONFIG_BT_HCI_TX_STACK_SIZE=4096
CONFIG_BT_RPMSG_NRF53_RX_STACK_SIZE=4096

Parents Reply Children
Related