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