NAME

checkIstack - Thread and interrupt stack information

SYNOPSIS

#include <pthread.h> - or -
#include <sys.h>

int pthreadStackFill;
int _isrStackFill;
extern void checkIStack(void);

DESCRIPTION

The checkIStack() function is used to print high-water mark information on the thread and interrupt stacks to the debug channel.

To utilize checkIstack(), both the thread and interrupt stacks must be initalized to known values through the use of the pthreadStackFill and _isrStackFill initialization variables.

These variables are assigned a non-zero value before kernel initialization to enable stack monitoring.

EXAMPLE

During the initial startup (typically within setup.c), the control flags to fill the thread and interrupt stacks may be set to a non-zero value to enable monitoring.

Enabling a flag causes that particular stack area to be filled with a known value ("S" for the thread stack and "I" for the interrupt stack) when they are created subsequently by the kernel.

After the kernel has started and the initial user thresd is established a call can be made to checkIstack() to send the stacks high-water mark information through the debug channel. The checkIstack() function utilizes the xprintf() debug function to send the information.

Additionally, the RTOS Viewer can be used to visualize either stack fills and is aware of the convention.

#include 

/* the inital startup function. */
int main()

{
    /*disable all interrupt in interrupt controller */
    __disable_irq();

    /* 1 - fill the task stack with 'S' during initialization for debugging. */
    pthreadStackFill = 1;
  
    /* 2 - fill the isr stack with 'I' during initialization for debugging. */
    _isrStackFill = 1;

    /* ... the rest of the initialization code ... */
}

After the kernel has been established, any arbitrary thread may then call checkIstack() to send stack information to the debug channel.

/* some arbitarty thread. */
THREAD threadx ()
{
    extern void checkIstack ();

    /* call checkIstack to send information to the debug channel. */
    checkIstack ();

    /* ... other code... */
}

The checkIstack() function will format result similar to:

ISRSTACK size:200 unused:200
Thread:20000564 base:20000604 size:512 unused:340

RETURN VALUES

None.

ERRORS

There are no errors defined.

SEE ALSO

pthread_stackinfo(), xprintf()


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2011 >