[PATCH] bsps/stm32h7: add comments explaining MPU setup

Karel Gardas karel at functional.vision
Wed Mar 15 22:11:31 UTC 2023


---
 bsps/arm/stm32h7/start/mpu-config.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bsps/arm/stm32h7/start/mpu-config.c b/bsps/arm/stm32h7/start/mpu-config.c
index ce3c92ccb0..a3ebc065ec 100644
--- a/bsps/arm/stm32h7/start/mpu-config.c
+++ b/bsps/arm/stm32h7/start/mpu-config.c
@@ -31,6 +31,10 @@
 
 const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
     {
+     /*| memory  | shareability  | privileged | unprivileged | executability |
+       |  type   |               |   perms    |    perms     |               |
+       +---------+---------------+------------+--------------+---------------+ */
+     /*  normal  | not shareable | RW         | RW           | NO */
       .begin = stm32h7_memory_sram_axi_begin,
       .end = stm32h7_memory_sram_axi_end,
       .rasr = ARMV7M_MPU_RASR_XN
@@ -38,6 +42,7 @@ const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
         | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* normal  | not shareable | RW          | RW           | NO */
       .begin = stm32h7_memory_sdram_1_begin,
       .end = stm32h7_memory_sdram_1_end,
       .rasr = ARMV7M_MPU_RASR_XN
@@ -45,6 +50,7 @@ const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
         | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* normal  | not shareable | RW          | RW           | NO */
       .begin = stm32h7_memory_sdram_2_begin,
       .end = stm32h7_memory_sdram_2_end,
       .rasr = ARMV7M_MPU_RASR_XN
@@ -52,12 +58,14 @@ const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
         | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* normal  | not shareable | RO         | no access    | YES */
       .begin = bsp_section_start_begin,
       .end = bsp_section_text_end,
       .rasr = ARMV7M_MPU_RASR_AP(0x5)
         | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* normal  | not shareable | RO         | no access    | NO */
       .begin = bsp_section_rodata_begin,
       .end = bsp_section_rodata_end,
       .rasr = ARMV7M_MPU_RASR_XN
@@ -65,6 +73,7 @@ const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
         | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* device  | not shareable | RW         | RW           | NO */
       .begin = bsp_section_nocache_begin,
       .end = bsp_section_nocachenoload_end,
       .rasr = ARMV7M_MPU_RASR_XN
@@ -72,6 +81,7 @@ const ARMV7M_MPU_Region_config stm32h7_config_mpu_region [] = {
         | ARMV7M_MPU_RASR_TEX(0x2)
         | ARMV7M_MPU_RASR_ENABLE,
     }, {
+     /* n/a     | n/a           | n/a        | n/a          | NO */
       .begin = stm32h7_memory_null_begin,
       .end = stm32h7_memory_null_end,
       .rasr = ARMV7M_MPU_RASR_XN | ARMV7M_MPU_RASR_ENABLE,
-- 
2.25.1



More information about the devel mailing list