- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
I've bought CYW943907AEVAL1F and I developed a firmware that use WiFi and USB as CDC-ACM.
I create some threads using 1024 as stack size.
I observe that WICED resets when I send a particular TCP packet to one of my thread that is waiting for TCP packet.
Today I launch debugger and I notice that there is a "threadx stack overflow". So I decide to increase this thread stack size progressively. This problems disappears when I set thread stack size to 2048.
I observe this problem in another thread , so I have to increase "thread stack size" for this other thread.
My question is : it is possibile that I have to use so large stack size ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
How big a stack should be is one of the most
frequently asked questions about threads. A thread’s
stack area must be large enough to accommodate
worst-case function call nesting, local variable
allocation, and saving its last execution context.
The minimum stack size, TX_MINIMUM_STACK, is
defined by ThreadX. A stack of this size supports
saving a thread’s context and minimum amount of
function calls and local variable allocation.
For most threads, however, the minimum stack size
is too small, and the user must ascertain the worstcase
size requirement by examining function-call nesting and local variable allocation.
Of course, it is always better to start with a larger stack area.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
I just check some stack setting in our release, just for your reference:
#define WWD_THREAD_STACK_SIZE (1248 + 1400) /*(632)*/ /* Stack checking requires a larger stack */
#define P2P_THREAD_STACK_SIZE (5*1024)
/************************************************************************
* Application thread stack size */
#define WICED_DEFAULT_APPLICATION_STACK_SIZE (61440)
#define SUPPLICANT_THREAD_STACK_SIZE ( 4*1024 )
#define TLS_AGENT_THREAD_STACK_SIZE ( 4*1024 )
I think the size change of your customized thread is reasonable, if you want to use smaller stack size, you need to check the thread func usage , thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In which file ?
I believe "WICED.ROTS.ThreadX.WWD.wwd_rtos.h" ...
In this file I found
What do you mean with " thread func usage " ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
How big a stack should be is one of the most
frequently asked questions about threads. A thread’s
stack area must be large enough to accommodate
worst-case function call nesting, local variable
allocation, and saving its last execution context.
The minimum stack size, TX_MINIMUM_STACK, is
defined by ThreadX. A stack of this size supports
saving a thread’s context and minimum amount of
function calls and local variable allocation.
For most threads, however, the minimum stack size
is too small, and the user must ascertain the worstcase
size requirement by examining function-call nesting and local variable allocation.
Of course, it is always better to start with a larger stack area.