FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2006 Threads] How to measure task stack size?Posted by Nobody/Anonymous on January 4, 2006 How we can evaluate the task stack size? Is there anyway to find task stack overflow?Ways to preventing this problem?
RE: How to measure task stack size?Posted by Richard on January 4, 2006 Which processor are you using?
There are a couple of options.
Take a look at the function usTaskCheckFreeStackSpace() in tasks.c. This is what the uIP demo (http://rtosdemo3.redirectme.net) uses to print out the free stack space of every task (link will probably only work from residential computers as most office firewalls will block the nonstandard port number). Note this function disables interrupts for a while so is not a good idea other than for testing.
Secondly the TCB contains pointers to both ends of the stack, so it is easy to see if the two are getting lose. In the task context switch function you could check for this. I don't do it in the download code because obviously it increases the context switch time - but it may be a trade of you like.
Regards.
RE: How to measure task stack size?Posted by Nobody/Anonymous on January 4, 2006 you said: "Secondly the TCB contains pointers to both ends of the stack, so it is easy to see if the two are getting lose. In the task context switch function you could check for this. I don't do it in the download code because obviously it increases the context switch time - but it may be a trade of you like."
In debug mode using AVR Jtag,How we can it what variables I should check? where I can place breakpoint?
RE: How to measure task stack size?Posted by Jeff Smith on January 4, 2006 CurrentStackSpace = pxCurrentTCB->pxTopOfStack - pxCurrentTCB->pxStack;
-or-
I often wonder how full it got, not just how full it is now. My port fills 0xA5 to initialize stack space. Most often it works to start at *pxCurrentTCB->pxStack and count all the '\xa5' bytes to see how close I've been to overflowing. And it's always better to have a little more than you ever see used.
RE: How to measure task stack size?Posted by Nobody/Anonymous on January 5, 2006 CurrentStackSpace = pxCurrentTCB->pxTopOfStack - pxCurrentTCB->pxStack;
Assuming the stack is growing down ;-)
You can place this code immediately before the context switch.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|