Atmel SAM4S-EK2 Atmel ATSAM4S-EK2 ATSAM4S-EK2 数据表
产品代码
ATSAM4S-EK2
49
SAM4S [DATASHEET]
11100E–ATARM–24-Jul-13
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.
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.
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.
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:
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.
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.
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
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:
Note:
1.
See
Table 12-1. Summary of processor mode, execution privilege level, and stack use options
Processor
Mode
Mode
Used to
Execute
Execute
Privilege Level for
Software Execution
Software Execution
Stack Used
Thread
Applications
Privileged or
unprivileged
unprivileged
Main stack or
process stack
process stack
Handler
Exception
handlers
handlers
Always privileged
Main stack