2017-05-19 01:02:19 +02:00
|
|
|
PKG_NAME=openthread
|
|
|
|
PKG_URL=https://github.com/openthread/openthread.git
|
2022-08-21 18:22:49 +02:00
|
|
|
# thread-reference-20200818
|
|
|
|
PKG_VERSION=54b31928cf65803a9cd83c9f97061b64e465aaf7
|
2019-10-04 13:50:44 +02:00
|
|
|
PKG_LICENSE=BSD-3-Clause
|
2017-05-19 01:02:19 +02:00
|
|
|
|
2019-10-02 12:47:02 +02:00
|
|
|
include $(RIOTBASE)/pkg/pkg.mk
|
|
|
|
|
2019-05-08 14:44:38 +02:00
|
|
|
ifneq (,$(filter openthread-ftd,$(USEMODULE)))
|
|
|
|
TD = ftd
|
2021-10-03 14:42:48 +02:00
|
|
|
OT_JOINER := OFF
|
2019-05-08 14:44:38 +02:00
|
|
|
else ifneq (,$(filter openthread-mtd,$(USEMODULE)))
|
|
|
|
TD = mtd
|
2021-10-03 14:42:48 +02:00
|
|
|
OT_JOINER := ON
|
2019-05-08 14:44:38 +02:00
|
|
|
else
|
|
|
|
$(error "Please use either USEMODULE=openthread-ftd or USEMODULE=openthread-mtd")
|
|
|
|
endif
|
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
OT_MODULES = mbedcrypto mbedtls openthread-$(TD)
|
|
|
|
ifneq (,$(filter openthread-cli-$(TD),$(USEMODULE)))
|
|
|
|
OT_MODULES += openthread-cli-$(TD)
|
|
|
|
OT_APP_CLI ?= ON
|
2018-06-12 17:40:27 +02:00
|
|
|
endif
|
2019-05-08 14:44:38 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
# Enable CoAP
|
|
|
|
OT_COAP ?= ON
|
2017-05-19 01:02:19 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
OT_C_FLAGS = $(CFLAGS_CPU)
|
2023-05-20 19:53:38 +02:00
|
|
|
OT_C_FLAGS += -fdata-sections
|
|
|
|
OT_C_FLAGS += -ffunction-sections -Os
|
|
|
|
OT_C_FLAGS += -ffunction-sections
|
|
|
|
OT_C_FLAGS += -fshort-enums
|
|
|
|
OT_C_FLAGS += -Wno-implicit-fallthrough
|
|
|
|
OT_C_FLAGS += -Wno-unused-parameter
|
|
|
|
OT_CXXFLAGS += -Wno-class-memaccess
|
|
|
|
OT_CXXFLAGS += -DOPENTHREAD_TARGET_RIOT
|
2018-02-22 09:14:25 +01:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
OT_MODULES_ARCHIVES = $(addsuffix .a,$(addprefix $(BINDIR)/,$(OT_MODULES)))
|
|
|
|
OT_CORE_LIB_DIR = $(PKG_BUILD_DIR)/src/core
|
|
|
|
OT_CLI_LIB_DIR = $(PKG_BUILD_DIR)/src/cli
|
|
|
|
OT_MBEDCRYPTO_LIB_DIR = $(PKG_BUILD_DIR)/third_party/mbedtls/repo/library
|
2020-06-13 22:33:33 +02:00
|
|
|
|
2023-05-20 19:53:38 +02:00
|
|
|
ifeq (llvm,$(TOOLCHAIN))
|
|
|
|
OT_C_FLAGS += -target $(TARGET_ARCH_LLVM)
|
|
|
|
OT_C_FLAGS += $(GCC_C_INCLUDES)
|
|
|
|
OT_CXXFLAGS += $(GCC_CXX_INCLUDES)
|
|
|
|
endif
|
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
all: $(OT_MODULES_ARCHIVES)
|
|
|
|
@:
|
2020-06-13 22:33:33 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
$(BINDIR)/mbedtls.a: $(BINDIR)/openthread-$(TD).a
|
|
|
|
@cp $(OT_MBEDCRYPTO_LIB_DIR)/libmbedtls.a $@
|
2020-06-13 22:33:33 +02:00
|
|
|
|
|
|
|
$(BINDIR)/mbedcrypto.a: $(BINDIR)/openthread-$(TD).a
|
2021-10-03 14:42:48 +02:00
|
|
|
@cp $(OT_MBEDCRYPTO_LIB_DIR)/libmbedcrypto.a $@
|
2020-06-13 22:33:33 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
$(BINDIR)/openthread-cli-$(TD).a: $(BINDIR)/openthread-$(TD).a
|
|
|
|
@cp $(OT_CLI_LIB_DIR)/libopenthread-cli-$(TD).a $@
|
2020-06-13 22:33:33 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
$(BINDIR)/openthread-$(TD).a: $(OT_CORE_LIB_DIR)/libopenthread-$(TD).a
|
|
|
|
@cp $< $@
|
2020-06-13 22:33:33 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
$(OT_CORE_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile
|
|
|
|
$(QQ)"$(MAKE)" -C $(PKG_BUILD_DIR) $(OT_MODULES)
|
2019-05-08 14:44:38 +02:00
|
|
|
|
2021-10-03 14:42:48 +02:00
|
|
|
$(PKG_BUILD_DIR)/Makefile:
|
|
|
|
cmake -Wno-dev -B$(PKG_BUILD_DIR) -H$(PKG_SOURCE_DIR) \
|
|
|
|
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
|
|
|
|
-DCMAKE_C_COMPILER="$(CC)" \
|
|
|
|
-DCMAKE_C_COMPILER_AR="$(AR)" \
|
|
|
|
-DCMAKE_C_COMPILER_RANLIB="$(RANLIB)" \
|
|
|
|
-DCMAKE_C_FLAGS="$(OT_C_FLAGS)" \
|
|
|
|
-DCMAKE_CXX_COMPILER="$(CXX)" \
|
|
|
|
-DCMAKE_CXX_FLAGS="$(OT_C_FLAGS) $(OT_CXXFLAGS) -fno-exceptions -fno-rtti" \
|
|
|
|
-DCMAKE_NM="$(NM)" \
|
|
|
|
-DCMAKE_STRIP="$(STRIP)" \
|
|
|
|
-DOT_PLATFORM=NO \
|
|
|
|
-DOT_CONFIG="$(RIOTBASE)/pkg/openthread/include/platform_config.h" \
|
|
|
|
-DOT_APP_CLI=$(OT_APP_CLI) \
|
|
|
|
-DOT_JOINER=$(OT_JOINER) \
|
|
|
|
-DOT_COAP=$(OT_COAP)
|