The Cortex-M Processor Modes

Thread mode Used to execute application software. The processor enters Thread mode when it comes out of reset.

Handler mode Used to handle exceptions. The processor returns to Thread mode when it has finished all exception processing.

The Cortex-M Privilege Levels

Unprivileged: Unprivileged code execution limits or excludes access to some resources like certain instructions and specific memory locations

Privileged: The software can use all the instructions and has access to all resources.

Privileges and Modes (cont.): The MPU allows us to change the region of memory that can be accessed based on the operating mode and the privilege level.

image.png

Privileges and Modes

Thread Mode: In Thread mode, the CONTROL register controls whether software execution is privileged or unprivileged

Handler Mode: In Handler mode, software execution is always privileged

image.png

image.png