1# Copyright 2024 NXP
2# SPDX-License-Identifier: Apache-2.0
3
4add_subdirectory(${SOC_SERIES})
5
6zephyr_include_directories(.)
7zephyr_include_directories(${SOC_SERIES})
8
9zephyr_linker_sources_ifdef(CONFIG_NXP_IMXRT_BOOT_HEADER
10  ROM_START SORT_KEY 0 boot_header.ld)
11
12if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX)
13  if(CONFIG_DEVICE_CONFIGURATION_DATA)
14    set(boot_hdr_dcd_data_section ".boot_hdr.dcd_data")
15  endif()
16  if(CONFIG_EXTERNAL_MEM_CONFIG_DATA)
17    set(boot_hdr_xmcd_data_section ".boot_hdr.xmcd_data")
18  endif()
19  zephyr_sources_ifdef(CONFIG_ARM_MPU mpu_regions.c)
20  zephyr_linker_section_configure(
21    SECTION .rom_start
22    INPUT ".boot_hdr.conf"
23    OFFSET ${CONFIG_FLEXSPI_CONFIG_BLOCK_OFFSET}
24    KEEP
25    PRIO 10
26  )
27  zephyr_linker_section_configure(
28    SECTION .rom_start
29    INPUT ".boot_hdr.ivt"
30          ".boot_hdr.data"
31          ${boot_hdr_dcd_data_section}
32          ${boot_hdr_xmcd_data_section}
33    OFFSET ${CONFIG_IMAGE_VECTOR_TABLE_OFFSET}
34    FIRST
35    KEEP
36    PRIO 11
37  )
38  zephyr_compile_definitions(XIP_EXTERNAL_FLASH)
39endif()
40
41if(CONFIG_SOC_SERIES_IMXRT118X)
42  if(CONFIG_SOC_MIMXRT1189_CM7)
43    zephyr_sources(mpu_regions.c)
44  endif()
45  if(CONFIG_EXTERNAL_MEM_CONFIG_DATA)
46    set(boot_hdr_xmcd_data_section ".boot_hdr.xmcd_data")
47  endif()
48  zephyr_linker_section_configure(
49    SECTION .rom_start
50    INPUT ".boot_hdr.conf"
51    OFFSET ${CONFIG_FLEXSPI_CONFIG_BLOCK_OFFSET}
52    KEEP
53    PRIO 10
54  )
55  zephyr_linker_section_configure(
56    SECTION .rom_start
57    INPUT ${boot_hdr_xmcd_data_section}
58    OFFSET ${CONFIG_EXTERNAL_MEM_CONFIG_OFFSET}
59    KEEP
60    PRIO 10
61  )
62  zephyr_linker_section_configure(
63    SECTION .rom_start
64    INPUT ".boot_hdr.container"
65    OFFSET ${CONFIG_IMAGE_CONTAINER_OFFSET}
66    KEEP
67    PRIO 11
68  )
69  zephyr_compile_definitions(XIP_EXTERNAL_FLASH)
70endif()
71
72if(CONFIG_SOC_SERIES_IMXRT6XX OR CONFIG_SOC_SERIES_IMXRT5XX)
73  zephyr_linker_sources_ifdef(CONFIG_USB_DEVICE_DRIVER SECTIONS usb.ld)
74  zephyr_linker_sources_ifdef(CONFIG_UDC_DRIVER SECTIONS usb.ld)
75endif()
76
77if(CONFIG_MEMC)
78  zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/memc)
79endif()
80
81if(CONFIG_SOC_SERIES_IMXRT118X)
82  zephyr_linker_sources_ifdef(CONFIG_SOC_SERIES_IMXRT118X SECTIONS container.ld)
83endif()
84