From 3cb5e4ed54fa0b4034cf08d21417730f310264ce Mon Sep 17 00:00:00 2001 From: Trung Hieu Le Date: Thu, 25 Apr 2024 12:05:52 +0200 Subject: [PATCH] boards: nxp: rt1170_evk: Add XMCD bootheader Currently, only DCD bootheader was supported to configure the SDRAM. On IMX RT1170, XMCD can be used as an alternative boot header to DCD. XMCD is more advanced than DCD and enhances SDRAM access speed. This is benefit for SDRAM access application. Signed-off-by: Trung Hieu Le --- boards/nxp/mimxrt1170_evk/CMakeLists.txt | 12 ++++++------ soc/nxp/imxrt/CMakeLists.txt | 4 ++++ soc/nxp/imxrt/Kconfig | 19 +++++++++++++++++++ soc/nxp/imxrt/boot_header.ld | 4 ++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/boards/nxp/mimxrt1170_evk/CMakeLists.txt b/boards/nxp/mimxrt1170_evk/CMakeLists.txt index c564e77e492..e87e07401d0 100644 --- a/boards/nxp/mimxrt1170_evk/CMakeLists.txt +++ b/boards/nxp/mimxrt1170_evk/CMakeLists.txt @@ -28,16 +28,16 @@ if(CONFIG_NXP_IMXRT_BOOT_HEADER) zephyr_library_sources(${RT1170_BOARD_DIR}/xip/${RT1170_BOARD_NAME}_flexspi_nor_config.c) zephyr_library_include_directories(${RT1170_BOARD_DIR}/xip) endif() - if(CONFIG_DEVICE_CONFIGURATION_DATA) - # Include device configuration data block for RT1170 EVK from NXP's HAL. + if(CONFIG_EXTERNAL_MEM_CONFIG_DATA) + # Include external memory configuration data block for RT1170 EVK from NXP's HAL. # This configuration block may need modification if another SDRAM chip # is used on your custom board. - zephyr_compile_definitions(XIP_BOOT_HEADER_DCD_ENABLE=1) - zephyr_library_sources(${RT1170_BOARD_DIR}/dcd.c) + zephyr_compile_definitions(XIP_BOOT_HEADER_XMCD_ENABLE=1) + zephyr_library_sources(${RT1170_BOARD_DIR}/xmcd/xmcd.c) else() if(CONFIG_SRAM_BASE_ADDRESS EQUAL 0x80000000) - message(WARNING "You are using SDRAM as RAM but no device " - "configuration data (DCD) is included. This configuration may not boot") + message(WARNING "You are using SDRAM as RAM but no external memory" + "configuration data (XMCD) is included. This configuration may not boot") endif() endif() endif() diff --git a/soc/nxp/imxrt/CMakeLists.txt b/soc/nxp/imxrt/CMakeLists.txt index 25cd1b81554..b42829869e4 100644 --- a/soc/nxp/imxrt/CMakeLists.txt +++ b/soc/nxp/imxrt/CMakeLists.txt @@ -13,6 +13,9 @@ if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX) if(CONFIG_DEVICE_CONFIGURATION_DATA) set(boot_hdr_dcd_data_section ".boot_hdr.dcd_data") endif() + if(CONFIG_EXTERNAL_MEM_CONFIG_DATA) + set(boot_hdr_xmcd_data_section ".boot_hdr.xmcd_data") + endif() zephyr_sources(mpu_regions.c) zephyr_linker_section_configure( SECTION .rom_start @@ -26,6 +29,7 @@ if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX) INPUT ".boot_hdr.ivt" ".boot_hdr.data" ${boot_hdr_dcd_data_section} + ${boot_hdr_xmcd_data_section} OFFSET ${CONFIG_IMAGE_VECTOR_TABLE_OFFSET} KEEP PRIO 11 diff --git a/soc/nxp/imxrt/Kconfig b/soc/nxp/imxrt/Kconfig index ce96362b49d..2ab29a50ce6 100644 --- a/soc/nxp/imxrt/Kconfig +++ b/soc/nxp/imxrt/Kconfig @@ -114,6 +114,25 @@ config DEVICE_CONFIGURATION_DATA initialized at boot time. +config EXTERNAL_MEM_CONFIG_DATA + bool "External Memory Configuration Data" + depends on !DEVICE_CONFIGURATION_DATA + help + External memory configuration data (XMDC) provides an alternative + configuration sequences which allows to intilialize the external memory + at the boot time. This sequence allows to configure + external memories (such as SDRAM) with more advanced option. + This is a new alternative boot header compared to DCD, and DCD must be disabled + in order to select this option. + +config EXTERNAL_MEM_CONFIG_OFFSET + hex "External memory configuration offset" + depends on EXTERNAL_MEM_CONFIG_DATA + default 0x1040 if BOOT_FLEXSPI_NOR || BOOT_SEMC_NOR + help + As specified by the boot ROM, the External Memory configuration data must be + placed in a specific address location to be pointed by the boot ROM. + endif # NXP_IMXRT_BOOT_HEADER config NXP_IMX_EXTERNAL_SDRAM diff --git a/soc/nxp/imxrt/boot_header.ld b/soc/nxp/imxrt/boot_header.ld index e46fa5789e3..b96e5e58b3f 100644 --- a/soc/nxp/imxrt/boot_header.ld +++ b/soc/nxp/imxrt/boot_header.ld @@ -18,4 +18,8 @@ KEEP(*(.boot_hdr.data)) #ifdef CONFIG_DEVICE_CONFIGURATION_DATA KEEP(*(.boot_hdr.dcd_data)) #endif /* CONFIG_DEVICE_CONFIGURATION_DATA */ +#ifdef CONFIG_EXTERNAL_MEM_CONFIG_DATA + . = CONFIG_EXTERNAL_MEM_CONFIG_OFFSET; + KEEP(*(.boot_hdr.xmcd_data)) +#endif #endif /* CONFIG_SOC_SERIES_IMXRT10XX || CONFIG_SOC_SERIES_IMXRT11XX */