1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/openthread: bump to 20200818

This commit is contained in:
Alexandre Abadie 2021-10-03 14:42:48 +02:00
parent 770fe2feb7
commit 421508dc64
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
4 changed files with 51 additions and 50 deletions

View File

@ -1,70 +1,70 @@
PKG_NAME=openthread
PKG_URL=https://github.com/openthread/openthread.git
PKG_VERSION=thread-reference-20191113
PKG_VERSION=54b31928cf65803a9cd83c9f97061b64e465aaf7 # thread-reference-20200818
PKG_LICENSE=BSD-3-Clause
# OpenThread build system doesn't support (yet) out-of-source builds
# so clone and build OpenThread within the application build directory
PKG_BUILD_OUT_OF_SOURCE = 0
include $(RIOTBASE)/pkg/pkg.mk
ifneq (,$(filter openthread-ftd,$(USEMODULE)))
TD = ftd
OT_JOINER := OFF
else ifneq (,$(filter openthread-mtd,$(USEMODULE)))
TD = mtd
JOINER_ARG = --enable-joiner
OT_JOINER := ON
else
$(error "Please use either USEMODULE=openthread-ftd or USEMODULE=openthread-mtd")
endif
ifneq (,$(filter openthread-cli,$(USEMODULE)))
CLI_ARG = --enable-cli --enable-$(TD)
OT_MODULES = mbedcrypto mbedtls openthread-$(TD)
ifneq (,$(filter openthread-cli-$(TD),$(USEMODULE)))
OT_MODULES += openthread-cli-$(TD)
OT_APP_CLI ?= ON
endif
OPENTHREAD_ARGS += $(CLI_ARG) $(JOINER_ARG) --enable-application-coap
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"platform_config.h\"'
# Enable CoAP
OT_COAP ?= ON
OPENTHREAD_COMMON_FLAGS = -fdata-sections -ffunction-sections -Os
OPENTHREAD_COMMON_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter
OPENTHREAD_CXXFLAGS += -Wno-class-memaccess
OPENTHREAD_CXXFLAGS += -DOPENTHREAD_TARGET_RIOT=1
OT_C_FLAGS = $(CFLAGS_CPU)
OT_C_FLAGS += -fdata-sections -ffunction-sections -Os
OT_C_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter
OT_CXXFLAGS += -Wno-class-memaccess -DOPENTHREAD_TARGET_RIOT
OT_LIB_DIR = $(PKG_BUILD_DIR)/output/lib
MODULE_LIBS = mbedcrypto.a openthread-$(TD).a
ifneq (,$(filter openthread-cli,$(USEMODULE)))
MODULE_LIBS += openthread-cli.a
endif
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
all: $(addprefix $(BINDIR)/,$(MODULE_LIBS))
@true
all: $(OT_MODULES_ARCHIVES)
@:
$(BINDIR)/openthread-$(TD).a: $(OT_LIB_DIR)/libopenthread-$(TD).a
@cp $< $@
$(BINDIR)/mbedtls.a: $(BINDIR)/openthread-$(TD).a
@cp $(OT_MBEDCRYPTO_LIB_DIR)/libmbedtls.a $@
$(BINDIR)/mbedcrypto.a: $(BINDIR)/openthread-$(TD).a
@cp $(OT_LIB_DIR)/libmbedcrypto.a $@
@cp $(OT_MBEDCRYPTO_LIB_DIR)/libmbedcrypto.a $@
$(BINDIR)/openthread-cli.a: $(BINDIR)/openthread-$(TD).a
@cp $(OT_LIB_DIR)/libopenthread-cli-$(TD).a $@
$(BINDIR)/openthread-cli-$(TD).a: $(BINDIR)/openthread-$(TD).a
@cp $(OT_CLI_LIB_DIR)/libopenthread-cli-$(TD).a $@
$(OT_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile
$(MAKE) -C $(PKG_BUILD_DIR) --no-print-directory install DESTDIR=$(PKG_BUILD_DIR)/output PREFIX=/
$(Q)printf "OpenThread built for %s device\n" $(TD)
$(BINDIR)/openthread-$(TD).a: $(OT_CORE_LIB_DIR)/libopenthread-$(TD).a
@cp $< $@
$(PKG_BUILD_DIR)/Makefile: $(PKG_BUILD_DIR)/configure
$(Q)cd $(PKG_BUILD_DIR) && CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)"\
OBJC="" OBJCXX="" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" \
STRIP="$(STRIP)" \
CPPFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) -D$(CONFIG_FILE)" \
CFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) " \
CXXFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(OPENTHREAD_CXXFLAGS) \
$(CFLAGS_CPU) -fno-exceptions -fno-rtti " \
LDFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) -nostartfiles -specs=nano.specs \
-specs=nosys.specs -Wl,--gc-sections -Wl,-Map=map.map " \
./configure --disable-docs --host=$(TARGET_ARCH) --target=$(TARGET_ARCH) \
--prefix=/ --enable-default-logging $(OPENTHREAD_ARGS)
$(OT_CORE_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile
$(QQ)"$(MAKE)" -C $(PKG_BUILD_DIR) $(OT_MODULES)
$(PKG_BUILD_DIR)/configure: $(PKG_PREPARED)
$(Q)printf "OPENTHREAD_ARGS is [$(OPENTHREAD_ARGS)]\n"
$(Q)cd $(PKG_BUILD_DIR) && PREFIX="/" ./bootstrap
$(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)

View File

@ -1,7 +1,7 @@
OPENTHREAD_DIR = $(RIOTBASE)/pkg/openthread
INCLUDES += -I$(OPENTHREAD_DIR)/include \
-I$(BINDIR)/pkg/openthread/include
INCLUDES += -I$(PKGDIRBASE)/openthread/include
INCLUDES += -I$(OPENTHREAD_DIR)/include
ifneq (,$(filter openthread_contrib,$(USEMODULE)))
DIRS += $(OPENTHREAD_DIR)/contrib
@ -16,3 +16,4 @@ endif
ARCHIVES += $(addprefix $(BINDIR)/,$(addsuffix .a,$(filter openthread-%,$(USEMODULE))))
ARCHIVES += $(BINDIR)/mbedcrypto.a
ARCHIVES += $(BINDIR)/mbedtls.a

View File

@ -94,10 +94,7 @@ static void *_openthread_event_loop(void *arg)
/* init OpenThread */
sInstance = otInstanceInitSingle();
/* enable OpenThread UART */
otPlatUartEnable();
#if defined(MODULE_OPENTHREAD_CLI)
#if defined(MODULE_OPENTHREAD_CLI_FTD) || defined(MODULE_OPENTHREAD_CLI_MTD)
otCliUartInit(sInstance);
/* Init default parameters */
otPanId panid = OPENTHREAD_PANID;
@ -108,6 +105,9 @@ static void *_openthread_event_loop(void *arg)
otIp6SetEnabled(sInstance, true);
/* Start Thread protocol operation */
otThreadSetEnabled(sInstance, true);
#else
/* enable OpenThread UART */
otPlatUartEnable();
#endif
#if OPENTHREAD_ENABLE_DIAG