I seem to recall seeing a function for
determining the remaining (available) size of the stack. I couldn't
find it in the CW docs, or this mailing list's archive. Does anyone
else recall such a function in CW C for the 568300/E (I'm still on
6.1.2) or Processor Expert?
One co-worker suggested that it might have
been called something like "heap_avail", since some docs refer to
allocating memory (e.g. malloc) from the stack.
I may be remembering from the rev. 5 56800
tools, or rev 4, or just plain mis-remembering.
Thanks in advance.
Rick Corey
Sr. Software Engineer
Reply by Hardeep Gida●July 29, 20052005-07-29
stack_avail or heap_avail
Hi Rick,
There is bean called "DSP_StackCheck" under
SW>>Tools Library in the bean selector window. If you right click and get
help on the bean and go to typical usage it says that it is used to get the size
of the software stack. Hope this is what you're looking for. Good
luck!
Hardeep
From: m...@yahoogroups.com
[mailto:m...@yahoogroups.com] On Behalf Of Corey, Rick Sent:
Friday, July 29, 2005 4:03 PM To: m...@yahoogroups.com Subject: [motoroladsp] stack_avail or heap_avail
Hi All
I seem to recall seeing a function for
determining the remaining (available) size of the stack. I couldn't
find it in the CW docs, or this mailing list's archive. Does anyone
else recall such a function in CW C for the 568300/E (I'm still on
6.1.2) or Processor Expert?
One co-worker suggested that it might have
been called something like "heap_avail", since some docs refer to allocating
memory (e.g. malloc) from the stack.
I may be remembering from the rev. 5 56800
tools, or rev 4, or just plain mis-remembering.
Thanks in advance.
Rick Corey Sr. Software Engineer
Reply by Corey, Rick●July 29, 20052005-07-29
stack_avail or heap_avail
Hi
Hardeep
Thank
you! "DSP_StackCheck" sounds exactly right. I'll give it a try,
but something just came up that means I can't get to it until Tuesday or
Wednesday.
Rick
Corey
-----Original Message----- From: Hardeep Gida
[mailto:h...@instantel.com] Sent: Friday, July 29, 2005 4:13 PM To: Corey, Rick; m...@yahoogroups.com Subject: RE:
[motoroladsp] stack_avail or heap_avail
Hi Rick,
There is bean called "DSP_StackCheck" under
SW>>Tools Library in the bean selector window. If you right click and get
help on the bean and go to typical usage it says that it is used to get the size
of the software stack. Hope this is what you're looking for. Good
luck!
Hardeep
From: m...@yahoogroups.com
[mailto:m...@yahoogroups.com] On Behalf Of Corey, Rick Sent:
Friday, July 29, 2005 4:03 PM To: m...@yahoogroups.com Subject: [motoroladsp] stack_avail or heap_avail
Hi All
I seem to recall seeing a function for
determining the remaining (available) size of the stack. I couldn't
find it in the CW docs, or this mailing list's archive. Does anyone
else recall such a function in CW C for the 568300/E (I'm still on
6.1.2) or Processor Expert?
One co-worker suggested that it might have
been called something like "heap_avail", since some docs refer to allocating
memory (e.g. malloc) from the stack.
I may be remembering from the rev. 5 56800
tools, or rev 4, or just plain mis-remembering.
Thanks in advance.
Rick Corey Sr. Software Engineer
Reply by Ebersman, Howard●July 29, 20052005-07-29
stack_avail or heap_avail
Typically, the way to determine the unused stack space needs to be done
dynamically, since it is dependent on program logic calling different
levels of nesting and interrupt timing.
You can fill the top/bottom half with a known fill pattern (manually
using your program or using a debugger), and then exercise the product for a
long time to hopefully exhaustively test all logic paths. Finally, use the
debugger or a memory peek function to see how much of the fill pattern was
overwritten. The high water mark is your stack usage.
Just be careful not to overwrite any of the stack in use with fill
characters. This can be done using a manual (debugger) fill and a reset of the
processor to fix the overwritten stack space.
Good luck
Howard
-----Original Message----- From: Corey, Rick
[mailto:r...@dpconline.com] Sent: Friday, July 29, 2005 4:03 PM To: m...@yahoogroups.com Subject: [motoroladsp] stack_avail
or heap_avail
Hi All
I seem to recall seeing a function for
determining the remaining (available) size of the stack. I couldn't
find it in the CW docs, or this mailing list's archive. Does anyone
else recall such a function in CW C for the 568300/E (I'm still on
6.1.2) or Processor Expert?
One co-worker suggested that it might have
been called something like "heap_avail", since some docs refer to allocating
memory (e.g. malloc) from the stack.
I may be remembering from the rev. 5 56800
tools, or rev 4, or just plain mis-remembering.
Thanks in advance.
Rick Corey Sr. Software Engineer
The information contained in this message is
confidential and intended only for use of the designated recipient(s) named
above. If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby notified
that you have received this message in error, and that any review,
dissemination, distribution, copying, or alteration of this message is strictly
prohibited. If you have received this communication in error, please notify the
originator immediately and remove it from your system.
Reply by Corey, Rick●July 29, 20052005-07-29
stack_avail or heap_avail
Hi
Howard
That is
a good way to determine the "high water mark". All I need to do at the
moment is see if my stack usage is crawling gradually higher and higher. I
can actually identify the approximate time that "the bad thing
happens".
I'm lucky that this bug is very repeatable (I'm 99+%
confident that it's in my own code - I'm in an early-debug phase and
there's no reason to suspect anything else.)
I came
up with a new pathway in our project to allow a 56F8357 DSP to give relatively
high-level commands to itself, using "task lists" and a timer-tick
task-dispatcher - both of these are new code, semi-tested. When I activate
a certain mode that is intended to make repetitive moves of a stepper motor
according to certain acceleration profiles, directions, and distances, the darn
thing always makes exactly 60 motions, then overwrites one unrelated field
in a structure, then makes 9 more moves and overwrites the state flag that
controls those motions (with the same value that was written into the
unrelated field - and this value changes from run to run).
It does
sound like a rogue pointer or stack corruption or array-limit-transgression -
and I do apparently see about 8 nested invocations of the timer tick, when the
first overwriting occurs, yet the timer tick's first action is to disable
its own IRQ. (However, our stack window is not our most-trusted debugging
tool, perhaps our stationary does not have quite the right mojo.)
I would
assume it was something over-writing the bounds of some array, if I could think
of any array that was being written to progressively during this process.
Curious. Both damaged variables were declared/defined at the top of a .C
file - I'll go look for what arrays are located near them in the memory
map.
I want
to watch the stack size after 50, 60 and 68 motions. When I put a
Watchpoint on the state flag, it does break right at the time this flag goes
crazy - but I don't see the code that overwrites it yet.
By the
way, I can only create Watchpoints that break on Reads or Writes, when I want to
break only on Writes. Does anyone know how to change a Type 3 Watchpoint
to a Write-Only Watchpoint?
I'll let y'all know what I did wrong, when I find it,
hopefully soon after I get back to this on Tuesday or Wednesday. Probably
just a dumb bug.
Thanks
again for the solid and practical suggestion, Howard.
Rick
Corey
-----Original Message----- From: Ebersman, Howard
[mailto:H...@microwavedata.com] Sent: Friday, July 29, 2005 4:36
PM To: Corey, Rick; m...@yahoogroups.com Subject: RE:
[motoroladsp] stack_avail or heap_avail
Typically, the way to determine the unused stack space needs to be done
dynamically, since it is dependent on program logic calling different
levels of nesting and interrupt timing.
You can fill the top/bottom half with a known fill pattern (manually
using your program or using a debugger), and then exercise the product for a
long time to hopefully exhaustively test all logic paths. Finally, use the
debugger or a memory peek function to see how much of the fill pattern was
overwritten. The high water mark is your stack usage.
Just be careful not to overwrite any of the stack in use with fill
characters. This can be done using a manual (debugger) fill and a reset of the
processor to fix the overwritten stack space.
Good luck
Howard
-----Original Message----- From: Corey, Rick
[mailto:r...@dpconline.com] Sent: Friday, July 29, 2005 4:03 PM To: m...@yahoogroups.com Subject: [motoroladsp] stack_avail
or heap_avail
Hi All
I seem to recall seeing a function for
determining the remaining (available) size of the stack. I couldn't
find it in the CW docs, or this mailing list's archive. Does anyone
else recall such a function in CW C for the 568300/E (I'm still on
6.1.2) or Processor Expert?
One co-worker suggested that it might have
been called something like "heap_avail", since some docs refer to allocating
memory (e.g. malloc) from the stack.
I may be remembering from the rev. 5 56800
tools, or rev 4, or just plain mis-remembering.
Thanks in advance.
Rick Corey Sr. Software Engineer
The information contained in this message is
confidential and intended only for use of the designated recipient(s) named
above. If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby notified
that you have received this message in error, and that any review,
dissemination, distribution, copying, or alteration of this message is strictly
prohibited. If you have received this communication in error, please notify the
originator immediately and remove it from your system.