arm: aarch32: config static regions with MPU disabled

There is the possibility that when reconfiguring the static regions,
some data that must be accessed is temporarily not accesible due to the
change on the MPU regions configuration. Workaround by disabling MPU
when doing the reconfiguration, same as with dynamic regions, until BR
can be enabled.

Signed-off-by: Duong Vu Nam <duong.vunam@nxp.com>
This commit is contained in:
Duong Vu Nam 2022-11-02 19:33:14 +07:00 committed by Carles Cufí
parent 47cce0573e
commit 84b5d39cb6

View file

@ -16,6 +16,9 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mpu);
extern void arm_core_mpu_enable(void);
extern void arm_core_mpu_disable(void);
/*
* Maximum number of dynamic memory partitions that may be supplied to the MPU
* driver for programming during run-time. Note that the actual number of the
@ -131,10 +134,16 @@ void z_arm_configure_static_mpu_regions(void)
* of the firmware SRAM area is marked by __kernel_ram_end, taking
* into account the unused SRAM area, as well.
*/
#ifdef CONFIG_AARCH32_ARMV8_R
arm_core_mpu_disable();
#endif
arm_core_mpu_configure_static_mpu_regions(static_regions,
ARRAY_SIZE(static_regions),
(uint32_t)&_image_ram_start,
(uint32_t)&__kernel_ram_end);
#ifdef CONFIG_AARCH32_ARMV8_R
arm_core_mpu_enable();
#endif
#if defined(CONFIG_MPU_REQUIRES_NON_OVERLAPPING_REGIONS) && \
defined(CONFIG_MULTITHREADING)
@ -155,8 +164,6 @@ void z_arm_configure_static_mpu_regions(void)
#endif /* CONFIG_MPU_REQUIRES_NON_OVERLAPPING_REGIONS */
}
extern void arm_core_mpu_enable(void);
extern void arm_core_mpu_disable(void);
/**
* @brief Use the HW-specific MPU driver to program
* the dynamic MPU regions.