diff --git a/boards/px4/fmu-v6xrt/nuttx-config/bootloader/defconfig b/boards/px4/fmu-v6xrt/nuttx-config/bootloader/defconfig index 8ed0ed82d4..6495d6ba62 100644 --- a/boards/px4/fmu-v6xrt/nuttx-config/bootloader/defconfig +++ b/boards/px4/fmu-v6xrt/nuttx-config/bootloader/defconfig @@ -28,6 +28,7 @@ CONFIG_ARMV7M_ITCM=y CONFIG_ARMV7M_MEMCPY=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_ARM_MPU=y +CONFIG_ARM_MPU_RESET=y CONFIG_BOARDCTL=y CONFIG_BOARDCTL_RESET=y CONFIG_BOARD_ASSERT_RESET_VALUE=0 diff --git a/boards/px4/fmu-v6xrt/nuttx-config/nsh/defconfig b/boards/px4/fmu-v6xrt/nuttx-config/nsh/defconfig index e541c5effe..ff0a42fdfd 100644 --- a/boards/px4/fmu-v6xrt/nuttx-config/nsh/defconfig +++ b/boards/px4/fmu-v6xrt/nuttx-config/nsh/defconfig @@ -29,6 +29,7 @@ CONFIG_ARMV7M_ITCM=y CONFIG_ARMV7M_MEMCPY=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_ARM_MPU=y +CONFIG_ARM_MPU_RESET=y CONFIG_BOARDCTL_RESET=y CONFIG_BOARD_ASSERT_RESET_VALUE=0 CONFIG_BOARD_BOOTLOADER_FIXUP=y diff --git a/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c b/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c index 1197427a94..73a520faa4 100644 --- a/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c +++ b/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c @@ -16,6 +16,7 @@ #include "imxrt_clockconfig.h" #include +#include #include #include @@ -577,6 +578,21 @@ led_toggle(unsigned led) void arch_do_jump(const uint32_t *app_base) { + /* The MPU configuration after booting has ITCM set to MPU_RASR_AP_RORO + * We add this overlaping region to allow the Application to copy code into + * the ITCM when it is booted. With CONFIG_ARM_MPU_RESET defined. The mpu + * init will clear any added regions (after the copy) + */ + + mpu_configure_region(IMXRT_ITCM_BASE, 256 * 1024, + /* Instruction access Enabled */ + MPU_RASR_AP_RWRW | /* P:RW U:RW */ + MPU_RASR_TEX_NOR /* Normal */ + /* Not Cacheable */ + /* Not Bufferable */ + /* Not Shareable */ + /* No Subregion disable */ + ); /* extract the stack and entrypoint from the app vector table and go */ uint32_t stacktop = app_base[APP_VECTOR_OFFSET_WORDS];