#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 check mechanism involves writing the magic numbers for the top and the bottom of the stack used for IRQ mode in advance and determining whether those magic numbers have been overwritten. In addition to the top and bottom, OS_SetIrqStackWarningOffset()
can be used to set the warning level in between the top and bottom, and to write a magic number to be able to check whether the section has been overwritten. The magic numbers at the top and bottom of the stack are written when OS_Init()
is called.
The reason for setting a magic number in the middle of the stack is to detect whether a stack overflow may occur before the stack is completely used and operation becomes unstable.
offset
is the number of bytes from the bottom position of the stack and needs to be a multiple of 4. Setting zero cancels this setting.
A magic number is written in the middle of the stack, so operation might become unstable if the section is currently being used. 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
2005/07/15 Initial version.
CONFIDENTIAL