forked from Imagelibrary/rtems
bsps/stm32h7: Honor the intent of the MPU alignment option
Currently, if a BSP is built without MPU alignment enforcement, the MPU is still enabled and can produce a non-functional binary since code can be mixed with data within a memory region and memory regions are marked as read-only or no-execute based on section addresses and sizes leading to overlapping regions being defined which causes the later-defined region to take precedence. This change disables the MPU when alignment is not enforced, allowing the binary to function.
This commit is contained in:
committed by
Joel Sherrill
parent
3332e54772
commit
c2b3a517f6
@@ -62,8 +62,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
@@ -62,8 +62,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
@@ -63,8 +63,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
@@ -63,8 +63,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
@@ -79,8 +79,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
@@ -63,8 +63,10 @@ void bsp_start_hook_0(void)
|
||||
SCB_EnableDCache();
|
||||
}
|
||||
|
||||
#ifdef STM32H7_ENABLE_MPU_ALIGNMENT
|
||||
_ARMV7M_MPU_Setup(ARMV7M_MPU_CTRL_DEFAULT, stm32h7_config_mpu_region, stm32h7_config_mpu_region_count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_start_hook_1(void)
|
||||
|
||||
Reference in New Issue
Block a user