This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MPU Fault for Background Region

I am using STM32F427iit6. We are doing two things: 

1. Complete Background Memory Protection (4GB) space

2. Configuring each region for proper access, RAM, ROM etc.

When configuring each region doesnt give fault but shoots error when enable complete background. Below is the scatter file:

************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x001FFFFF { ;0x0800C000 0x001F4000 { ; load region size_region
ER_IROM1 0x08000000 0x001FFFFF { ;0x0800C000 0x001F4000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
; Need to split the CCRAM block in two, so tasks don't mix
; with data - this will cause random memory protection faults
; when the stack protector is engaged
RW_CCRAM_STACK 0x10000000 0x0000FFFF { ; CCRAM data
*(.task_stack)
}

RW_CCRAM_DATA +0 0x0000FFFF { ; need to define end address
os_*.o(.bss*)
os_*.o(.data*)
}

ScatterAssert(ImageLimit(RW_CCRAM_DATA) < 0x10010000)

;RW_BKPSRAM 0x40024000 0x00001000 { ; Back-up SRAM data
;*(.assert_data)
;*(.hard_fault_data)
;}

RW_IRAM_DATA 0x20000000 0x00030000 { ; RW data
*(.data)
;*(.data*)
}

RW_IRAM_BSS +0 0x00030000 { ; ZI data
*(.bss)
;*(.bss*)
;*(COMMON)
}

;RW_HEAP_SECTION +0 {
;*(.heap*)
;}

;RW_STACK_DUMMY +0 {
;*(.stack*)
;}

RW_LAST_SECTION +0 0x00030000 {
.ANY(+RW +ZI)
}

ScatterAssert(ImageLimit(RW_LAST_SECTION) < 0x20030000)

ARM_LIB_HEAP +0 EMPTY 0 { ; Heap region growing up
}

ARM_LIB_STACK 0x20030000 EMPTY -0x400 { ; Stack region growing down
}
}

not getting why it throws error when enable protection for background region: 

static void protectBackgroundRegion(void)
{
// Configure Region 0 to catch invalid pointer references
MPU->RNR = mpuBackgroundRegion;
MPU->RBAR = 0x00000000UL; //0x0800C000UL; //
MPU->RASR =
MPU_NO_EXECUTABLE |
(mpuRegion_NoAccess << MPU_RASR_AP_Pos) |
(0 << MPU_RASR_TEX_Pos) |
MPU_CACHEABLE |
MPU_SHAREABLE |
(0 << MPU_RASR_SRD_Pos) |
(mpuRegionSize4Gb << MPU_RASR_SIZE_Pos) |
(1 << MPU_RASR_ENABLE_Pos);
}

Parents Reply Children
No data