OS_SetIrqStackWarningOffset

Syntax

#include <nitro/os.h>
void OS_SetIrqStackWarningOffset( u32 offset );
  

Arguments

offset The warning level offset

Return Values

None.

Description

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 );

See Also

OS_CheckIrqStack, OS_GetIrqStackStatus

Revision History

2005/07/15 Initial version.


CONFIDENTIAL