SPRUJ79 November 2024 F29H850TU , F29H859TU-Q1
RTINT and NMI use the RTINT stack which is a dedicated hardware stack used for RTINT and NMI context save and restore.
Context save for RTINT and NMI executes the following in hardware automatically upon ISR entry:
Context restore for RTINT and NMI executes the following in hardware automatically upon ISR exit:
To avoid excessive nesting of the RTINT stack leading to stack overflow, the CPU tracks the level of nesting on RTINT and outputs this information to the PIPE.
The first line of defense against stack overflow is the user-configurable RTINT_SP_H.WARNRTISP register field. The number of stack blocks used by the RTINT stack (counted by RTISP) is compared to the level configured in RTINT_SP_H.WARNRTISP. If RTISP is greater than or equal to RTINT_SP_H.WARNRTISP, the PIPE changes which interrupts are allowed to be asserted: only interrupts with a priority level higher than the user-configured RTINT_SP_H.WARNRTISP_PRIO_LEVEL are allowed. This can be summarized using the pseudo-code below.
if(RTISP >= RTINT_SP_H.WARNRTISP){
Only allow RTINT with INT_CONFIG.PRI_LEVEL < RTINT_SP_H.WARNRTISP_PRIO_LEVEL
}
else{
Allow all RTINT.
}
The status of whether or not RTISP level has reached the user-configured WARNRTISP level is located in the RTISP_STS.WARNRTISP_STS field.
WARNRTISP must not be configured as 1 to avoid firing an error to the ESM on the first RTINT occurrence. However, there is no impact if the user is not utilizing and/or expecting any RTINT.
When RTISP = MAXRTISP, all RTINT stack space has been exhausted except for one stack slot which is used by a NMI to alert the CPU of the overflow. When this condition is true, the PIPE does the following:
The MAXRTISP puts the CPU in a fault state, and the ESM responds to the PIPE fault assertion by raising an NMI back to the PIPE. However, PIPE does not allow any other NMIs to nest within this NMI. PIPE only allows further RTINTs to execute once the second-to-last stack slot is available again in the RTINT stack. A system reset is required to recover the device from fault.