Skip to content

Commit 8e30049

Browse files
MaureenHelmgalak
authored andcommitted
soc: nxp_imx: Add support for external xip flash boot header
Adds support for the boot data, image vector table, and FlexSPI NOR config structures used by the imx rt boot ROM to boot an application from an external xip flash device. It is now possible to build and flash a bootable zephyr image to the external xip flash on the mimxrt1020_evk, mimxrt1050_evk, and mimxrt1060_evk boards via the 'ninja flash' build target and jlink runner. Note, however, that the default board configurations still link code into internal ITCM, therefore you must set CONFIG_CODE_HYPERFLASH=y or CONFIG_CODE_QSPI=y explicitly to override the default. You must also set CONFIG_NXP_IMX_RT_BOOT_HEADER=y to build the boot header into the image. Signed-off-by: Maureen Helm <[email protected]>
1 parent 7bc187e commit 8e30049

File tree

11 files changed

+110
-1
lines changed

11 files changed

+110
-1
lines changed

ext/hal/nxp/mcux/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ zephyr_compile_definitions(${MCUX_CPU})
2828
zephyr_sources(devices/${MCUX_DEVICE}/fsl_clock.c)
2929

3030
# Build mcux drivers that can be used for multiple SoC's.
31+
add_subdirectory(boards)
3132
add_subdirectory(components)
3233
add_subdirectory(drivers)
3334

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2018, NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
add_subdirectory_ifdef(CONFIG_BOARD_MIMXRT1020_EVK evkmimxrt1020)
8+
add_subdirectory_ifdef(CONFIG_BOARD_MIMXRT1050_EVK evkbimxrt1050)
9+
add_subdirectory_ifdef(CONFIG_BOARD_MIMXRT1060_EVK evkmimxrt1060)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2018, NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1)
8+
9+
zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkbimxrt1050_flexspi_nor_config.c)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2018, NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1)
8+
9+
zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkmimxrt1020_flexspi_nor_config.c)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2018, NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_compile_definitions_ifdef(CONFIG_NXP_IMX_RT_BOOT_HEADER XIP_BOOT_HEADER_ENABLE=1)
8+
9+
zephyr_sources_ifdef(CONFIG_BOOT_FLEXSPI_NOR evkmimxrt1060_flexspi_nor_config.c)

ext/hal/nxp/mcux/drivers/imx/fsl_flexspi_nor_boot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#define __FLEXSPI_NOR_BOOT_H__
1010

1111
#include <stdint.h>
12-
#include "board.h"
1312

1413
/*! @name Driver version */
1514
/*@{*/

include/arch/arm/cortex_m/scripts/linker.ld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ SECTIONS
135135
KEEP(*(.dbghdr))
136136
KEEP(*(".dbghdr.*"))
137137
#endif
138+
139+
#ifdef CONFIG_NXP_IMX_RT_BOOT_HEADER
140+
KEEP(*(.boot_hdr.conf))
141+
. = CONFIG_IMAGE_VECTOR_TABLE_OFFSET;
142+
KEEP(*(.boot_hdr.ivt))
143+
KEEP(*(.boot_hdr.data))
144+
#endif
145+
138146
. = CONFIG_TEXT_SECTION_OFFSET;
139147

140148
#if defined(CONFIG_SW_VECTOR_RELAY)

include/linker/section_tags.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#define __ccm_data_section _GENERIC_SECTION(_CCM_DATA_SECTION_NAME)
2424
#define __ccm_bss_section _GENERIC_SECTION(_CCM_BSS_SECTION_NAME)
2525
#define __ccm_noinit_section _GENERIC_SECTION(_CCM_NOINIT_SECTION_NAME)
26+
#define __imx_boot_conf_section _GENERIC_SECTION(IMX_BOOT_CONF)
27+
#define __imx_boot_data_section _GENERIC_SECTION(IMX_BOOT_DATA)
28+
#define __imx_boot_ivt_section _GENERIC_SECTION(IMX_BOOT_IVT)
2629
#endif /* CONFIG_ARM */
2730

2831
#if defined(CONFIG_NOCACHE_MEMORY)

include/linker/sections.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
#define _CCM_NOINIT_SECTION_NAME .ccm_noinit
5959
#endif
6060

61+
#define IMX_BOOT_CONF .boot_hdr.conf
62+
#define IMX_BOOT_DATA .boot_hdr.data
63+
#define IMX_BOOT_IVT .boot_hdr.ivt
64+
6165
#ifdef CONFIG_NOCACHE_MEMORY
6266
#define _NOCACHE_SECTION_NAME nocache
6367
#endif

soc/arm/nxp_imx/rt/Kconfig.soc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,41 @@ config IPG_DIV
152152
int "IPG clock divider"
153153
range 0 3
154154

155+
menuconfig NXP_IMX_RT_BOOT_HEADER
156+
bool "Enable the boot header"
157+
help
158+
Enable data structures required by the boot ROM to boot the
159+
application from an external flash device.
160+
161+
if NXP_IMX_RT_BOOT_HEADER
162+
163+
choice BOOT_DEVICE
164+
prompt "Boot device selection"
165+
default BOOT_FLEXSPI_NOR
166+
167+
config BOOT_FLEXSPI_NOR
168+
bool "FlexSPI serial NOR"
169+
170+
config BOOT_FLEXSPI_NAND
171+
bool "FlexSPI serial NAND"
172+
173+
config BOOT_SEMC_NOR
174+
bool "SEMC parallel NOR"
175+
176+
config BOOT_SEMC_NAND
177+
bool "SEMC parallel NAND"
178+
179+
endchoice
180+
181+
config IMAGE_VECTOR_TABLE_OFFSET
182+
hex "Image vector table offset"
183+
default 0x1000 if BOOT_FLEXSPI_NOR || BOOT_SEMC_NOR
184+
default 0x400 if BOOT_FLEXSPI_NAND || BOOT_SEMC_NAND
185+
help
186+
The Image Vector Table (IVT) provides the boot ROM with pointers to
187+
the application entry point and device configuration data. The boot
188+
ROM reqiures a fixed IVT offset for each type of boot device.
189+
190+
endif # NXP_IMX_RT_BOOT_HEADER
191+
155192
endif # SOC_SERIES_IMX_RT

0 commit comments

Comments
 (0)