Atmel ARM-Based Evaluation Kit for SAM4S16C, 32-Bit ARM® Cortex® Microcontroller ATSAM4S-WPIR-RD ATSAM4S-WPIR-RD Data Sheet

Product codes
ATSAM4S-WPIR-RD
Page of 1231
SAM4S Series [DATASHEET]
Atmel-11100G-ATARM-SAM4S-Datasheet_27-May-14
56
12.4
Cortex-M4 Models
12.4.1 Programmers Model
This section describes the Cortex-M4 programmers model. In addition to the individual core register descriptions, it 
contains information about the processor modes and privilege levels for software execution and stacks.
12.4.1.1 Processor Modes and Privilege Levels for Software Execution
The processor modes are:
Thread mode 
Used to execute application software. The processor enters the Thread mode when it comes out of reset.
Handler mode
Used to handle exceptions. The processor returns to the Thread mode when it has finished exception 
processing.
The privilege levels for software execution are:
Unprivileged
The software:
̶
Has limited access to the MSR and MRS instructions, and cannot use the CPS instruction
̶
Cannot access the System Timer, NVIC, or System Control Block
̶
Might have a restricted access to memory or peripherals.
Unprivileged software
 executes at the unprivileged level.
Privileged 
The software can use all the instructions and has access to all resources. Privileged software executes at 
the privileged level.
In Thread mode, the Control Register controls whether the software execution is privileged or unprivileged, see 
. In Handler mode, software execution is always privileged.
Only privileged software can write to the Control Register to change the privilege level for software execution in 
Thread mode. Unprivileged software can use the SVC instruction to make a supervisor call to transfer control to 
privileged software.
12.4.1.2 Stacks
The processor uses a full descending stack. This means the stack pointer holds the address of the last stacked 
item in memory When the processor pushes a new item onto the stack, it decrements the stack pointer and then 
writes the item to the new memory location. The processor implements two stacks, the main stack and the process 
stack
, with a pointer for each held in independent registers, see 
In Thread mode, the Control Register controls whether the processor uses the main stack or the process stack, 
see 
In Handler mode, the processor always uses the main stack. 
The options for processor operations are:
Table 12-1.
Summary of processor mode, execution privilege level, and stack use options
Processor
Mode
Used to Execute
Privilege Level for
Software Execution
Stack Used
Thread
Applications
Privileged or unprivileged
Main stack or process stack
Handler
Exception handlers
Always privileged
Main stack