px4_fmu-v6xrt & bootloader:Bootloader enusres that ITCM memory is writable before jump to APP

This commit is contained in:
David Sidrane
2024-05-25 00:59:09 -07:00
committed by Daniel Agar
parent d79c5f170b
commit 3beb57aae1
4 changed files with 19 additions and 1 deletions
@@ -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
@@ -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
@@ -16,6 +16,7 @@
#include "imxrt_clockconfig.h"
#include <nvic.h>
#include <mpu.h>
#include <lib/systick.h>
#include <lib/flash_cache.h>
@@ -581,6 +582,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];