9.5.2. Updating an MPU region using two or three words

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 
STM	R0,{R1-R2}		; address, region number, size

For information about interrupts and updating the MPU, see Interrupts and updating the MPU.

Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DDI 0337E
Non-Confidential