TSK_checkstacks
2-482
C Interface
Syntax
TSK_checkstacks(oldtask, newtask);
Parameters
TSK_Handle oldtask;
/* handle of task switched from */
TSK_Handle newtask; /* handle of task switched to */
Return Value
Void
Description
TSK_checkstacks calls SYS_abort with an error message if either
oldtask or newtask has a stack in which the last location no longer
contains the initial value TSK_STACKSTAMP. The presumption in one
case is that oldtask’s stack overflowed, and in the other that an invalid
store has corrupted newtask’s stack.
TSK_checkstacks requires that the stack was initialized by DSP/BIOS.
For dynamically-created tasks, initialization is controlled by the
initstackflag attribute in the TSK_Attrs structure passed to TSK_create.
Statically configured tasks always initialize the stack.
You can call TSK_checkstacks directly from your application. For
example, you can check the current task’s stack integrity at any time with
a call like the following:
TSK_checkstacks(TSK_self(), TSK_self());
However, it is more typical to call TSK_checkstacks in the task Switch
function specified for the TSK manager in your configuration file. This
provides stack checking at every context switch, with no alterations to
your source code.
If you want to perform other operations in the Switch function, you can do
so by writing your own function (myswitchfxn) and then calling
TSK_checkstacks from it.
Void myswitchfxn(TSK_Handle oldtask,
TSK_Handle newtask)
{
`your additional context switch operations`
TSK_checkstacks(oldtask, newtask);
...
}
Constraints and
Calling Context
❏
TSK_checkstacks cannot be called from an HWI or SWI.
TSK_checkstacks
Check for stack overflow