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:
parent
770fe2feb7
commit
421508dc64
@ -1,70 +1,70 @@
|
|||||||
PKG_NAME=openthread
|
PKG_NAME=openthread
|
||||||
PKG_URL=https://github.com/openthread/openthread.git
|
PKG_URL=https://github.com/openthread/openthread.git
|
||||||
PKG_VERSION=thread-reference-20191113
|
PKG_VERSION=54b31928cf65803a9cd83c9f97061b64e465aaf7 # thread-reference-20200818
|
||||||
PKG_LICENSE=BSD-3-Clause
|
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
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
|
|
||||||
ifneq (,$(filter openthread-ftd,$(USEMODULE)))
|
ifneq (,$(filter openthread-ftd,$(USEMODULE)))
|
||||||
TD = ftd
|
TD = ftd
|
||||||
|
OT_JOINER := OFF
|
||||||
else ifneq (,$(filter openthread-mtd,$(USEMODULE)))
|
else ifneq (,$(filter openthread-mtd,$(USEMODULE)))
|
||||||
TD = mtd
|
TD = mtd
|
||||||
JOINER_ARG = --enable-joiner
|
OT_JOINER := ON
|
||||||
else
|
else
|
||||||
$(error "Please use either USEMODULE=openthread-ftd or USEMODULE=openthread-mtd")
|
$(error "Please use either USEMODULE=openthread-ftd or USEMODULE=openthread-mtd")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter openthread-cli,$(USEMODULE)))
|
OT_MODULES = mbedcrypto mbedtls openthread-$(TD)
|
||||||
CLI_ARG = --enable-cli --enable-$(TD)
|
ifneq (,$(filter openthread-cli-$(TD),$(USEMODULE)))
|
||||||
|
OT_MODULES += openthread-cli-$(TD)
|
||||||
|
OT_APP_CLI ?= ON
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OPENTHREAD_ARGS += $(CLI_ARG) $(JOINER_ARG) --enable-application-coap
|
# Enable CoAP
|
||||||
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"platform_config.h\"'
|
OT_COAP ?= ON
|
||||||
|
|
||||||
OPENTHREAD_COMMON_FLAGS = -fdata-sections -ffunction-sections -Os
|
OT_C_FLAGS = $(CFLAGS_CPU)
|
||||||
OPENTHREAD_COMMON_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter
|
OT_C_FLAGS += -fdata-sections -ffunction-sections -Os
|
||||||
OPENTHREAD_CXXFLAGS += -Wno-class-memaccess
|
OT_C_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter
|
||||||
OPENTHREAD_CXXFLAGS += -DOPENTHREAD_TARGET_RIOT=1
|
OT_CXXFLAGS += -Wno-class-memaccess -DOPENTHREAD_TARGET_RIOT
|
||||||
|
|
||||||
OT_LIB_DIR = $(PKG_BUILD_DIR)/output/lib
|
OT_MODULES_ARCHIVES = $(addsuffix .a,$(addprefix $(BINDIR)/,$(OT_MODULES)))
|
||||||
MODULE_LIBS = mbedcrypto.a openthread-$(TD).a
|
OT_CORE_LIB_DIR = $(PKG_BUILD_DIR)/src/core
|
||||||
ifneq (,$(filter openthread-cli,$(USEMODULE)))
|
OT_CLI_LIB_DIR = $(PKG_BUILD_DIR)/src/cli
|
||||||
MODULE_LIBS += openthread-cli.a
|
OT_MBEDCRYPTO_LIB_DIR = $(PKG_BUILD_DIR)/third_party/mbedtls/repo/library
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(addprefix $(BINDIR)/,$(MODULE_LIBS))
|
all: $(OT_MODULES_ARCHIVES)
|
||||||
@true
|
@:
|
||||||
|
|
||||||
$(BINDIR)/openthread-$(TD).a: $(OT_LIB_DIR)/libopenthread-$(TD).a
|
$(BINDIR)/mbedtls.a: $(BINDIR)/openthread-$(TD).a
|
||||||
@cp $< $@
|
@cp $(OT_MBEDCRYPTO_LIB_DIR)/libmbedtls.a $@
|
||||||
|
|
||||||
$(BINDIR)/mbedcrypto.a: $(BINDIR)/openthread-$(TD).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
|
$(BINDIR)/openthread-cli-$(TD).a: $(BINDIR)/openthread-$(TD).a
|
||||||
@cp $(OT_LIB_DIR)/libopenthread-cli-$(TD).a $@
|
@cp $(OT_CLI_LIB_DIR)/libopenthread-cli-$(TD).a $@
|
||||||
|
|
||||||
$(OT_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile
|
$(BINDIR)/openthread-$(TD).a: $(OT_CORE_LIB_DIR)/libopenthread-$(TD).a
|
||||||
$(MAKE) -C $(PKG_BUILD_DIR) --no-print-directory install DESTDIR=$(PKG_BUILD_DIR)/output PREFIX=/
|
@cp $< $@
|
||||||
$(Q)printf "OpenThread built for %s device\n" $(TD)
|
|
||||||
|
|
||||||
$(PKG_BUILD_DIR)/Makefile: $(PKG_BUILD_DIR)/configure
|
$(OT_CORE_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile
|
||||||
$(Q)cd $(PKG_BUILD_DIR) && CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)"\
|
$(QQ)"$(MAKE)" -C $(PKG_BUILD_DIR) $(OT_MODULES)
|
||||||
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)
|
|
||||||
|
|
||||||
$(PKG_BUILD_DIR)/configure: $(PKG_PREPARED)
|
$(PKG_BUILD_DIR)/Makefile:
|
||||||
$(Q)printf "OPENTHREAD_ARGS is [$(OPENTHREAD_ARGS)]\n"
|
cmake -Wno-dev -B$(PKG_BUILD_DIR) -H$(PKG_SOURCE_DIR) \
|
||||||
$(Q)cd $(PKG_BUILD_DIR) && PREFIX="/" ./bootstrap
|
-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)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
OPENTHREAD_DIR = $(RIOTBASE)/pkg/openthread
|
OPENTHREAD_DIR = $(RIOTBASE)/pkg/openthread
|
||||||
|
|
||||||
INCLUDES += -I$(OPENTHREAD_DIR)/include \
|
INCLUDES += -I$(PKGDIRBASE)/openthread/include
|
||||||
-I$(BINDIR)/pkg/openthread/include
|
INCLUDES += -I$(OPENTHREAD_DIR)/include
|
||||||
|
|
||||||
ifneq (,$(filter openthread_contrib,$(USEMODULE)))
|
ifneq (,$(filter openthread_contrib,$(USEMODULE)))
|
||||||
DIRS += $(OPENTHREAD_DIR)/contrib
|
DIRS += $(OPENTHREAD_DIR)/contrib
|
||||||
@ -16,3 +16,4 @@ endif
|
|||||||
|
|
||||||
ARCHIVES += $(addprefix $(BINDIR)/,$(addsuffix .a,$(filter openthread-%,$(USEMODULE))))
|
ARCHIVES += $(addprefix $(BINDIR)/,$(addsuffix .a,$(filter openthread-%,$(USEMODULE))))
|
||||||
ARCHIVES += $(BINDIR)/mbedcrypto.a
|
ARCHIVES += $(BINDIR)/mbedcrypto.a
|
||||||
|
ARCHIVES += $(BINDIR)/mbedtls.a
|
||||||
|
@ -94,10 +94,7 @@ static void *_openthread_event_loop(void *arg)
|
|||||||
/* init OpenThread */
|
/* init OpenThread */
|
||||||
sInstance = otInstanceInitSingle();
|
sInstance = otInstanceInitSingle();
|
||||||
|
|
||||||
/* enable OpenThread UART */
|
#if defined(MODULE_OPENTHREAD_CLI_FTD) || defined(MODULE_OPENTHREAD_CLI_MTD)
|
||||||
otPlatUartEnable();
|
|
||||||
|
|
||||||
#if defined(MODULE_OPENTHREAD_CLI)
|
|
||||||
otCliUartInit(sInstance);
|
otCliUartInit(sInstance);
|
||||||
/* Init default parameters */
|
/* Init default parameters */
|
||||||
otPanId panid = OPENTHREAD_PANID;
|
otPanId panid = OPENTHREAD_PANID;
|
||||||
@ -108,6 +105,9 @@ static void *_openthread_event_loop(void *arg)
|
|||||||
otIp6SetEnabled(sInstance, true);
|
otIp6SetEnabled(sInstance, true);
|
||||||
/* Start Thread protocol operation */
|
/* Start Thread protocol operation */
|
||||||
otThreadSetEnabled(sInstance, true);
|
otThreadSetEnabled(sInstance, true);
|
||||||
|
#else
|
||||||
|
/* enable OpenThread UART */
|
||||||
|
otPlatUartEnable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OPENTHREAD_ENABLE_DIAG
|
#if OPENTHREAD_ENABLE_DIAG
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user