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
241
SAM4S Series [DATASHEET]
Atmel-11100G-ATARM-SAM4S-Datasheet_27-May-14
 shows the AP encodings that define the access permissions for privileged and unprivileged software.
12.11.1.1MPU Mismatch
When an access violates the MPU permissions, the processor generates a memory management fault, see 
. The MMFSR indicates the cause of the fault. See 
 for more information.
12.11.1.2Updating an MPU Region
To update the attributes for an MPU region, update the MPU_RNR, MPU_RBAR and MPU_RASRs. Each register 
can be programed separately, or a multiple-word write can be used to program all of these registers. MPU_RBAR 
and MPU_RASR aliases can be used to program up to four regions simultaneously using an STM instruction.
12.11.1.3Updating an MPU Region Using Separate Words
Simple code to configure one region:
; R1 = region number
; R2 = size/enable
; R3 = attributes
; R4 = address
LDR R0,=MPU_RNR
; 0xE000ED98, MPU region number register
STR R1, [R0, #0x0]
; Region Number
STR R4, [R0, #0x4]
; Region Base Address
STRH R2, [R0, #0x8]
; Region Size and Enable
STRH R3, [R0, #0xA]
; Region Attribute
Disable a region before writing new region settings to the MPU, if the region being changed was previously 
enabled. For example:
; R1 = region number
; R2 = size/enable
; R3 = attributes
; R4 = address
LDR R0,=MPU_RNR
; 0xE000ED98, MPU region number register
STR R1, [R0, #0x0]
; Region Number
BIC R2, R2, #1
; Disable
STRH R2, [R0, #0x8]
; Region Size and Enable
STR R4, [R0, #0x4]
; Region Base Address
STRH R3, [R0, #0xA]
; Region Attribute
Table 12-38.
AP Encoding
AP[2:0]
Privileged 
Permissions
Unprivileged 
Permissions
Description
000
No access
No access
All accesses generate a permission fault
001
RW
No access
Access from privileged software only
010
RW
RO
Writes by unprivileged software generate a permission 
fault
011
RW
RW
Full access
100
Unpredictable
Unpredictable
Reserved
101
RO
No access
Reads by privileged software only
110
RO
RO
Read only, by privileged or unprivileged software
111
RO
RO
Read only, by privileged or unprivileged software