Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

13.3Setting Up the MPU > 13.3Setting Up the MPU - Pg. 224

224 CHAPTER 13 The Memory Protection Unit MOV STR POP R1,#1 R1,[R0] {R0-R6,PC} ; Enable MPU ; Return MpuRegionSetup ; MPU region setup subroutine ; Input R0 : Base Address ; R1 : Region number ; R2 : Size ; R3 : AP (access permission) ; R4 : MemAttrib ({TEX[2:0], S, C, B}) ; R5 : Sub region disable ; R6 : {XN,Enable} PUSH {R0-R1, LR} BIC R0, R0, #0x1F ; Clear unused bits in address BFI R0, R1, #0, #4 ; Insert region number to R0[3:0] ORR R0, R0, #0x10 ; Set valid bit LDR R1,=0xE000ED9C ; MPU Region Base Address Register STR R0,[R1] ; Set base address reg AND R0, R6, #0x01 ; Get Enable bit UBFX R1, R6, #1, #1 ; Get XN bit BFI R0, R1, #28, #1 ; Insert XN to R0[28]