From a9389da03858bfe4476886fae3a0bbd2238a3a81 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 28 Dec 2018 08:43:48 -0600 Subject: [PATCH] soc: nxp_imx: Add support for device configuration data (DCD) Adds support for the device configuration data (DCD), which provides a sequence of commands to the imx rt boot ROM to initialize components such as an SDRAM. It is now possible to use the external SDRAM instead of the internal DTCM on the mimxrt1020_evk, mimxrt1050_evk, and mimxrt1060_evk. Note, however, that the default board configurations still link data into internal DTCM, therefore you must use a device tree overlay to override "zephyr,sram = &sdram0" Signed-off-by: Maureen Helm --- ext/hal/nxp/mcux/boards/evkbimxrt1050/CMakeLists.txt | 2 ++ ext/hal/nxp/mcux/boards/evkmimxrt1020/CMakeLists.txt | 2 ++ ext/hal/nxp/mcux/boards/evkmimxrt1060/CMakeLists.txt | 2 ++ include/arch/arm/cortex_m/scripts/linker.ld | 3 +++ include/linker/section_tags.h | 1 + include/linker/sections.h | 1 + soc/arm/nxp_imx/rt/Kconfig.soc | 6 ++++++ soc/arm/nxp_imx/rt/soc.c | 4 ++++ 8 files changed, 21 insertions(+) diff --git a/ext/hal/nxp/mcux/boards/evkbimxrt1050/CMakeLists.txt b/ext/hal/nxp/mcux/boards/evkbimxrt1050/CMakeLists.txt index 96cd503a179..2cd4e4e48fb 100644 --- a/ext/hal/nxp/mcux/boards/evkbimxrt1050/CMakeLists.txt +++ b/ext/hal/nxp/mcux/boards/evkbimxrt1050/CMakeLists.txt @@ -5,5 +5,7 @@ # zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1) +zephyr_compile_definitions_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA XIP_BOOT_HEADER_DCD_ENABLE=1) zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkbimxrt1050_flexspi_nor_config.c) +zephyr_sources_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA evkbimxrt1050_sdram_ini_dcd.c) diff --git a/ext/hal/nxp/mcux/boards/evkmimxrt1020/CMakeLists.txt b/ext/hal/nxp/mcux/boards/evkmimxrt1020/CMakeLists.txt index 906c2096a22..03a7fe52d35 100644 --- a/ext/hal/nxp/mcux/boards/evkmimxrt1020/CMakeLists.txt +++ b/ext/hal/nxp/mcux/boards/evkmimxrt1020/CMakeLists.txt @@ -5,5 +5,7 @@ # zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1) +zephyr_compile_definitions_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA XIP_BOOT_HEADER_DCD_ENABLE=1) zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkmimxrt1020_flexspi_nor_config.c) +zephyr_sources_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA evkmimxrt1020_sdram_ini_dcd.c) diff --git a/ext/hal/nxp/mcux/boards/evkmimxrt1060/CMakeLists.txt b/ext/hal/nxp/mcux/boards/evkmimxrt1060/CMakeLists.txt index d4daa512ca2..97b5a38f473 100644 --- a/ext/hal/nxp/mcux/boards/evkmimxrt1060/CMakeLists.txt +++ b/ext/hal/nxp/mcux/boards/evkmimxrt1060/CMakeLists.txt @@ -5,5 +5,7 @@ # zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1) +zephyr_compile_definitions_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA XIP_BOOT_HEADER_DCD_ENABLE=1) zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkmimxrt1060_flexspi_nor_config.c) +zephyr_sources_ifdef(CONFIG_DEVICE_CONFIGURATION_DATA evkmimxrt1060_sdram_ini_dcd.c) diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index ade582de506..4d3cb2e1970 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -141,6 +141,9 @@ SECTIONS . = CONFIG_IMAGE_VECTOR_TABLE_OFFSET; KEEP(*(.boot_hdr.ivt)) KEEP(*(.boot_hdr.data)) +#ifdef CONFIG_DEVICE_CONFIGURATION_DATA + KEEP(*(.boot_hdr.dcd_data)) +#endif #endif . = CONFIG_TEXT_SECTION_OFFSET; diff --git a/include/linker/section_tags.h b/include/linker/section_tags.h index 6bc2df380ca..784272ded5c 100644 --- a/include/linker/section_tags.h +++ b/include/linker/section_tags.h @@ -26,6 +26,7 @@ #define __imx_boot_conf_section _GENERIC_SECTION(IMX_BOOT_CONF) #define __imx_boot_data_section _GENERIC_SECTION(IMX_BOOT_DATA) #define __imx_boot_ivt_section _GENERIC_SECTION(IMX_BOOT_IVT) +#define __imx_boot_dcd_section _GENERIC_SECTION(IMX_BOOT_DCD) #endif /* CONFIG_ARM */ #if defined(CONFIG_NOCACHE_MEMORY) diff --git a/include/linker/sections.h b/include/linker/sections.h index 46dba2055ed..e64a76b9a67 100644 --- a/include/linker/sections.h +++ b/include/linker/sections.h @@ -61,6 +61,7 @@ #define IMX_BOOT_CONF .boot_hdr.conf #define IMX_BOOT_DATA .boot_hdr.data #define IMX_BOOT_IVT .boot_hdr.ivt +#define IMX_BOOT_DCD .boot_hdr.dcd_data #ifdef CONFIG_NOCACHE_MEMORY #define _NOCACHE_SECTION_NAME nocache diff --git a/soc/arm/nxp_imx/rt/Kconfig.soc b/soc/arm/nxp_imx/rt/Kconfig.soc index e5a183cada3..86c2d1f87e6 100644 --- a/soc/arm/nxp_imx/rt/Kconfig.soc +++ b/soc/arm/nxp_imx/rt/Kconfig.soc @@ -187,6 +187,12 @@ config IMAGE_VECTOR_TABLE_OFFSET the application entry point and device configuration data. The boot ROM reqiures a fixed IVT offset for each type of boot device. +config DEVICE_CONFIGURATION_DATA + bool "Enable device configuration data" + help + Device configuration data (DCD) provides a sequence of commmands to + the boot ROM to initialize components such as an SDRAM. + endif # NXP_IMX_RT_BOOT_HEADER endif # SOC_SERIES_IMX_RT diff --git a/soc/arm/nxp_imx/rt/soc.c b/soc/arm/nxp_imx/rt/soc.c index 12476cb093f..e6b378598a0 100644 --- a/soc/arm/nxp_imx/rt/soc.c +++ b/soc/arm/nxp_imx/rt/soc.c @@ -60,7 +60,11 @@ const __imx_boot_ivt_section ivt image_vector_table = { .hdr = IVT_HEADER, .entry = CONFIG_FLASH_BASE_ADDRESS + CONFIG_TEXT_SECTION_OFFSET, .reserved1 = IVT_RSVD, +#ifdef CONFIG_DEVICE_CONFIGURATION_DATA + .dcd = (uint32_t) dcd_data, +#else .dcd = (uint32_t) NULL, +#endif .boot_data = (uint32_t) &boot_data, .self = (uint32_t) &image_vector_table, .csf = (uint32_t)CSF_ADDRESS,