It reports,
- Top of current stack
- Current stack pointer
- Space remaining in stack
- Bottom of the stack
Code: Select all
#include <ucos.h>
char * GetSP_ext()
{
asm( ".global GetSP");
asm( "GetSP:");
asm( " move.l %sp, %d0");
asm( " rts");
}
#define SHOW_STACK_DEPTH() \
{\
iprintf("Stack at line %d of file %s.\n", __LINE__, __FILE__);\
iprintf("Top -- Current -- Rem -- Bottom\n%p -- %p -- %7d-- %p\n", \
OSTCBCur->OSTCBStkTop, GetSP(), GetSP() - (char *)OSTCBCur->OSTCBStkBot, OSTCBCur->OSTCBStkBot);\
}