ARM Cortex-M3 Technical Reference Manual page 211

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

Advertisement

9.5.2
Updating an MPU region using two or three words
ARM DDI 0337G
Unrestricted Access
DMB/DSB is not necessary because the Private Peripheral Bus is a strongly ordered
memory area. However, a DSB is necessary before the effect on the MPU takes place,
such as the end of a context switcher.
An ISB is necessary if the code that programs the MPU region or regions is entered
using a branch or call. If the code is entered using a return from exception, or by taking
an exception, then an ISB is not necessary.
You can program directly using two or three words, depending on how the information
is divided:
; R1 = region number
; R2 = address
; R3 = size, attributes in one
MOV R0,#NVIC_BASE
ADD R0,#MPU_REG_CTRL
STR R1,[R0,#0]; region number
STR R2,[R0,#4]; address
STR R3,[R0,#8]; size, attributes
An STM can optimize this:
; R1 = region number
; R2 = address
; R3 = size, attributes in one
MOV R0,#NVIC_BASE
ADD R0,#MPU_REG_CTRL
STM R0,{R1-R3}; region number, address, size, and attributes
You can do this in two words for pre-packed information. This means that the base
address register contains the region number in addition to a region-valid bit. This is
useful when the data is statically packed, for example in a boot list or a Process Control
Block (PCB).
; R1 = address and region number in one
; R2 = size and attributes in one
MOV R0,#NVIC_BASE
ADD R0,#MPU_REG_CTRL
STR R1,[R0,#4]; address and region number
STR R2,[R0,#8]; size and attributes
An STM can optimize this:
; R1 = address and region number in one
; R2 = size and attributes in one
MOV R0,#NVIC_BASE
ADD R0,#MPU_REG_CTRL
Copyright © 2005-2008 ARM Limited. All rights reserved.
Non-Confidential
Memory Protection Unit
9-17

Advertisement

Table of Contents
loading

Table of Contents