From c387d9c73dc8f4053b0d76248b712a04b9cae8a2 Mon Sep 17 00:00:00 2001 From: Jason Yu Date: Mon, 12 May 2025 20:49:32 +0800 Subject: [PATCH] modules: hal_nxp: mcux-sdk-ng: Fix LPC55S16 build error Fix build error when CONFIG_MCUX_COMPONENT_driver.fro_calib is set. Error message: modules/hal/nxp/mcux/mcux-sdk-ng/cmake/extension/function.cmake:2084 (if) if given arguments: "IN_LIST" "NEED_WRAP_TOOLCHAINS" The error is because, mcux sdk ng cmake functions `mcux_add_xxx` support add content based on toolchains. CMake should set current toolchain in CMake Variable `CONFIG_TOOLCHAIN` to use this feature. Signed-off-by: Jason Yu --- modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake | 18 ++++++++++++++++++ scripts/ci/check_compliance.py | 3 +++ 2 files changed, 21 insertions(+) diff --git a/modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake b/modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake index 806a49488bb..9a3f07ec0f2 100644 --- a/modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake +++ b/modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake @@ -20,3 +20,21 @@ function(set_variable_ifdef feature_toggle variable) set(${variable} ON PARENT_SCOPE) endif() endfunction() + +# mcux sdk ng cmake functions `mcux_add_xxx` support add content based on +# toolchains, like +# +# mcux_add_library( +# LIBS ../iar/iar_lib_fro_calib_cm33_core0.a +# TOOLCHAINS iar +# ) +# +# CMake should set current toolchain in CMake Variable +# `CONFIG_TOOLCHAIN` to use this feature. +if (${COMPILER} STREQUAL iar) + set(CONFIG_TOOLCHAIN iar) +elseif (${COMPILER} STREQUAL xcc) + set(CONFIG_TOOLCHAIN xtensa) +else () + set(CONFIG_TOOLCHAIN armgcc) +endif() diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f07fbb1b95f..b622ea3ef07 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1137,6 +1137,9 @@ flagged. "STACK_SIZE", # Used as an example in the Kconfig docs "STD_CPP", # Referenced in CMake comment "TEST1", + "TOOLCHAIN", # Defined in modules/hal_nxp/mcux/mcux-sdk-ng/basic.cmake. + # It is used by MCUX SDK cmake functions to add content + # based on current toolchain. "TOOLCHAIN_ARCMWDT_SUPPORTS_THREAD_LOCAL_STORAGE", # The symbol is defined in the toolchain # Kconfig which is sourced based on Zephyr # toolchain variant and therefore not visible