#include <nitro/os.h>
void OS_SetIrqStackWarningOffset( u32 offset );
offset | The warning level offset |
None.
Sets the warning level used to check the stack overflow of the stack used in IRQ mode.
This function writes the magic number at the top and bottom of the stack used for IRQ mode, and checks to see if they were rewritten. OS_SetIrqStackWarningOffset()
lets you set the warning level in the middle, top, or bottom of the stack, and specifying a magic number to check if those sections have been rewritten. The magic numbers at the top and bottom of the stack are written whenever OS_Init()
is called.
The reason for setting a magic number in the middle of the stack is to detect if a stack overflow may occur before the stack is completely used and operation becomes unstable.
offset
is the number of bytes from the bottom of the stack and must be a multiple of 4. Setting zero cancels this setting.
If the magic number is written in the middle of the stack and section is currently being used, operation may become unstable. Therefore, avoid setting this inside the interrupt handler. Normally, you should set this setting immediately after the program has started.
Example:OS_SetIrqStackWarningOffset( 0x100 );
:OS_CheckIrqStack( void );
OS_CheckIrqStack, OS_GetIrqStackStatus
07/15/2005 Initial version.