Updating An Mpu Region - ARM Cortex-M3 Technical Reference Manual

Hide thumbs Also See for Cortex-M3:
Table of Contents

Advertisement

Memory Protection Unit
9.5

Updating an MPU region

9.5.1
Updating an MPU region using CP15 equivalent code
9-16
There are three registers consisting of three memory mapped words that are used to
program the MPU regions. These are part registers that can be programmed and
accessed individually. This means that existing ARMv6, ARMv7 and CP15 code can be
ported. This replaces MRC and MCR with LDRx and STRx operations.
It is also possible to access these registers as three words, and program them using only
two words. Aliases are provided to enable programming a set of regions simultaneously
using an STM instruction.
Using CP15 equivalent code:
; R1 = region number
; R2 = size/enable
; R3 = attributes
; R4 = address
MOV
R0,#NVIC_BASE
ADD
R0,#MPU_REG_CTRL
STR
R1,[R0,#0]
STR
R4,[R0,#4]
STRH
R2,[R0,#8]
STRH
R3,[R0,#10]
Note
If interrupts could pre-empt during this period, they could be affected by this region.
This means that the region must be disabled, written, and then enabled. This is usually
not necessary for a context switcher, but would be necessary if updated elsewhere.
; R1 = region number
; R2 = size/enable
; R3 = attributes
; R4 = address
MOV
R0,#NVIC_BASE
Copyright © 2005, 2006 ARM Limited. All rights reserved.
; region number
; address
; size and enable
; attributes
ARM DDI 0337B

Advertisement

Table of Contents
loading

Table of Contents