Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 942bc9e

Browse files
author
Jay Logue
authored
Merge pull request #308 from openweave/feature/nrf5-sdk-3.1-support
Updated nRF5 makefiles to support nRF5 SDK 3.1
2 parents c990776 + d52f409 commit 942bc9e

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

build/nrf5/nrf5-app.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ NRF5_SDK_TITLE = nRF5 SDK for Thread and Zigbee
163163

164164
NRF5_SDK_VERSION_SED_EXP = /^${NRF5_SDK_TITLE} v[0-9.]+.*$$/ { s/.*v([0-9.]+).*/\1/; s/[.]/ /g; p; q; }
165165

166-
NRF5_SDK_MIN_VERSION = 3.0.0
166+
NRF5_SDK_MIN_VERSION = 3.1.0
167167

168168

169169
# ==================================================

build/nrf5/nrf5-openthread.mk

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ OPENTHREAD_OUTPUT_DIR = $(OUTPUT_DIR)/openthread
6565

6666
# Directory containing OpenThread libraries.
6767
OPENTHREAD_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))
118118
OPENTHREAD_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

123126
OPENTHREAD_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.
170190
STD_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
172195
STD_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
175201
STD_INC_DIRS += $(if $(filter-out 0, $(USE_PREBUILT_OPENTHREAD)), \
176202
$(STD_INC_DIRS_PREBUILT), \
177203
$(STD_INC_DIRS_BUILT))

build/nrf5/nrf5-openweave.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,24 @@ OPENWEAVE_CPPFLAGS = $(STD_CFLAGS) $(CFLAGS) $(DEBUG_FLAGS) $(OPT_FLAGS) $(DEFIN
7373
OPENWEAVE_CXXFLAGS = $(STD_CXXFLAGS) $(CXXFLAGS)
7474

7575

76+
# ==================================================
77+
# Utility Functions
78+
# ==================================================
79+
80+
QuoteChar = "
81+
82+
DoubleQuoteStr = $(QuoteChar)$(subst $(QuoteChar),\$(QuoteChar),$(subst \,\\,$(1)))$(QuoteChar)
83+
84+
7685
# ==================================================
7786
# OpenWeave configuration options
7887
# ==================================================
7988

8089
OPENWEAVE_CONFIGURE_OPTIONS = \
8190
AR="$(AR)" AS="$(AS)" CC="$(CCACHE) $(CC)" CXX="$(CCACHE) $(CXX)" \
8291
LD="$(LD)" OBJCOPY="$(OBJCOPY)" RANLIB="$(RANLIB)" INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
83-
CPPFLAGS="$(OPENWEAVE_CPPFLAGS)" \
84-
CXXFLAGS="$(OPENWEAVE_CXXFLAGS)" \
92+
CPPFLAGS=$(call DoubleQuoteStr, $(OPENWEAVE_CPPFLAGS)) \
93+
CXXFLAGS=$(call DoubleQuoteStr, $(OPENWEAVE_CXXFLAGS)) \
8594
--prefix=$(OPENWEAVE_OUTPUT_DIR) \
8695
--exec-prefix=$(OPENWEAVE_OUTPUT_DIR) \
8796
--host=$(OPENWEAVE_HOST_ARCH) \

0 commit comments

Comments
 (0)