@@ -65,7 +65,7 @@ OPENTHREAD_OUTPUT_DIR = $(OUTPUT_DIR)/openthread
6565
6666# Directory containing OpenThread libraries.
6767OPENTHREAD_LIB_DIR = $(if $(filter-out 0, $(USE_PREBUILT_OPENTHREAD ) ) , \
68- $(NRF5_SDK_ROOT ) /external/openthread/lib/gcc, \
68+ $(NRF5_SDK_ROOT ) /external/openthread/lib/$( OPENTHREAD_TARGET ) / gcc/mtls_ts , \
6969 $(OPENTHREAD_OUTPUT_DIR ) /lib)
7070
7171# Prerequisite target for anything that depends on the output of the OpenThread
@@ -118,15 +118,29 @@ OPENTHREAD_INC_FLAGS = $(foreach dir,$(OPENTHREAD_INC_DIRS),-I$(dir))
118118OPENTHREAD_DEFINES = \
119119 NRF52840_XXAA \
120120 DISABLE_CC310=1 \
121- OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"$(OPENTHREAD_PROJECT_CONFIG ) \"'
121+ MBEDTLS_THREADING=1 \
122+ MBEDTLS_CONFIG_FILE='"mbedtls-config.h"' \
123+ MBEDTLS_USER_CONFIG_FILE='"nrf52840-mbedtls-config.h"' \
124+ OPENTHREAD_PROJECT_CORE_CONFIG_FILE='"$(OPENTHREAD_PROJECT_CONFIG ) "'
122125
123126OPENTHREAD_INC_DIRS = \
124127 $(PROJECT_ROOT ) \
125128 $(OPENTHREAD_ROOT ) /examples/platforms \
126129 $(OPENTHREAD_ROOT ) /examples/platforms/$(OPENTHREAD_TARGET ) \
130+ $(OPENTHREAD_ROOT ) /third_party/NordicSemiconductor/libraries/crypto \
131+ $(OPENTHREAD_ROOT ) /third_party/NordicSemiconductor/libraries/nrf_cc310/include \
127132 $(NRF5_SDK_ROOT ) /modules/nrfx/mdk
128133
129134
135+ # ==================================================
136+ # Utility Functions
137+ # ==================================================
138+
139+ QuoteChar = "
140+
141+ DoubleQuoteStr = $(QuoteChar )$(subst $(QuoteChar ) ,\$(QuoteChar ) ,$(subst \,\\,$(1 ) ) )$(QuoteChar )
142+
143+
130144# ==================================================
131145# OpenThread configuration options
132146# ==================================================
@@ -136,8 +150,8 @@ OPENTHREAD_CONFIGURE_OPTIONS = \
136150 CCAS="$(CCACHE ) $(CC ) " AS="${AS}" AR="$(AR ) " RANLIB="$(RANLIB ) " \
137151 NM="$(NM ) " STRIP="$(STRIP ) " OBJDUMP="$(OBJCOPY ) " OBJCOPY="$(OBJCOPY ) " \
138152 SIZE="$(SIZE ) " RANLIB="$(RANLIB ) " INSTALL="$(INSTALL ) $(INSTALLFLAGS ) -m644" \
139- CPPFLAGS=" $( OPENTHREAD_CPPFLAGS )" \
140- CXXFLAGS=" $( OPENTHREAD_CXXFLAGS )" \
153+ CPPFLAGS=$( call DoubleQuoteStr, $( OPENTHREAD_CPPFLAGS )) \
154+ CXXFLAGS=$( call DoubleQuoteStr, $( OPENTHREAD_CXXFLAGS )) \
141155 LDFLAGS="" \
142156 --prefix=$(OPENTHREAD_OUTPUT_DIR ) \
143157 --exec-prefix=$(OPENTHREAD_OUTPUT_DIR ) \
@@ -165,13 +179,25 @@ endif
165179# incorporate OpenThread into the application.
166180# ==================================================
167181
182+ STD_DEFINES += \
183+ DISABLE_CC310=1 \
184+ MBEDTLS_THREADING=1 \
185+ MBEDTLS_CONFIG_FILE='"mbedtls-config.h"' \
186+ MBEDTLS_USER_CONFIG_FILE='"nrf52840-mbedtls-config.h"'
187+
168188# Add the appropriate path to the public OpenThread headers to the application's
169189# compile actions.
170190STD_INC_DIRS_PREBUILT = \
171- $(NRF5_SDK_ROOT ) /external/openthread/include
191+ $(NRF5_SDK_ROOT ) /external/openthread/include \
192+ $(NRF5_SDK_ROOT ) /external/openthread/project/$(OPENTHREAD_TARGET ) \
193+ $(NRF5_SDK_ROOT ) /external/openthread/include/openthread/platform/mbedtls
194+ # $(NRF5_SDK_ROOT)/external/nrf_cc310/include
172195STD_INC_DIRS_BUILT = \
173196 $(OPENTHREAD_OUTPUT_DIR ) /include \
174- $(OPENTHREAD_ROOT ) /third_party/mbedtls/repo/include
197+ $(OPENTHREAD_ROOT ) /third_party/mbedtls \
198+ $(OPENTHREAD_ROOT ) /third_party/mbedtls/repo/include \
199+ $(OPENTHREAD_ROOT ) /third_party/NordicSemiconductor/libraries/crypto
200+ # $(OPENTHREAD_ROOT)/third_party/NordicSemiconductor/libraries/nrf_cc310/include
175201STD_INC_DIRS += $(if $(filter-out 0, $(USE_PREBUILT_OPENTHREAD ) ) , \
176202 $(STD_INC_DIRS_PREBUILT ) , \
177203 $(STD_INC_DIRS_BUILT ) )
0 commit comments