arch: arm: cortex_a_r: Move mmu and mpu init to prep_c
MMU or MPU unit need to be initialized by its own CPU. - Primary core initialize MMU or MPU unit in z_arm_prep_c. - Secondary core initialize MMU or MPU unit in z_arm_secondary_start. Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
This commit is contained in:
parent
ea4e1b328c
commit
813ed3a8a3
2 changed files with 13 additions and 20 deletions
|
@ -44,6 +44,13 @@ Z_GENERIC_SECTION(.vt_pointer_section) __attribute__((used))
|
||||||
void *_vector_table_pointer;
|
void *_vector_table_pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARM_MPU
|
||||||
|
extern void z_arm_mpu_init(void);
|
||||||
|
extern void z_arm_configure_static_mpu_regions(void);
|
||||||
|
#elif defined(CONFIG_ARM_AARCH32_MMU)
|
||||||
|
extern int z_arm_mmu_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_AARCH32_ARMV8_R)
|
#if defined(CONFIG_AARCH32_ARMV8_R)
|
||||||
|
|
||||||
#define VECTOR_ADDRESS ((uintptr_t)_vector_start)
|
#define VECTOR_ADDRESS ((uintptr_t)_vector_start)
|
||||||
|
@ -150,6 +157,12 @@ void z_arm_prep_c(void)
|
||||||
z_arm_init_stacks();
|
z_arm_init_stacks();
|
||||||
#endif
|
#endif
|
||||||
z_arm_interrupt_init();
|
z_arm_interrupt_init();
|
||||||
|
#ifdef CONFIG_ARM_MPU
|
||||||
|
z_arm_mpu_init();
|
||||||
|
z_arm_configure_static_mpu_regions();
|
||||||
|
#elif defined(CONFIG_ARM_AARCH32_MMU)
|
||||||
|
z_arm_mmu_init();
|
||||||
|
#endif
|
||||||
z_cstart();
|
z_cstart();
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,29 +25,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
#ifdef CONFIG_ARM_MPU
|
|
||||||
extern void z_arm_configure_static_mpu_regions(void);
|
|
||||||
extern int z_arm_mpu_init(void);
|
|
||||||
#endif /* CONFIG_ARM_MPU */
|
|
||||||
#ifdef CONFIG_ARM_AARCH32_MMU
|
|
||||||
extern int z_arm_mmu_init(void);
|
|
||||||
#endif /* CONFIG_ARM_AARCH32_MMU */
|
|
||||||
|
|
||||||
static ALWAYS_INLINE void arch_kernel_init(void)
|
static ALWAYS_INLINE void arch_kernel_init(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_ARM_MPU)
|
|
||||||
z_arm_mpu_init();
|
|
||||||
/* Configure static memory map. This will program MPU regions,
|
|
||||||
* to set up access permissions for fixed memory sections, such
|
|
||||||
* as Application Memory or No-Cacheable SRAM area.
|
|
||||||
*
|
|
||||||
* This function is invoked once, upon system initialization.
|
|
||||||
*/
|
|
||||||
z_arm_configure_static_mpu_regions();
|
|
||||||
#endif /* CONFIG_ARM_MPU */
|
|
||||||
#if defined(CONFIG_ARM_AARCH32_MMU)
|
|
||||||
z_arm_mmu_init();
|
|
||||||
#endif /* CONFIG_ARM_AARCH32_MMU */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE void
|
static ALWAYS_INLINE void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue