Having the system hang when increasing FreeRTOS task stack. Fixed in WICED.mk. Is that correct?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiRo_263836
Level 5
Level 5
100 replies posted 50 likes received 50 replies posted

I was having the system hang if I increased any of the these stack sizes.

// For static tasks: Carefully check the size + align the buffers and stacks to base 8

StackType_t ConfigIDStack[ CONFIG_TASK_STACK_SIZE ];

StackType_t ICM20948Stack[ IMU_TASK_STACK_SIZE ];

StackType_t BQ28411Stack[ BAT_TASK_STACK_SIZE ];

StackType_t UIStack[ UI_TASK_STACK_SIZE ];

StackType_t SFlashStack[ UI_TASK_STACK_SIZE ];

StackType_t DebugStack[ UI_TASK_STACK_SIZE ];

StackType_t USB_HS_Stack[ UI_TASK_STACK_SIZE ];

StackType_t WIFIStack[ UI_TASK_STACK_SIZE ];

StackType_t BlueStack[ UI_TASK_STACK_SIZE ];

StackType_t RTCStack[ UI_TASK_STACK_SIZE ];

StackType_t OTAStack[ UI_TASK_STACK_SIZE ];

I increased the global stack size to 4000 from 800 in WICED/WICED.mk:  

# Define the default ThreadX and FreeRTOS starting stack sizes

FreeRTOS_START_STACK := 4000 #800 = old value

Is this OK?  Is this the best place to do this or is there another place?

0 Likes
1 Solution
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

You can increase the stack size while creating the tasks by xTaskCreate().

For example,

You can increase the APPLICATION_STACK_SIZE by declaring the following in the application make file:

GLOBAL_DEFINES += APPLICATION_STACK_SIZE = <req_size>

or you can change the WICED_DEFAULT_APPLICATION_STACK_SIZE in 43xxx_Wi-Fi\include\wiced_defaults.h

FYI:

The task stack utilization can be checked by using vTaskList() API.

Declare a buffer and pass that buffer to this API. The buffer is filled with the stack usage. You can print this buffer for stack utlization.

Note: You will have to enable configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS to be able to use this API.

These parameters are defined in 43xxx_Wi-Fi\WICED\RTOS\FreeRTOS\WWD\<MCU>\FreeRTOSConfig.h. Also include ENABLE_TASK_TRACE=1 in the make target.

char str[1024]={0};

...

vTaskList(str);

printf("%s", str);

...

Can you also attach the logs of where the app hangs after increasing the size of FreeRTOS_START_STACK ?

View solution in original post

1 Reply