1list(APPEND CMAKE_MODULE_PATH 2 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE} 3 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE}/drivers 4 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/common 5 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/dmamux 6 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/CMSIS/Core/Include 7) 8 9function(include_ifdef feature_toggle module) 10 if(${${feature_toggle}}) 11 include(${module}) 12 endif() 13endfunction() 14 15function(include_driver_ifdef feature_toggle directory module) 16 if(${${feature_toggle}}) 17 list(APPEND CMAKE_MODULE_PATH 18 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/${directory} 19 ) 20 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/${directory}) 21 include(${module}) 22 endif() 23endfunction() 24 25message("Load components for ${MCUX_DEVICE}:") 26 27#specific operation to shared drivers 28if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH)) 29 zephyr_code_relocate(FILES ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/flexspi/fsl_flexspi.c 30 LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) 31endif() 32 33if(NOT CONFIG_ASSERT OR CONFIG_FORCE_NO_ASSERT) 34 zephyr_compile_definitions(NDEBUG) # squelch fsl_flexcan.c warning 35endif() 36 37zephyr_compile_definitions_ifdef( 38 CONFIG_PTP_CLOCK_MCUX 39 ENET_ENHANCEDBUFFERDESCRIPTOR_MODE 40) 41 42zephyr_library_compile_definitions_ifdef( 43 CONFIG_HAS_MCUX_CACHE FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL 44) 45 46include(driver_common) 47 48#Include system_xxx file 49#This can be extended to other SoC series if needed 50if (DEFINED CONFIG_PLATFORM_SPECIFIC_INIT OR DEFINED CONFIG_SOC_SERIES_IMX_RT6XX 51 OR DEFINED CONFIG_SOC_SERIES_LPC55XXX) 52if (CONFIG_SOC_MIMXRT1166_CM4) 53include(device_system_MIMXRT1166_cm4) 54elseif (CONFIG_SOC_MIMXRT1166_CM7) 55include(device_system_MIMXRT1166_cm7) 56elseif (CONFIG_SOC_MIMXRT1176_CM4) 57include(device_system_MIMXRT1176_cm4) 58elseif (CONFIG_SOC_MIMXRT1176_CM7) 59include(device_system_MIMXRT1176_cm7) 60elseif (CONFIG_SOC_LPC55S69_CPU0) 61include(device_system_LPC55S69_cm33_core0) 62elseif (CONFIG_SOC_LPC55S69_CPU1) 63include(device_system_LPC55S69_cm33_core1) 64elseif (CONFIG_SOC_LPC54114_M4) 65include(device_system_LPC54114_cm4) 66elseif (CONFIG_SOC_LPC54114_M0) 67include(device_system_LPC54114_cm0plus) 68else() 69include(device_system) 70endif() 71endif() 72 73zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/common) 74 75#include shared drivers 76include_driver_ifdef(CONFIG_ADC_MCUX_LPADC lpadc driver_lpadc) 77include_driver_ifdef(CONFIG_COUNTER_MCUX_CTIMER ctimer driver_ctimer) 78include_driver_ifdef(CONFIG_COUNTER_MCUX_LPC_RTC lpc_rtc driver_lpc_rtc) 79include_driver_ifdef(CONFIG_DMA_MCUX_LPC lpc_dma driver_lpc_dma) 80include_driver_ifdef(CONFIG_GPIO_MCUX_LPC lpc_gpio driver_lpc_gpio) 81include_driver_ifdef(CONFIG_NXP_PINT pint driver_pint) 82include_driver_ifdef(CONFIG_NXP_PINT inputmux driver_inputmux) 83include_driver_ifdef(CONFIG_I2C_MCUX_FLEXCOMM flexcomm driver_flexcomm_i2c) 84include_driver_ifdef(CONFIG_I2C_MCUX_FLEXCOMM flexcomm driver_flexcomm) 85include_driver_ifdef(CONFIG_I2S_MCUX_FLEXCOMM flexcomm driver_flexcomm_i2s) 86include_driver_ifdef(CONFIG_I2S_MCUX_FLEXCOMM flexcomm driver_flexcomm) 87include_driver_ifdef(CONFIG_MCUX_OS_TIMER ostimer driver_ostimer) 88include_driver_ifdef(CONFIG_PWM_MCUX_SCTIMER sctimer driver_sctimer) 89include_driver_ifdef(CONFIG_SOC_FLASH_LPC flashiap driver_flashiap) 90include_driver_ifdef(CONFIG_SPI_MCUX_FLEXCOMM flexcomm driver_flexcomm_spi) 91include_driver_ifdef(CONFIG_SPI_MCUX_FLEXCOMM flexcomm driver_flexcomm) 92include_driver_ifdef(CONFIG_UART_MCUX_FLEXCOMM flexcomm driver_flexcomm_usart) 93include_driver_ifdef(CONFIG_UART_MCUX_FLEXCOMM flexcomm driver_flexcomm) 94include_driver_ifdef(CONFIG_WDT_MCUX_WWDT wwdt driver_wwdt) 95include_driver_ifdef(CONFIG_ADC_MCUX_ADC12 adc12 driver_adc12) 96include_driver_ifdef(CONFIG_ADC_MCUX_ADC16 adc16 driver_adc16) 97include_driver_ifdef(CONFIG_IPM_IMX_REV2 mu driver_mu) 98include_driver_ifdef(CONFIG_CAN_MCUX_FLEXCAN flexcan driver_flexcan) 99include_driver_ifdef(CONFIG_CAN_MCUX_FLEXCAN_FD flexcan driver_flexcan) 100include_driver_ifdef(CONFIG_COUNTER_MCUX_PIT pit driver_pit) 101include_driver_ifdef(CONFIG_COUNTER_MCUX_RTC rtc driver_rtc) 102include_driver_ifdef(CONFIG_DAC_MCUX_DAC dac driver_dac) 103include_driver_ifdef(CONFIG_DAC_MCUX_DAC32 dac32 driver_dac32) 104include_driver_ifdef(CONFIG_DMA_MCUX_EDMA edma driver_edma) 105include_driver_ifdef(CONFIG_DMA_MCUX_EDMA dmamux driver_dmamux) 106include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNGA rnga driver_rnga) 107include_driver_ifdef(CONFIG_ENTROPY_MCUX_TRNG trng driver_trng) 108include_driver_ifdef(CONFIG_ENTROPY_MCUX_CAAM caam driver_caam) 109include_driver_ifdef(CONFIG_ETH_MCUX enet driver_enet) 110include_driver_ifdef(CONFIG_HAS_MCUX_SMC smc driver_smc) 111include_driver_ifdef(CONFIG_I2C_MCUX i2c driver_i2c) 112include_driver_ifdef(CONFIG_I2C_MCUX_LPI2C lpi2c driver_lpi2c) 113include_driver_ifdef(CONFIG_I3C_MCUX i3c driver_i3c) 114include_driver_ifdef(CONFIG_MCUX_ACMP acmp driver_acmp) 115include_driver_ifdef(CONFIG_PWM_MCUX_FTM ftm driver_ftm) 116include_driver_ifdef(CONFIG_PWM_MCUX_TPM tpm driver_tpm) 117include_driver_ifdef(CONFIG_PWM_MCUX_PWT pwt driver_pwt) 118include_driver_ifdef(CONFIG_RTC_MCUX rtc driver_rtc) 119include_driver_ifdef(CONFIG_SPI_MCUX_DSPI dspi driver_dspi) 120include_driver_ifdef(CONFIG_SPI_MCUX_LPSPI lpspi driver_lpspi) 121include_driver_ifdef(CONFIG_UART_MCUX uart driver_uart) 122include_driver_ifdef(CONFIG_UART_MCUX_LPSCI lpsci driver_lpsci) 123include_driver_ifdef(CONFIG_UART_MCUX_LPUART lpuart driver_lpuart) 124include_driver_ifdef(CONFIG_WDT_MCUX_WDOG wdog driver_wdog) 125include_driver_ifdef(CONFIG_WDT_MCUX_WDOG32 wdog32 driver_wdog32) 126include_driver_ifdef(CONFIG_COUNTER_MCUX_GPT gpt driver_gpt) 127include_driver_ifdef(CONFIG_MCUX_GPT_TIMER gpt driver_gpt) 128include_driver_ifdef(CONFIG_COUNTER_MCUX_PIT pit driver_pit) 129include_driver_ifdef(CONFIG_COUNTER_MCUX_QTMR qtmr_1 driver_qtmr_1) 130include_driver_ifdef(CONFIG_DISPLAY_MCUX_ELCDIF elcdif driver_elcdif) 131include_driver_ifdef(CONFIG_DISPLAY_MCUX_DCNANO_LCDIF lcdif driver_lcdif) 132include_driver_ifdef(CONFIG_MCUX_PXP pxp driver_pxp) 133include_driver_ifdef(CONFIG_ETH_MCUX enet driver_enet) 134include_driver_ifdef(CONFIG_GPIO_MCUX_IGPIO igpio driver_igpio) 135include_driver_ifdef(CONFIG_I2C_MCUX_LPI2C lpi2c driver_lpi2c) 136include_driver_ifdef(CONFIG_I2S_MCUX_SAI sai driver_sai) 137include_driver_ifdef(CONFIG_MEMC_MCUX_FLEXSPI flexspi driver_flexspi) 138include_driver_ifdef(CONFIG_PWM_MCUX pwm driver_pwm) 139include_driver_ifdef(CONFIG_SPI_MCUX_LPSPI lpspi driver_lpspi) 140include_driver_ifdef(CONFIG_UART_MCUX_LPUART lpuart driver_lpuart) 141include_driver_ifdef(CONFIG_VIDEO_MCUX_CSI csi driver_csi) 142include_driver_ifdef(CONFIG_WDT_MCUX_IMX_WDOG wdog01 driver_wdog01) 143include_driver_ifdef(CONFIG_DMA_MCUX_LPC lpc_dma driver_lpc_dma) 144include_driver_ifdef(CONFIG_MEMC_MCUX_FLEXSPI flexspi driver_flexspi) 145include_driver_ifdef(CONFIG_HAS_MCUX_RDC rdc driver_rdc) 146include_driver_ifdef(CONFIG_UART_MCUX_IUART iuart driver_iuart) 147include_driver_ifdef(CONFIG_ADC_MCUX_12B1MSPS_SAR adc_12b1msps_sar driver_adc_12b1msps_sar) 148include_driver_ifdef(CONFIG_HWINFO_MCUX_SRC src driver_src) 149include_driver_ifdef(CONFIG_HWINFO_MCUX_SIM sim driver_sim) 150include_driver_ifdef(CONFIG_HWINFO_MCUX_RCM rcm driver_rcm) 151include_driver_ifdef(CONFIG_IPM_MCUX mailbox driver_mailbox) 152include_driver_ifdef(CONFIG_COUNTER_MCUX_SNVS snvs_hp driver_snvs_hp) 153include_driver_ifdef(CONFIG_COUNTER_MCUX_SNVS_SRTC snvs_lp driver_snvs_lp) 154include_driver_ifdef(CONFIG_COUNTER_MCUX_LPTMR lptmr driver_lptmr) 155include_driver_ifdef(CONFIG_MCUX_LPTMR_TIMER lptmr driver_lptmr) 156include_driver_ifdef(CONFIG_IMX_USDHC usdhc driver_usdhc) 157include_driver_ifdef(CONFIG_MIPI_DSI_MCUX mipi_dsi_split driver_mipi_dsi_split) 158include_driver_ifdef(CONFIG_MIPI_DSI_MCUX_2L mipi_dsi driver_mipi_dsi) 159include_driver_ifdef(CONFIG_ADC_LPC_ADC lpc_adc driver_lpc_adc) 160include_driver_ifdef(CONFIG_MCUX_SDIF sdif driver_sdif) 161include_driver_ifdef(CONFIG_ADC_MCUX_ETC adc_etc driver_adc_etc) 162include_driver_ifdef(CONFIG_MCUX_XBARA xbara driver_xbara) 163include_driver_ifdef(CONFIG_QDEC_MCUX enc driver_enc) 164 165if ((${MCUX_DEVICE} MATCHES "MIMXRT1[0-9][0-9][0-9]") AND (NOT (CONFIG_SOC_MIMXRT1166_CM4 OR CONFIG_SOC_MIMXRT1176_CM4))) 166 include_driver_ifdef(CONFIG_HAS_MCUX_CACHE cache/armv7-m7 driver_cache_armv7_m7) 167elseif(${MCUX_DEVICE} MATCHES "MIMXRT(5|6)") 168 include_driver_ifdef(CONFIG_HAS_MCUX_CACHE cache/cache64 driver_cache_cache64) 169elseif((${MCUX_DEVICE} MATCHES "MK(28|66)") OR (${MCUX_DEVICE} MATCHES "MKE(14|16|18)") OR (CONFIG_SOC_MIMXRT1166_CM4) OR (CONFIG_SOC_MIMXRT1176_CM4)) 170 include_driver_ifdef(CONFIG_HAS_MCUX_CACHE cache/lmem driver_cache_lmem) 171endif() 172 173if (${MCUX_DEVICE} MATCHES "MIMXRT11[0-9][0-9]") 174 include_driver_ifdef(CONFIG_PM_MCUX_GPC gpc_3 driver_gpc_3) 175 include_ifdef(CONFIG_HWINFO_MCUX_SRC_V2 driver_soc_src) 176elseif (${MCUX_DEVICE} MATCHES "MIMXRT10[0-9][0-9]") 177 include_driver_ifdef(CONFIG_PM_MCUX_GPC gpc_1 driver_gpc_1) 178 include_driver_ifdef(CONFIG_PM_MCUX_DCDC dcdc_1 driver_dcdc_1) 179 include_driver_ifdef(CONFIG_PM_MCUX_PMU pmu driver_pmu) 180endif() 181 182if("${CONFIG_SOC_FAMILY}" STREQUAL "nxp_kinetis") 183 184 include_driver_ifdef(CONFIG_SOC_FLASH_MCUX flash driver_flash) 185 186 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port/driver_port.cmake) 187 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port) 188 189 if(${MCUX_DEVICE} MATCHES "MK(80|82|64|66|M34|M35|E14F|E16F|E18F)") 190 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/sysmpu/driver_sysmpu.cmake) 191 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/sysmpu) 192 endif() 193 194endif() 195 196if("${CONFIG_SOC_FAMILY}" STREQUAL "nxp_lpc") 197 198if ((${MCUX_DEVICE} MATCHES "LPC8[0-9][0-9]") OR (${MCUX_DEVICE} MATCHES "LPC5(1|4)")) 199 include_driver_ifdef(CONFIG_SOC_FLASH_MCUX iap driver_iap) 200 include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNG iap driver_rng) 201elseif (${MCUX_DEVICE} MATCHES "LPC55") 202 if (${MCUX_DEVICE} MATCHES "LPC55S*3") 203 if(${CONFIG_SOC_FLASH_MCUX}) 204 list(APPEND CMAKE_MODULE_PATH 205 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/LPC55S36/drivers 206 ) 207 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/LPC55S36/drivers/flash) 208 include(driver_flashiap) 209 endif() 210 else() 211 include_driver_ifdef(CONFIG_SOC_FLASH_MCUX iap1 driver_iap1) 212 endif() 213 include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNG rng_1 driver_rng_1) 214endif() 215 216if (${MCUX_DEVICE} MATCHES "LPC5") 217 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon/driver_lpc_iocon.cmake) 218 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon) 219 if (${MCUX_DEVICE} MATCHES "LPC55S*3" AND DEFINED CONFIG_ADC_MCUX_LPADC) 220 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/vref_1/driver_vref_1.cmake) 221 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/vref_1) 222 endif() 223elseif (${MCUX_DEVICE} MATCHES "LPC8") 224 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon_lite/driver_lpc_iocon_lite.cmake) 225 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon_lite) 226endif() 227 228endif() 229 230if(${MCUX_DEVICE} MATCHES "MIMXRT(5|6)") 231 include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iopctl/driver_lpc_iopctl.cmake) 232 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iopctl) 233endif() 234 235if(CONFIG_ETH_MCUX) 236 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy) 237 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyksz8081) 238 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyar8031) 239 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phylan8720a) 240 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyrtl8211f) 241 zephyr_library_sources(mcux-sdk/components/phy/device/phyksz8081/fsl_phyksz8081.c) 242 zephyr_library_sources(mcux-sdk/components/phy/device/phyar8031/fsl_phyar8031.c) 243 zephyr_library_sources(mcux-sdk/components/phy/device/phylan8720a/fsl_phylan8720a.c) 244 zephyr_library_sources(mcux-sdk/components/phy/device/phyrtl8211f/fsl_phyrtl8211f.c) 245 246 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/mdio/enet) 247 #zephyr_library_sources(mcux-sdk/components/phy/mdio/enet/fsl_enet_mdio.c) 248endif() 249 250if (CONFIG_USB_DEVICE_DRIVER) 251 list(APPEND CMAKE_MODULE_PATH 252 ${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb 253 ) 254 include(middleware_usb_phy) 255 include_ifdef(CONFIG_USB_DC_NXP_EHCI middleware_usb_device_ehci) 256 include_ifdef(CONFIG_USB_DC_NXP_LPCIP3511 middleware_usb_device_ip3511fs) 257 258 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/device) 259 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/phy) 260 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/include) 261endif() 262 263if(CONFIG_ENTROPY_MCUX_CSS) 264 list(APPEND CMAKE_MODULE_PATH 265 ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc 266 ) 267 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxClCss/inc) 268 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxCsslFlowProtection/inc) 269 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxCsslSecureCounter/inc) 270 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxCsslCPreProcessor/inc) 271 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxClMemory/inc) 272 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/platforms) 273 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/platforms/LPC55S3x/inc) 274 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/compiler/iar) 275 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/platforms/crypto_ip/inc/css/2.13.4) 276 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/platforms/crypto_ip/inc/fame) 277 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxClKey/src) 278 zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/css_pkc/src/comps/mcuxClSession/inc) 279 include(component_css) 280endif() 281