soc: arm: nxp_imx: introduce ROM ramloader feature

The iMX RT bootrom allows the user to load images into RAM regions from
flash by providing a correctly configured boot header. In particular, if
the boot header contains a load address within RAM, the bootroom will
automatically copy the image to the load address before executing it

Introduce CONFIG_NXP_IMX_RT_ROM_RAMLOADER to enable this feature. This
Kconfig will shift the LMA of a image built to run in a RAM region to
reside in the default FlexSPI boot region, which allows the image to be
loaded to the FlexSPI region using west. This is intended to simplify
development of applications executing from RAM on iMX RT based systems.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2023-08-16 18:16:49 -05:00 committed by Maureen Helm
commit 23264c4b3a
3 changed files with 53 additions and 0 deletions

View file

@ -795,6 +795,23 @@ config NXP_IMX_EXTERNAL_SDRAM
an MPU region will be defined to disable cached access to the
SDRAM memory space.
config NXP_IMX_RT_ROM_RAMLOADER
depends on !FLASH_MCUX_FLEXSPI_XIP && NXP_IMX_RT_BOOT_HEADER
# Required so that debugger will load image to correct offset
select BUILD_OUTPUT_HEX
bool "Create output image that IMX RT ROM can load from FlexSPI to ram"
help
Builds an output image that the IMX RT BootROM can load from the
FlexSPI boot device into RAM region. The image will be loaded
from FLEXSPI into the region specified by `zephyr,flash` node.
# Setup LMA adjustment if using the RAMLOADER feature of ROM
FLASH_CHOSEN := zephyr,flash
FLASH_BASE := $(dt_chosen_reg_addr_hex,$(FLASH_CHOSEN))
FLEXSPI_BASE := $(dt_node_reg_addr_hex,/soc/spi@402a8000,1)
config BUILD_OUTPUT_ADJUST_LMA
default "$(FLEXSPI_BASE) - $(FLASH_BASE)" if NXP_IMX_RT_ROM_RAMLOADER
config SECOND_CORE_MCUX
bool "Dual core operation on the RT11xx series"
depends on SOC_SERIES_IMX_RT11XX

View file

@ -101,8 +101,27 @@ config IMAGE_VECTOR_TABLE_OFFSET
the application entry point and device configuration data. The boot
ROM requires a fixed IVT offset for each type of boot device.
config NXP_IMX_RT_ROM_RAMLOADER
depends on !FLASH_MCUX_FLEXSPI_XIP
# Required so that debugger will load image to correct offset
select BUILD_OUTPUT_HEX
bool "Create output image that IMX RT ROM can load from FlexSPI to ram"
help
Builds an output image that the IMX RT BootROM can load from the
FlexSPI boot device into RAM region. The image will be loaded
from FLEXSPI0 into the region specified by `zephyr,flash` node.
# Setup LMA adjustment if using the RAMLOADER feature of ROM
FLASH_CHOSEN := zephyr,flash
FLASH_BASE := $(dt_chosen_reg_addr_hex,$(FLASH_CHOSEN))
FLEXSPI_BASE := $(dt_node_reg_addr_hex,/soc/spi@134000,1)
config BUILD_OUTPUT_ADJUST_LMA
default "$(FLEXSPI_BASE) - $(FLASH_BASE)" if NXP_IMX_RT_ROM_RAMLOADER
endif # NXP_IMX_RT5XX_BOOT_HEADER
config IMXRT5XX_CODE_CACHE
bool "Code cache"
default y

View file

@ -107,6 +107,23 @@ config IMAGE_VECTOR_TABLE_OFFSET
the application entry point and device configuration data. The boot
ROM requires a fixed IVT offset for each type of boot device.
config NXP_IMX_RT_ROM_RAMLOADER
depends on !FLASH_MCUX_FLEXSPI_XIP
# Required so that debugger will load image to correct offset
select BUILD_OUTPUT_HEX
bool "Create output image that IMX RT ROM can load from FlexSPI to ram"
help
Builds an output image that the IMX RT BootROM can load from the
FlexSPI boot device into RAM region. The image will be loaded
from FLEXSPI into the region specified by `zephyr,flash` node.
# Setup LMA adjustment if using the RAMLOADER feature of ROM
FLASH_CHOSEN := zephyr,flash
FLASH_BASE := $(dt_chosen_reg_addr_hex,$(FLASH_CHOSEN))
FLEXSPI_BASE := $(dt_node_reg_addr_hex,/soc/spi@134000,1)
config BUILD_OUTPUT_ADJUST_LMA
default "$(FLEXSPI_BASE) - $(FLASH_BASE)" if NXP_IMX_RT_ROM_RAMLOADER
endif # NXP_IMX_RT6XX_BOOT_HEADER
config IMXRT6XX_CODE_CACHE