module ti.mcu.msp430.runtime.utils.Stack

Stack monitoring functions

This module provides simple stack monitoring operations that enables an application efficiently monitor the system's worst-case stack usage. [ more ... ]
C synopsis target-domain sourced in ti/mcu/msp430/runtime/utils/Stack.xdc
DETAILS
This module provides simple stack monitoring operations that enables an application efficiently monitor the system's worst-case stack usage.
Stack overruns are a common problem in embedded development and they result in intermittent and difficult to reproduce failures. The ability to quickly determine of unexpected behavious is the result of a stack overrun can save hours of debug time.
 
struct Stack_Status

Stack status information buffer

C synopsis target-domain
typedef struct Stack_Status {
    Int unused;
    // number of words never used (so far)
    Int used;
    // worst-case number of words used (so far)
    Int curDepth;
    // current number of words on the stack
} Stack_Status;
 
 
config Stack_UNUSED  // module-wide

Unused stack space event

C synopsis target-domain
extern const Log_Event Stack_UNUSED;
 
 
Stack_check()  // module-wide

Return non-zero if stack pointer is within allocated stack

C synopsis target-domain
Bool Stack_check();
 
DETAILS
If this function returns 0, the current stack pointer is pointing to a location _outside_ the caller's allocated stack.
 
Stack_fill()  // module-wide

Fill unused stack with initial value

C synopsis target-domain
Void Stack_fill();
 
DETAILS
This function is called at startup and may be called at runtime to re-initialize the stack. However, interrupts must be disabled during this process (to prevent corruption of ISR state).
 
Stack_getStatus()  // module-wide

Get number of words of unused stack space

C synopsis target-domain
Void Stack_getStatus(Stack_Status *stat);
 
 
Stack_getUnused()  // module-wide

Get number of words of unused stack space

C synopsis target-domain
Int Stack_getUnused();
 
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Stack_Module_id();
// Get this module's unique id
 
Bool Stack_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Stack_Module_heap();
// The heap from which this module allocates memory
 
Bool Stack_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Stack_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Stack_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
XDCscript usage meta-domain sourced in ti/mcu/msp430/runtime/utils/Stack.xdc
var Stack = xdc.useModule('ti.mcu.msp430.runtime.utils.Stack');
module-wide constants & types
        obj.unused// number of words never used (so far) = Int  ...
        obj.used// worst-case number of words used (so far) = Int  ...
        obj.curDepth// current number of words on the stack = Int  ...
module-wide config parameters
        mask: Diags.USER1,
        msg: "unused stack space = %d words"
    };
 
 
 
struct Stack.Status

Stack status information buffer

XDCscript usage meta-domain
var obj = new Stack.Status;
 
    obj.unused = Int  ...
    // number of words never used (so far)
    obj.used = Int  ...
    // worst-case number of words used (so far)
    obj.curDepth = Int  ...
    // current number of words on the stack
 
C SYNOPSIS
 
config Stack.UNUSED  // module-wide

Unused stack space event

XDCscript usage meta-domain
Stack.UNUSED = Log.EventDesc {
    mask: Diags.USER1,
    msg: "unused stack space = %d words"
};
 
C SYNOPSIS
 
metaonly config Stack.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
Stack.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
generated on Tue, 01 May 2012 02:42:24 GMT