Skip to content

Commit 42f81cd

Browse files
committed
[nrf5] use prebuilt mbedtls
This commit change the lock-app to use prebuilt mbedtls for OpenThread.
1 parent 079c236 commit 42f81cd

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

config/nrf5/nrf5-chip.mk

+3-4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ CHIP_CONFIGURE_OPTIONS = \
114114
--disable-docs \
115115
--disable-java \
116116
--disable-device-manager \
117+
--with-mbedtls=$(NRF5_SDK_ROOT)/external/openthread/nrf_security \
117118
--with-crypto=mbedtls
118119

119120
# Enable / disable optimization.
@@ -148,8 +149,7 @@ STD_LIBS += \
148149
-lCHIP \
149150
-lInetLayer \
150151
-lSystemLayer \
151-
-llwip \
152-
-lmbedtls
152+
-llwip
153153

154154
# Add the appropriate CHIP target as a prerequisite to all application
155155
# compilation targets to ensure that CHIP gets built and its header
@@ -162,8 +162,7 @@ STD_LINK_PREREQUISITES += \
162162
$(CHIP_OUTPUT_DIR)/lib/libCHIP.a \
163163
$(CHIP_OUTPUT_DIR)/lib/libInetLayer.a \
164164
$(CHIP_OUTPUT_DIR)/lib/libSystemLayer.a \
165-
$(CHIP_OUTPUT_DIR)/lib/liblwip.a \
166-
$(CHIP_OUTPUT_DIR)/lib/libmbedtls.a
165+
$(CHIP_OUTPUT_DIR)/lib/liblwip.a
167166

168167

169168
# ==================================================

configure.ac

+9-2
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,15 @@ if test "${with_crypto}" = "mbedtls"; then
15191519
[],
15201520
[
15211521
AC_MSG_ERROR(The mbedTLS header "$ac_header" is required but cannot be found.)
1522-
]
1523-
)
1522+
],
1523+
[
1524+
// Undefine MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE to prevent
1525+
// including these files at configure stage. This is necessary because
1526+
// CPPFLAGS is shell expanded during configure stage, which is not
1527+
// compatible with the expansion of make.
1528+
#undef MBEDTLS_CONFIG_FILE
1529+
#undef MBEDTLS_USER_CONFIG_FILE
1530+
])
15241531
]
15251532
)
15261533
fi

examples/lock-app/nrf5/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,18 @@ INC_DIRS = \
142142
$(NRF5_SDK_ROOT)/components/softdevice/mbr/nrf52840/headers \
143143
$(NRF5_SDK_ROOT)/components/thread/freertos_mbedtls_mutex \
144144
$(NRF5_SDK_ROOT)/components/toolchain/cmsis/include \
145+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/config \
146+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/mbedtls_plat_config \
147+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/nrf_cc310_plat/include \
148+
$(NRF5_SDK_ROOT)/external/openthread/project/config \
149+
$(NRF5_SDK_ROOT)/external/openthread/project/nrf52840 \
145150
$(NRF5_SDK_ROOT)/config/nrf52840/config \
146151
$(NRF5_SDK_ROOT)/external/fprintf \
147152
$(NRF5_SDK_ROOT)/external/freertos/config \
148153
$(NRF5_SDK_ROOT)/external/freertos/portable/CMSIS/nrf52 \
149154
$(NRF5_SDK_ROOT)/external/freertos/portable/GCC/nrf52 \
150155
$(NRF5_SDK_ROOT)/external/freertos/source/include \
156+
$(NRF5_SDK_ROOT)/external/openthread/include \
151157
$(NRF5_SDK_ROOT)/external/segger_rtt \
152158
$(NRF5_SDK_ROOT)/integration/nrfx \
153159
$(NRF5_SDK_ROOT)/integration/nrfx/legacy \
@@ -162,13 +168,27 @@ DEFINES = \
162168
BSP_DEFINES_ONLY \
163169
CONFIG_GPIO_AS_PINRESET \
164170
FLOAT_ABI_HARD \
171+
MBEDTLS_CONFIG_FILE=\"nrf-config.h\" \
172+
MBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\" \
173+
OPENTHREAD_CONFIG_FILE=\"openthread-config-wrap.h\" \
165174
USE_APP_CONFIG \
166175
__HEAP_SIZE=40960 \
167176
__STACK_SIZE=8192 \
168177
SOFTDEVICE_PRESENT \
169178
PRINTF_DISABLE_SUPPORT_EXPONENTIAL \
170179
S140
171180

181+
LIBS = \
182+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedcrypto_glue.a \
183+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedcrypto_glue_cc310.a \
184+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedcrypto_glue_vanilla.a \
185+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedcrypto_cc310_backend.a \
186+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedcrypto_vanilla_backend.a \
187+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedtls_base_vanilla.a \
188+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedtls_tls_vanilla.a \
189+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libmbedtls_x509_vanilla.a \
190+
$(NRF5_SDK_ROOT)/external/openthread/nrf_security/lib/libnrf_cc310_platform_0.9.1.a \
191+
172192
CFLAGS = \
173193
--specs=nano.specs
174194

0 commit comments

Comments
 (0)