File tree Expand file tree Collapse file tree 4 files changed +14
-27
lines changed Expand file tree Collapse file tree 4 files changed +14
-27
lines changed Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ void arm_core_mpu_configure_dynamic_mpu_regions(const struct z_arm_mpu_partition
302302 * This function provides the default configuration mechanism for the Memory
303303 * Protection Unit (MPU).
304304 */
305- static int arm_mpu_init ( const struct device * arg )
305+ int z_arm_mpu_init ( void )
306306{
307307 uint32_t r_index ;
308308
@@ -416,8 +416,6 @@ static int arm_mpu_init(const struct device *arg)
416416 NUM_MPU_REGIONS ,
417417 "Invalid number of MPU regions\n" );
418418#endif /* CORTEX_M0PLUS || CPU_CORTEX_M3 || CPU_CORTEX_M4 */
419+
419420 return 0 ;
420421}
421-
422- SYS_INIT (arm_mpu_init , PRE_KERNEL_1 ,
423- CONFIG_KERNEL_INIT_PRIORITY_DEFAULT );
Original file line number Diff line number Diff line change @@ -601,10 +601,8 @@ void arm_core_mpu_configure_dynamic_mpu_regions(
601601 * This function provides the default configuration mechanism for the Memory
602602 * Protection Unit (MPU).
603603 */
604- static int nxp_mpu_init ( const struct device * arg )
604+ int z_arm_mpu_init ( void )
605605{
606- ARG_UNUSED (arg );
607-
608606 uint32_t r_index ;
609607
610608 if (mpu_config .num_regions > get_num_regions ()) {
@@ -640,15 +638,5 @@ static int nxp_mpu_init(const struct device *arg)
640638
641639 arm_core_mpu_enable ();
642640
643-
644641 return 0 ;
645642}
646-
647- #if defined(CONFIG_LOG )
648- /* To have logging the driver needs to be initialized later */
649- SYS_INIT (nxp_mpu_init , PRE_KERNEL_2 ,
650- CONFIG_KERNEL_INIT_PRIORITY_DEFAULT );
651- #else
652- SYS_INIT (nxp_mpu_init , PRE_KERNEL_1 ,
653- CONFIG_KERNEL_INIT_PRIORITY_DEFAULT );
654- #endif
Original file line number Diff line number Diff line change @@ -484,16 +484,6 @@ static void z_arm_prepare_switch_to_main(void)
484484 __ISB ();
485485#endif /* CONFIG_FPU_SHARING */
486486#endif /* CONFIG_FPU */
487-
488- #ifdef CONFIG_ARM_MPU
489- /* Configure static memory map. This will program MPU regions,
490- * to set up access permissions for fixed memory sections, such
491- * as Application Memory or No-Cacheable SRAM area.
492- *
493- * This function is invoked once, upon system initialization.
494- */
495- z_arm_configure_static_mpu_regions ();
496- #endif
497487}
498488
499489void arch_switch_to_main_thread (struct k_thread * main_thread , char * stack_ptr ,
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ extern void z_arm_cpu_idle_init(void);
3333#ifdef CONFIG_ARM_MPU
3434extern void z_arm_configure_static_mpu_regions (void );
3535extern void z_arm_configure_dynamic_mpu_regions (struct k_thread * thread );
36+ extern int z_arm_mpu_init (void );
3637#endif /* CONFIG_ARM_MPU */
3738
3839static ALWAYS_INLINE void arch_kernel_init (void )
@@ -42,6 +43,16 @@ static ALWAYS_INLINE void arch_kernel_init(void)
4243 z_arm_fault_init ();
4344 z_arm_cpu_idle_init ();
4445 z_arm_clear_faults ();
46+ #if defined(CONFIG_ARM_MPU )
47+ z_arm_mpu_init ();
48+ /* Configure static memory map. This will program MPU regions,
49+ * to set up access permissions for fixed memory sections, such
50+ * as Application Memory or No-Cacheable SRAM area.
51+ *
52+ * This function is invoked once, upon system initialization.
53+ */
54+ z_arm_configure_static_mpu_regions ();
55+ #endif
4556}
4657
4758static ALWAYS_INLINE void
You can’t perform that action at this time.
0 commit comments