The CMakeLists.txt files in folders modules/hal_nxp/mcux/mcux-sdk-ng/*/ are loaded in modules/hal_nxp/mcux/mcux-sdk-ng/CMakeLists.txt using cmake function `add_subdirectory`. One issue is, when variables defined in one CMakeLists.txt are needed by another CMakeLists.txt, then the variables need be exposed to parent scope. This is not convenient. Another issue is, to expose variables, the function `set_variable_ifdef` sets the variables as global variables. The CMake global variables named `CONFIG_xxx` will be collected by Kconfig, and results in build fail. The solution is: 1. Replace `add_subdirectory` with `include`, so that the variables will be in the same file scope, don't need to expose them. 2. Modify the implementation of `set_variable_ifdef`, don't set variables as global variables. Resolves #88135 Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
82 lines
2.4 KiB
CMake
82 lines
2.4 KiB
CMake
# Copyright 2025 NXP
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
if(CONFIG_WIFI_NXP)
|
|
set(CONFIG_MCUX_COMPONENT_component.wifi_bt_module.tx_pwr_limits ON)
|
|
endif()
|
|
|
|
if(CONFIG_NXP_FW_LOADER)
|
|
set(CONFIG_MCUX_COMPONENT_driver.conn_fwloader ON)
|
|
set(CONFIG_USE_component_osa_zephyr ON)
|
|
endif()
|
|
|
|
if(${MCUX_DEVICE} MATCHES "RW61")
|
|
set(CONFIG_USE_component_osa_zephyr ON)
|
|
if(CONFIG_NXP_FW_LOADER)
|
|
set(CONFIG_MCUX_COMPONENT_component.mflash_offchip ON)
|
|
set(CONFIG_MCUX_COMPONENT_driver.cache_cache64 ON)
|
|
set(CONFIG_MCUX_COMPONENT_driver.flexspi ON)
|
|
endif()
|
|
endif()
|
|
|
|
if(CONFIG_USB_DEVICE_DRIVER OR CONFIG_UDC_DRIVER OR CONFIG_BT)
|
|
set(CONFIG_USE_component_osa_zephyr ON)
|
|
endif()
|
|
|
|
if(CONFIG_NXP_RF_IMU)
|
|
if(CONFIG_SOC_SERIES_RW6XX)
|
|
set(CONFIG_MCUX_COMPONENT_driver.imu ON)
|
|
set(CONFIG_MCUX_COMPONENT_driver.gdma ON)
|
|
zephyr_include_directories(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/components/rpmsg)
|
|
zephyr_library_sources(${ZEPHYR_CURRENT_MODULE_DIR}/mcux/mcux-sdk/components/rpmsg/fsl_adapter_rfimu.c)
|
|
elseif(CONFIG_SOC_SERIES_MCXW)
|
|
set(CONFIG_MCUX_COMPONENT_component.lists ON)
|
|
set(CONFIG_MCUX_COMPONENT_component.rpmsg_adapter ON)
|
|
zephyr_compile_definitions(HAL_RPMSG_SELECT_ROLE=0U)
|
|
endif()
|
|
endif()
|
|
|
|
if(CONFIG_SOC_SERIES_MCXW)
|
|
if(CONFIG_NET_L2_IEEE802154 OR CONFIG_NET_L2_OPENTHREAD)
|
|
set(CONFIG_MCUX_COMPONENT_component.lists ON)
|
|
set(CONFIG_USE_component_osa_zephyr ON)
|
|
zephyr_compile_definitions(OSA_USED=1U)
|
|
endif()
|
|
endif()
|
|
|
|
if(CONFIG_USE_component_osa_zephyr)
|
|
set(CONFIG_MCUX_COMPONENT_component.osa_template_config ON)
|
|
set(CONFIG_MCUX_COMPONENT_component.osa_zephyr ON)
|
|
set(CONFIG_MCUX_COMPONENT_component.osa_interface ON)
|
|
endif()
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/osa
|
|
${CMAKE_CURRENT_BINARY_DIR}/osa
|
|
)
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/wifi_bt_module
|
|
${CMAKE_CURRENT_BINARY_DIR}/wifi_bt_module
|
|
)
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/conn_fwloader
|
|
${CMAKE_CURRENT_BINARY_DIR}/conn_fwloader
|
|
)
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/lists
|
|
${CMAKE_CURRENT_BINARY_DIR}/lists
|
|
)
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/rpmsg
|
|
${CMAKE_CURRENT_BINARY_DIR}/rpmsg
|
|
)
|
|
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/imu_adapter
|
|
${CMAKE_CURRENT_BINARY_DIR}/imu_adapter
|
|
)
|
|
|
|
if(${MCUX_DEVICE} MATCHES "RW61")
|
|
add_subdirectory(${MCUX_SDK_NG_DIR}/components/flash/mflash/rdrw612bga
|
|
${CMAKE_CURRENT_BINARY_DIR}/flash/mflash
|
|
)
|
|
endif()
|