Memory Protection Unit
9-12
Copyright © 2005-2008 ARM Limited. All rights reserved.
ARM DDI 0337G
Non-Confidential
Unrestricted Access
You cannot use these aliases to read the contents of the regions because the region
number must be written.
An example code sequence for updating four regions is
; R1 = 4 region pairs from process control block (8 words)
MOV R0, #NVIC_BASE
ADD R0, #MPU_REG_CTRL
LDM R1, [R2-R9] ; load region information for 4 regions
STM R0, [R2-R9] ; update all 4 regions at once
Note
You can normally use the
memcpy()
function in a C/C++ compiler for this sequence.
However, you must verify that the compiler uses word transfers.
9.2.4
Sub-Regions
The eight
Sub-Region Disable
(SRD) bits of the Region Attribute and Size Register
divide a region into eight equal-sized units based on the region size. This enables
selectively disabling some of the 1/8th sub-regions. The least significant bit affects the
first 1/8th sub-region, and the most significant bits affects the last 1/8th sub-region. A
disabled sub-region enables any other region overlapping that range to be matched
instead. If no other region overlaps the sub-region, the default behavior is used, no
match – a fault. Sub-regions cannot be used with the three smallest regions of size: 32,
64, and 128. If these sub-regions are used, the results are Unpredictable.
Example of SRD use
Two regions with the same base address overlap. One region is 64KB, and the other is
512KB. The bottom 64KB of the 512KB region is disabled so that the attributes from
the 64KB apply. This is achieved by setting SRD for the 512KB region to b00000001.