Programming Model
58
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
Cortex-M4F Processor
APSR contains the current state of the condition flags from previous instruction executions.
EPSR contains the Thumb state bit and the execution state bits for the If-Then (IT) instruction or the
Interruptible-Continuable Instruction (ICI) field for an interrupted load multiple or store multiple instruction.
Attempts to read the EPSR directly through application software using the MSR instruction always return
zero. Attempts to write the EPSR using the MSR instruction in application software are always ignored.
Fault handlers can examine the EPSR value in the stacked PSR to determine the operation that faulted
(see
IPSR contains the exception type number of the current Interrupt Service Routine (ISR).
These registers can be accessed individually or as a combination of any two or all three registers, using
the register name as an argument to the MSR or MRS instructions. For example, all of the registers can
be read using PSR with the MRS instruction, or APSR only can be written to using APSR with the MSR
instruction.
shows the possible register combinations for the PSR. See the MRS and MSR
instruction descriptions in the Cortex-M4 instruction set chapter in the
Cortex-M4 Devices Generic User
for more information about how to access the program status registers.
On reset, APSR register bits is undefined and IPSR register bits 8:0 is cleared. The EPSR register T bit is
set and the IT/ICI bits are cleared at reset.
(1)
The processor ignores writes to the IPSR bits.
(2)
Reads of the EPSR bits return zero, and the processor ignores writes
to these bits.
Table 1-4. PSR Register Combinations
Register
Type
Combination
PSR
RW
(1) (2)
APSR, EPSR, and IPSR
IEPSR
RO
EPSR and IPSR
IAPSR
RW
(1)
APSR and IPSR
EAPSR
RW
(2)
APSR and EPSR
1.3.4.6
Register 17: Priority Mask Register (PRIMASK)
The PRIMASK register prevents activation of all exceptions with programmable priority. Reset,
nonmaskable interrupt (NMI), and hard fault are the only exceptions with fixed priority. Exceptions should
be disabled when they might impact the timing of critical tasks. This register is only accessible in
privileged mode. The MSR and MRS instructions are used to access the PRIMASK register, and the CPS
instruction may be used to change the value of the PRIMASK register. On reset, the PRIMASK register is
cleared. See the Cortex-M4 instruction set chapter in the
Cortex-M4 Devices Generic User Guide
for more
information on these instructions. For more information on exception priority levels, see
1.3.4.7
Register 18: FaultMask Register (FAULTMASK)
The FAULTMASK register prevents activation of all exceptions except for the Non-Maskable Interrupt
(NMI). Exceptions should be disabled when they might impact the timing of critical tasks. This register is
only accessible in privileged mode. The MSR and MRS instructions are used to access the FAULTMASK
register, and the CPS instruction may be used to change the value of the FAULTMASK register. On reset,
the FALUTMASK register is cleared. See the Cortex-M4 instruction set chapter in the
for more information on these instructions. For more information on exception priority
levels, see
1.3.4.8
Register 19: Base Priority Mask Register (BASEPRI)
The BASEPRI register defines the minimum priority for exception processing. When BASEPRI is set to a
nonzero value, it prevents the activation of all exceptions with the same or lower priority level as the
BASEPRI value. Exceptions should be disabled when they might impact the timing of critical tasks. This
register is only accessible in privileged mode. On reset, the BASEPRI register is cleared. For more
information on exception priority levels, see