Fault Handling
72
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Cortex-M4F Processor
1.5.8.2
Exception Return
Exception return occurs when the processor is in Handler mode and executes one of the following
instructions to load the EXC_RETURN value into the PC:
•
An LDM or POP instruction that loads the PC
•
A BX instruction using any register
•
An LDR instruction with the PC as the destination
EXC_RETURN is the value loaded into the LR on exception entry. The exception mechanism relies on
this value to detect when the processor has completed an exception handler. The lowest five bits of this
value provide information on the return stack and processor mode.
shows the EXC_RETURN
values with a description of the exception return behavior.
EXC_RETURN bits 31:5 are all set. When this value is loaded into the PC, it indicates to the processor
that the exception is complete, and the processor initiates the appropriate exception return sequence.
Table 1-9. Exception Return Behavior
EXC_RETURN[31:0]
Description
0xFFFF_FFE0
Reserved
0xFFFF_FFE1
Return to Handler mode.
Exception return uses floating-point state from MSP.
Execution uses MSP after return.
0xFFFF_FFE2 - 0xFFFF_FFE8
Reserved
0xFFFF_FFE9
Return to Thread mode.
Exception return uses floating-point state from MSP.
Execution uses MSP after return.
0xFFFF_FFEA - 0xFFFF_FFEC
Reserved
0xFFFF_FFED
Return to Thread mode.
Exception return uses floating-point state from PSP.
Execution uses PSP after return.
0xFFFF_FFEE - 0xFFFF_FFF0
Reserved
0xFFFF_FFF1
Return to Handler mode.
Exception return uses non-floating-point state from MSP.
Execution uses MSP after return.
0xFFFF_FFF2 - 0xFFFF_FFF8
Reserved
0xFFFF_FFF9
Return to Thread mode.
Exception return uses non-floating-point state from MSP.
Execution uses MSP after return.
0xFFFF_FFFA - 0xFFFF_FFFC
Reserved
0xFFFF_FFFD
Return to Thread mode.
Exception return uses non-floating-point state from PSP.
Execution uses PSP after return.
0xFFFF_FFFE - 0xFFFF_FFFF
Reserved
1.6
Fault Handling
Faults are a subset of the exceptions (see
). The following conditions generate a fault:
•
A bus error on an instruction fetch or vector table load or a data access.
•
An internally detected error such as an undefined instruction or an attempt to change state with a BX
instruction.
•
Attempting to execute an instruction from a memory region marked as Non-Executable (XN).
•
An MPU fault because of a privilege violation or an attempt to access an unmanaged region.