SPRUJF2A March 2026 – March 2026 AM13E23019
The processor supports two primary modes of execution:
By default, the processor is in thread mode out of reset. If an exception is issued to the processor, the processor handles the exception in handler mode and return to thread mode after handler execution is complete. Code running in thread mode can be configured as being privileged or unprivileged, based on the configuration of the CONTROL register. Code running in handler mode always executes as privileged.
Handler mode always uses the MSP, so the processor ignores explicit writes to the active stack pointer bit of the CONTROL register when in Handler mode. The exception entry and return mechanisms automatically update the CONTROL register based on the EXC_RETURN value.
By default, thread mode uses the MSP. To switch the stack pointer that is used in thread mode to the PSP, either:
MSR instruction to set the CONTROL.SPSEL bit to
1.In general, code which executes as privileged has complete control of the processor configuration, including control of the MPU, Systick, NVIC, and SCB. Only privileged code can change the privilege level for code running in thread mode.
Code that is executing in thread mode in an unprivileged state cannot access the previously mentioned resources (MPU, Systick, NVIC, and SCB).