Skip to content

Commit 7c77d0e

Browse files
DerekSnellkartben
authored andcommitted
soc: nxp: MCXNx4x: enable booting from QSPI flash
The ROM bootloader has the option to boot from external QSPI flash on the FlexSPI instead of internal flash. Adds CONFIG_NXP_FLEXSPI_BOOT_HEADER to include the FlexSPI boot ROM header in the image. Signed-off-by: Derek Snell <[email protected]>
1 parent 33e5748 commit 7c77d0e

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

soc/nxp/mcx/mcxn/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2024 NXP
2+
# Copyright 2024-2025 NXP
33
#
44
# SPDX-License-Identifier: Apache-2.0
55
#
@@ -8,6 +8,20 @@
88
# Flexcomm SDK driver
99
zephyr_compile_definitions_ifdef(CONFIG_NXP_LP_FLEXCOMM LPFLEXCOMM_INIT_NOT_USED_IN_DRIVER=1)
1010

11+
zephyr_linker_sources_ifdef(CONFIG_NXP_FLEXSPI_BOOT_HEADER
12+
ROM_START SORT_KEY 0 boot_header.ld)
13+
14+
if(CONFIG_NXP_FLEXSPI_BOOT_HEADER)
15+
zephyr_linker_section_configure(
16+
SECTION .rom_start
17+
INPUT ".flexspi_fcb"
18+
OFFSET ${CONFIG_FLEXSPI_CONFIG_BLOCK_OFFSET}
19+
KEEP
20+
PRIO 10
21+
)
22+
zephyr_compile_definitions(XIP_EXTERNAL_FLASH)
23+
endif()
24+
1125
zephyr_sources(soc.c)
1226

1327
if(CONFIG_FLASH_MCUX_FLEXSPI_XIP OR CONFIG_FLASH_MCUX_FLEXSPI_NOR)

soc/nxp/mcx/mcxn/Kconfig

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

44
config SOC_SERIES_MCXN
@@ -77,6 +77,27 @@ config SECOND_CORE_MCUX_ACCESS_LEVEL
7777
enabled.
7878
endif
7979

80+
config NXP_FLEXSPI_BOOT_HEADER
81+
bool "Boot header"
82+
default y if FLASH_MCUX_FLEXSPI_XIP && !BOOTLOADER_MCUBOOT
83+
84+
help
85+
Enable data structures required by the boot ROM to boot the
86+
application from an external flash device.
87+
88+
if NXP_FLEXSPI_BOOT_HEADER
89+
90+
config FLEXSPI_CONFIG_BLOCK_OFFSET
91+
hex "FlexSPI config block offset"
92+
default 0x400
93+
help
94+
FlexSPI configuration block consists of parameters regarding specific
95+
flash devices including read command sequence, quad mode enablement
96+
sequence (optional), etc. The boot ROM expects FlexSPI configuration
97+
parameter to be presented in serial nor flash.
98+
99+
endif # NXP_FLEXSPI_BOOT_HEADER
100+
80101
rsource "../../common/Kconfig.flexspi_xip"
81102

82103
endif # SOC_SERIES_MCXN

soc/nxp/mcx/mcxn/Kconfig.defconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

44
if SOC_SERIES_MCXN
@@ -14,6 +14,7 @@ config NUM_IRQS
1414

1515
config ROM_START_OFFSET
1616
default 0x400 if BOOTLOADER_MCUBOOT
17+
default 0x1000 if !BOOTLOADER_MCUBOOT && FLASH_MCUX_FLEXSPI_XIP
1718

1819
config MCUX_LPTMR_TIMER
1920
default n if (DT_HAS_NXP_OS_TIMER_ENABLED || DT_HAS_ARM_ARMV8M_SYSTICK_ENABLED)

soc/nxp/mcx/mcxn/boot_header.ld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#if defined(CONFIG_NXP_FLEXSPI_BOOT_HEADER)
8+
. = CONFIG_FLEXSPI_CONFIG_BLOCK_OFFSET;
9+
KEEP(*(.flexspi_fcb))
10+
#endif

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ manifest:
210210
groups:
211211
- hal
212212
- name: hal_nxp
213-
revision: d0e49d63ac74208e183ed47ebb4bf8d490ab63fb
213+
revision: 73d478f7afff753c9cf60248e0c0fff4ac572ee0
214214
path: modules/hal/nxp
215215
groups:
216216
- hal

0 commit comments

Comments
 (0)