Skip to content

Commit c488c65

Browse files
zejiang0jasonkartben
authored andcommitted
modules: hal_nxp: Unified to use SDK NG driver
Some NXP boards are using legacy SDK driver, such as S32K, K64, MIMX8Q, and so on. The legacy SDK driver will not be updated, migrate to use SDK NG driver. Signed-off-by: Jason Yu <[email protected]>
1 parent 9f7b786 commit c488c65

File tree

11 files changed

+98
-511
lines changed

11 files changed

+98
-511
lines changed

modules/hal_nxp/mcux/CMakeLists.txt

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ if(CONFIG_SOC_LPC11U66
1717
OR CONFIG_SOC_MIMX9352_A55
1818
OR CONFIG_SOC_MIMX9596_A55
1919
OR CONFIG_SOC_MIMX9596_M7
20-
OR CONFIG_SOC_MK22F12
2120
OR CONFIG_SOC_MK64F12
2221
OR CONFIG_SOC_MK66F18
2322
OR CONFIG_SOC_MK80F25615
@@ -64,51 +63,6 @@ else()
6463
endif()
6564

6665
if(DEFINED CONFIG_SOC_SDKNG_UNSUPPORTED)
67-
zephyr_include_directories(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH})
68-
zephyr_include_directories(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers)
69-
70-
# include CMSIS of mcux-sdk for Cortex-A
71-
if(CONFIG_CPU_CORTEX_A)
72-
zephyr_include_directories(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/CMSIS/Core_AArch64/Include)
73-
endif()
74-
75-
# The mcux uses the cpu name to expose SoC-specific features
76-
# of a given peripheral. For example, the UART peripheral may be
77-
# instantiated with/without a hardware FIFO, and the size of that
78-
# FIFO may be different for each instance in a given SoC. See
79-
# fsl_device_registers.h and ${MCUX_DEVICE}_features.h
80-
zephyr_compile_definitions(${MCUX_CPU})
81-
82-
# Build mcux device-specific objects. Although it is not normal
83-
# practice, drilling down like this avoids the need for repetitive
84-
# build scripts for every mcux device.
85-
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_clock.c)
86-
87-
if(${MCUX_DEVICE} MATCHES "LPC")
88-
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_power.c)
89-
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_reset.c)
90-
endif()
91-
92-
zephyr_library_sources_ifdef(CONFIG_SOC_LPC54114_M4
93-
${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/devices/${MCUX_DEVICE_PATH}/gcc/startup_LPC54114_cm4.S
94-
)
95-
96-
# Include middleware/usb
97-
if(CONFIG_UDC_DRIVER OR CONFIG_USB_DEVICE_DRIVER)
98-
if(CONFIG_DT_HAS_NXP_USBPHY_ENABLED)
99-
zephyr_include_directories(${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/middleware/mcux-sdk-middleware-usb/phy)
100-
endif()
101-
# Include usb required header file.
102-
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux_sdk_ng/middleware)
103-
endif()
104-
105-
# Include middleware/bt_controller.cmake
106-
if(CONFIG_BT_H4_NXP_CTLR)
107-
include(${CMAKE_CURRENT_LIST_DIR}/mcux_sdk_ng/middleware/bt_controller.cmake)
108-
endif()
109-
110-
add_subdirectory(${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/components ${CMAKE_CURRENT_BINARY_DIR}/components)
111-
11266
# Include Entry cmake component
11367
add_subdirectory(mcux-sdk)
11468

modules/hal_nxp/mcux/Kconfig.mcux

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
# Copyright 2024 NXP
55
# SPDX-License-Identifier: Apache-2.0
66

7-
config SOC_SDKNG_UNSUPPORTED
8-
bool
9-
help
10-
Indicates whether the SDKNG supports the current SoC
11-
12-
config MCUX_HW_DEVICE_CORE
13-
string
14-
help
15-
Indicates the current device core id
16-
177
config HAS_MCUX
188
bool
199
depends on SOC_FAMILY_KINETIS || SOC_FAMILY_NXP_IMX || SOC_FAMILY_LPC || \

modules/hal_nxp/mcux/mcux-sdk-ng/CMakeLists.txt

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
set(MCUX_SDK_NG_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk-ng)
6-
# SdkRootDirPath is used by MCUX SDK NG CMake files.
7-
set(SdkRootDirPath ${MCUX_SDK_NG_DIR})
8-
9-
# Functions for MCUX SDK cmake files
10-
include(${MCUX_SDK_NG_DIR}/cmake/extension/logging.cmake)
11-
include(${MCUX_SDK_NG_DIR}/cmake/extension/function.cmake)
12-
include(${MCUX_SDK_NG_DIR}/cmake/extension/basic_settings_lite.cmake)
13-
14-
function(set_variable_ifdef feature_toggle variable)
15-
if(${${feature_toggle}})
16-
set(${variable} ON PARENT_SCOPE)
17-
endif()
18-
endfunction()
19-
20-
#specific operation to shared drivers
21-
if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH))
22-
zephyr_code_relocate(FILES ${MCUX_SDK_NG_DIR}/drivers/flexspi/fsl_flexspi.c
23-
LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
24-
endif()
25-
26-
if(CONFIG_NXP_RF_IMU AND CONFIG_SOC_SERIES_MCXW)
27-
zephyr_compile_definitions(HAL_RPMSG_SELECT_ROLE=0U)
28-
endif()
5+
include(basic.cmake)
296

307
if((${MCUX_DEVICE} MATCHES "RW61") AND (NOT DEFINED CONFIG_MINIMAL_LIBC))
318
# Whenever building for RW61x without minimal LIBC, use optimized memcpy.
@@ -39,13 +16,4 @@ include(components/components.cmake)
3916
include(drivers/drivers.cmake)
4017
include(device/device.cmake)
4118

42-
# Expose the driver header include path, so that the shim driver can use them.
43-
get_target_property(MCUXSDK_INCLUDE_DIRS ${MCUX_SDK_PROJECT_NAME} INTERFACE_INCLUDE_DIRECTORIES)
44-
if(NOT MCUXSDK_INCLUDE_DIRS STREQUAL MCUXSDK_INCLUDE_DIRS-NOTFOUND)
45-
zephyr_include_directories(${MCUXSDK_INCLUDE_DIRS})
46-
endif()
47-
48-
get_target_property(MCUXSDK_COMPILE_DEFS ${MCUX_SDK_PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS)
49-
if(NOT MCUXSDK_COMPILE_DEFS STREQUAL MCUXSDK_COMPILE_DEFS-NOTFOUND)
50-
zephyr_compile_definitions(${MCUXSDK_COMPILE_DEFS})
51-
endif()
19+
include(fixup.cmake)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 NXP
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set(MCUX_SDK_NG_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk-ng)
6+
# SdkRootDirPath is used by MCUX SDK NG CMake files.
7+
set(SdkRootDirPath ${MCUX_SDK_NG_DIR})
8+
9+
# Functions for MCUX SDK cmake files
10+
include(${MCUX_SDK_NG_DIR}/cmake/extension/logging.cmake)
11+
include(${MCUX_SDK_NG_DIR}/cmake/extension/function.cmake)
12+
include(${MCUX_SDK_NG_DIR}/cmake/extension/basic_settings_lite.cmake)
13+
14+
function(set_variable_ifdef feature_toggle variable)
15+
if(${${feature_toggle}})
16+
set(${variable} ON PARENT_SCOPE)
17+
endif()
18+
endfunction()

modules/hal_nxp/mcux/mcux-sdk-ng/components/components.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ if(CONFIG_USE_component_osa_zephyr)
5151
set(CONFIG_MCUX_COMPONENT_component.osa_interface ON)
5252
endif()
5353

54+
# Component definitions
55+
if(CONFIG_NXP_RF_IMU AND CONFIG_SOC_SERIES_MCXW)
56+
zephyr_compile_definitions(HAL_RPMSG_SELECT_ROLE=0U)
57+
endif()
58+
5459
add_subdirectory(${MCUX_SDK_NG_DIR}/components/osa
5560
${CMAKE_CURRENT_BINARY_DIR}/osa
5661
)

modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ set_variable_ifdef(CONFIG_MCUX_LPCMP CONFIG_MCUX_COMPONENT_driver.lpc
134134
set_variable_ifdef(CONFIG_NXP_RF_IMU CONFIG_MCUX_COMPONENT_driver.imu)
135135
set_variable_ifdef(CONFIG_TRDC_MCUX_TRDC CONFIG_MCUX_COMPONENT_driver.trdc)
136136
set_variable_ifdef(CONFIG_S3MU_MCUX_S3MU CONFIG_MCUX_COMPONENT_driver.s3mu)
137+
set_variable_ifdef(CONFIG_DAI_NXP_MICFIL CONFIG_MCUX_COMPONENT_driver.pdm)
137138
set_variable_ifdef(CONFIG_PINCTRL_NXP_PORT CONFIG_MCUX_COMPONENT_driver.port)
138139
set_variable_ifdef(CONFIG_DMA_NXP_EDMA CONFIG_MCUX_COMPONENT_driver.edma_soc_rev2)
139140
set_variable_ifdef(CONFIG_COUNTER_MCUX_SNVS_SRTC CONFIG_MCUX_COMPONENT_driver.snvs_lp)
@@ -264,7 +265,17 @@ if(CONFIG_SOC_SERIES_MCXN)
264265
set_variable_ifdef(CONFIG_SOC_FLASH_MCUX CONFIG_MCUX_COMPONENT_driver.romapi_flashiap)
265266
endif()
266267

268+
if(CONFIG_SOC_FAMILY_NXP_IMXRT)
269+
set_variable_ifdef(CONFIG_ETH_NXP_ENET CONFIG_MCUX_COMPONENT_driver.ocotp)
270+
endif()
271+
267272
set_variable_ifdef(CONFIG_SOC_SERIES_MCXW CONFIG_MCUX_COMPONENT_driver.elemu)
268273

274+
#specific operation to shared drivers
275+
if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH))
276+
zephyr_code_relocate(FILES ${MCUX_SDK_NG_DIR}/drivers/flexspi/fsl_flexspi.c
277+
LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
278+
endif()
279+
269280
# Load all drivers
270281
mcux_load_all_cmakelists_in_directory(${SdkRootDirPath}/drivers)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 NXP
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# Expose the driver header include path, so that the shim driver can use them.
6+
get_target_property(MCUXSDK_INCLUDE_DIRS ${MCUX_SDK_PROJECT_NAME} INTERFACE_INCLUDE_DIRECTORIES)
7+
if(NOT MCUXSDK_INCLUDE_DIRS STREQUAL MCUXSDK_INCLUDE_DIRS-NOTFOUND)
8+
zephyr_include_directories(${MCUXSDK_INCLUDE_DIRS})
9+
endif()
10+
11+
get_target_property(MCUXSDK_COMPILE_DEFS ${MCUX_SDK_PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS)
12+
if(NOT MCUXSDK_COMPILE_DEFS STREQUAL MCUXSDK_COMPILE_DEFS-NOTFOUND)
13+
zephyr_compile_definitions(${MCUXSDK_COMPILE_DEFS})
14+
endif()

0 commit comments

Comments
 (0)