228
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
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
ORR R2, #1
; Enable
STRH R2, [R0, #0x8]
; Region Size and Enable
The software must use memory barrier instructions:
• before the MPU setup, if there might be outstanding memory transfers, such as buffered
writes, that might be affected by the change in MPU settings
• after the MPU setup, if it includes memory transfers that must use the new MPU settings.
However, memory barrier instructions are not required if the MPU setup process starts by enter-
ing an exception handler, or is followed by an exception return, because the exception entry and
exception return mechanisms cause memory barrier behavior.
The software does not need any memory barrier instructions during an MPU setup, because it
accesses the MPU through the PPB, which is a Strongly-Ordered memory region.
For example, if the user wants all of the memory access behavior to take effect immediately after
the programming sequence, a DSB instruction and an ISB instruction must be used. A DSB is
required after changing MPU settings, such as at the end of a context switch. An ISB is required
if the code that programs the MPU region or regions is entered using a branch or call. If the pro-
gramming sequence is entered using a return from exception, or by taking an exception, then an
ISB is not required .
11.11.1.4
Updating an MPU Region Using Multi-word Writes
The user can program directly using multi-word writes, depending on how the information is
divided. Consider the following reprogramming:
; R1 = region number
; R2 = address
; R3 = size, attributes in one
LDR R0, =MPU_RNR
; 0xE000ED98, MPU region number register
STR R1, [R0, #0x0]
; Region Number
STR R2, [R0, #0x4]
; Region Base Address
STR R3, [R0, #0x8]
; Region Attribute, Size and Enable
Содержание SAM4S Series
Страница 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Страница 1142: ...1142 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 3 100 ball VFBGA Package Drawing ...
Страница 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Страница 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...