@@ -57,71 +57,73 @@ endmacro()
5757# Store the configuration of the compiled OpenThread libraries
5858# and set source and destination paths.
5959function (openthread_libs_configuration_write CONFIG_FILE NRFXLIB_RELEASE_TAG)
60- # Store all OT related variables
61- get_cmake_property (_variableNames VARIABLES )
62- foreach (_variableName ${_variableNames} )
63- if ("${_variableName} " MATCHES "^CONFIG_OPENTHREAD_.*|^OT_.*" )
64- list (APPEND OPENTHREAD_SETTINGS "${_variableName} =${${_variableName} }\n " )
65- endif ()
66- endforeach ()
67-
68- list (SORT OPENTHREAD_SETTINGS)
60+ # Store compiler and Zephyr SDK version
61+ execute_process (COMMAND ${CMAKE_C_COMPILER} --version
62+ OUTPUT_VARIABLE GCC_VERSION)
63+ string (REPLACE "\n " ";" GCC_VERSION_LINES ${GCC_VERSION} )
64+ list (GET GCC_VERSION_LINES 0 GCC_VERSION_LINE)
65+ list (APPEND LIB_CONFIGURATION "###################### Compiler Version ######################\n\n " )
66+ list (APPEND LIB_CONFIGURATION "GCC_version: ${GCC_VERSION_LINE} \n " )
6967
68+ # Store SDK Version
7069 find_package (Git QUIET )
7170 if (GIT_FOUND)
71+ list (APPEND LIB_CONFIGURATION "\n ###################### SDK Version ###########################\n\n " )
7272 get_git_decribe(${ZEPHYR_MBEDTLS_MODULE_DIR} )
73- list (INSERT OPENTHREAD_SETTINGS 0 "MBEDTLS_commit=${git_describe} \n " )
73+ list (APPEND LIB_CONFIGURATION "MBEDTLS_commit=${git_describe} " )
7474
7575 get_git_decribe(${ZEPHYR_NRFXLIB_MODULE_DIR} )
76- list (INSERT OPENTHREAD_SETTINGS 0 "NRFXLIB_commit=${git_describe} " )
76+ list (APPEND LIB_CONFIGURATION "NRFXLIB_commit=${git_describe} " )
7777
7878 get_git_decribe(${ZEPHYR_OPENTHREAD_MODULE_DIR} )
79- list (INSERT OPENTHREAD_SETTINGS 0 "OpenThread_commit=${git_describe} " )
79+ list (APPEND LIB_CONFIGURATION "OpenThread_commit=${git_describe} " )
8080
81- list (INSERT OPENTHREAD_SETTINGS 0 "NRFXLIB_RELEASE_TAG=${NRFXLIB_RELEASE_TAG} \n " )
81+ list (APPEND LIB_CONFIGURATION "NRFXLIB_RELEASE_TAG=${NRFXLIB_RELEASE_TAG} \n " )
8282 endif ()
8383
84- # Store compiler and Zephyr SDK version
85- execute_process (COMMAND ${CMAKE_C_COMPILER} --version
86- OUTPUT_VARIABLE GCC_VERSION)
87- string (REPLACE "\n " ";" GCC_VERSION_LINES ${GCC_VERSION} )
88- list (GET GCC_VERSION_LINES 0 GCC_VERSION_LINE)
89- list (INSERT OPENTHREAD_SETTINGS 0 "GCC_version: ${GCC_VERSION_LINE} \n\n " )
84+ # Store all OT related variables
85+ get_cmake_property (_variableNames VARIABLES )
86+ list (APPEND OPENTHREAD_SETTINGS "\n ###################### OpenThread configuration ##############\n\n " )
87+ foreach (_variableName ${_variableNames} )
88+ if ("${_variableName} " MATCHES "^CONFIG_OPENTHREAD_.*|^OT_.*" )
89+ list (APPEND OPENTHREAD_SETTINGS "${_variableName} =${${_variableName} }\n " )
90+ endif ()
91+ endforeach ()
92+ list (SORT OPENTHREAD_SETTINGS)
93+ list (APPEND LIB_CONFIGURATION ${OPENTHREAD_SETTINGS} )
9094
91- file (WRITE ${CONFIG_FILE} ${OPENTHREAD_SETTINGS} )
92- endfunction ()
95+ # Store Crypto configuration
96+ list (APPEND LIB_CONFIGURATION "\n ###################### Crypto configuration ##################\n\n " )
97+ foreach (_variableName ${_variableNames} )
98+ if ("${_variableName} " MATCHES "^CONFIG_MBEDTLS_.*|^CONFIG_PSA_WANT_.*" )
99+ list (APPEND CRYPTO_SETTINGS "${_variableName} =${${_variableName} }\n " )
100+ endif ()
101+ endforeach ()
102+ list (SORT CRYPTO_SETTINGS)
103+ list (APPEND LIB_CONFIGURATION ${CRYPTO_SETTINGS} )
93104
94- function (get_active_mbedtls_configs_from_file fileName returnMatch1List)
95- file (READ ${fileName} FILE_CONTENT)
96- set (PATTERN "\n [ \t ]*#define[ \t ]+(MBEDTLS_[A-Za-z0-9_]*[ \t ]*[0-9A-Fx]*)" )
97- string (REGEX MATCHALL ${PATTERN} match_list ${FILE_CONTENT} )
98- foreach (element ${match_list} )
99- string (REGEX MATCH ${PATTERN} MACRO_DEF ${element} )
100- list (APPEND match1_list "${CMAKE_MATCH_1} \n " )
101- set (${returnMatch1List} ${match1_list} PARENT_SCOPE)
102- endforeach ()
105+ file (WRITE ${CONFIG_FILE} ${LIB_CONFIGURATION} )
103106endfunction ()
104107
105- function (check_openthread_dependencies ot_lib_nrf_security_mbedtls_config_file )
106- if (CONFIG_BUILD_WITH_TFM )
107- set (nrf_security_mbedtls_config_file ${CMAKE_CURRENT_BINARY_DIR} /../../../../ generated /interface_nrf_security_psa/ ${CONFIG_MBEDTLS_CFG_FILE} )
108- else ( )
109- set (nrf_security_mbedtls_config_file ${CMAKE_CURRENT_BINARY_DIR} /../../../../ generated /library_nrf_security_psa/ ${CONFIG_MBEDTLS_CFG_FILE } )
110- endif ( )
111- get_active_mbedtls_configs_from_file( ${nrf_security_mbedtls_config_file} mbedtls_conf_list )
112- get_active_mbedtls_configs_from_file( ${ot_lib_nrf_security_mbedtls_config_file} ot_mbedtls_conf_list )
113-
114- foreach (config_option ${ot_mbedtls_conf_list} )
115- if ( NOT ( ${config_option} IN_LIST mbedtls_conf_list ))
108+ function (check_openthread_dependencies CONFIG_FILE )
109+ get_cmake_property (_variableNames VARIABLES )
110+ file (READ ${CONFIG_FILE} FILE_CONTENT )
111+ file (READ "cmake/crypto_config_tfm_whitelist.txt" TFM_WHITELIST )
112+ string ( REGEX MATCHALL "CONFIG_(MBEDTLS_|PSA_WANT_)[^ \n ]*" match_list ${FILE_CONTENT } )
113+ foreach (element ${match_list} )
114+ string ( REGEX MATCH "([^=]+)=(.*)" _ ${element} )
115+ set (config_name " ${CMAKE_MATCH_1} " )
116+ set (config_value " ${CMAKE_MATCH_2} " )
117+ if ( NOT ((config_name IN_LIST _variableNames AND ${ ${config_name} } STREQUAL ${config_value} ) OR
118+ (CONFIG_BUILD_WITH_TFM AND ${TFM_WHITELIST} MATCHES ${config_name} ) ))
116119 message (WARNING
117120 " \n "
118- " Current nrf_security configuration does not provide all MBEDTLS"
119- " options which are required by precompiled OpenThread libraries.\n "
120- " The minimum of MBEDTLS configuration is stored at:"
121- " ${ot_lib_nrf_security_mbedtls_config_file} \n " )
122- break ()
121+ " ${config_name} =${config_value} is required by the precompiled OpenThread libraries,"
122+ " but it has been configured differently in the current build.\n "
123+ " The minimal crypto configuration is stored under \" Crypto configuration\" section at:"
124+ " ${CONFIG_FILE} \n " )
123125 endif ()
124- endforeach (config_option )
126+ endforeach ()
125127endfunction ()
126128
127129function (check_openthread_version)
0 commit comments