diff --git a/.travis/script.sh b/.travis/script.sh index e81f1e014..20dbe57e0 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -400,21 +400,21 @@ build_samr21() { export ASAN_OPTIONS=symbolize=1 || die export DISTCHECK_CONFIGURE_FLAGS= CPPFLAGS=-DOPENTHREAD_POSIX_VIRTUAL_TIME=1 || die ./bootstrap || die - CERT_LOG=1 make -f examples/Makefile-posix distcheck || die + REFERENCE_DEVICE=1 make -f examples/Makefile-posix distcheck || die } [ $BUILD_TARGET != posix-32-bit ] || { ./bootstrap || die - CERT_LOG=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-posix check || die + REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-posix check || die } [ $BUILD_TARGET != posix-app-cli ] || { ./bootstrap || die # enable code coverage for OpenThread transceiver only - CERT_LOG=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die + REFERENCE_DEVICE=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die # readline supports pipe, editline does not - CERT_LOG=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die - CERT_LOG=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check || die + REFERENCE_DEVICE=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die + REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" make -f src/posix/Makefile-posix check || die } [ $BUILD_TARGET != posix-app-pty ] || { @@ -424,7 +424,7 @@ build_samr21() { [ $BUILD_TARGET != posix-mtd ] || { ./bootstrap || die - CERT_LOG=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-posix check || die + REFERENCE_DEVICE=1 COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-posix check || die } [ $BUILD_TARGET != posix-ncp-spi ] || { @@ -434,15 +434,15 @@ build_samr21() { [ $BUILD_TARGET != posix-app-ncp ] || { ./bootstrap || die - CERT_LOG=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die + REFERENCE_DEVICE=1 COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die # enable code coverage for OpenThread posix radio - CERT_LOG=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die - CERT_LOG=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" NODE_TYPE=ncp-sim make -f src/posix/Makefile-posix check || die + REFERENCE_DEVICE=1 COVERAGE=1 READLINE=readline make -f src/posix/Makefile-posix || die + REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-rcp)" NODE_TYPE=ncp-sim make -f src/posix/Makefile-posix check || die } [ $BUILD_TARGET != posix-ncp ] || { ./bootstrap || die - CERT_LOG=1 COVERAGE=1 PYTHONUNBUFFERED=1 NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die + REFERENCE_DEVICE=1 COVERAGE=1 PYTHONUNBUFFERED=1 NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die } [ $BUILD_TARGET != toranj-test-framework ] || { diff --git a/Android.mk b/Android.mk index 9fbfbdeba..52e025c41 100644 --- a/Android.mk +++ b/Android.mk @@ -54,12 +54,12 @@ endif ifeq ($(TARGET_PRODUCT),generic) OPENTHREAD_COMMON_FLAGS += \ -DOPENTHREAD_ENABLE_APPLICATION_COAP=1 \ - -DOPENTHREAD_ENABLE_CERT_LOG=1 \ -DOPENTHREAD_ENABLE_COMMISSIONER=1 \ -DOPENTHREAD_ENABLE_DHCP6_CLIENT=1 \ -DOPENTHREAD_ENABLE_DHCP6_SERVER=1 \ -DOPENTHREAD_ENABLE_DNS_CLIENT=1 \ -DOPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC=1 \ + -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=0 \ $(NULL) endif diff --git a/configure.ac b/configure.ac index 21957ed80..4c5f57634 100644 --- a/configure.ac +++ b/configure.ac @@ -1341,36 +1341,6 @@ AC_SUBST(OPENTHREAD_ENABLE_CHILD_SUPERVISION) AM_CONDITIONAL([OPENTHREAD_ENABLE_CHILD_SUPERVISION], [test "${enable_child_supervision}" = "yes"]) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_CHILD_SUPERVISION],[${OPENTHREAD_ENABLE_CHILD_SUPERVISION}],[Define to 1 if you want to use child supervision feature]) -# -# Log for certification test -# - -AC_ARG_ENABLE(cert_log, - [AS_HELP_STRING([--enable-cert-log],[Enable certification log support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_cert_log=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_cert_log} for --enable-cert-log]) - ;; - esac - ], - [enable_cert_log=no]) - -if test "$enable_cert_log" = "yes"; then - OPENTHREAD_ENABLE_CERT_LOG=1 -else - OPENTHREAD_ENABLE_CERT_LOG=0 -fi - -AC_SUBST(OPENTHREAD_ENABLE_CERT_LOG) -AM_CONDITIONAL([OPENTHREAD_ENABLE_CERT_LOG], [test "${enable_cert_log}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_CERT_LOG],[${OPENTHREAD_ENABLE_CERT_LOG}],[Define to 1 if you want to enable log for certification test]) - # # DHCPv6 Client # @@ -2090,7 +2060,6 @@ AC_MSG_NOTICE([ OpenThread Diagnostics support : ${enable_diag} OpenThread Child Supervision support : ${enable_child_supervision} OpenThread Legacy network support : ${enable_legacy} - OpenThread Certification log support : ${enable_cert_log} OpenThread DHCPv6 Server support : ${enable_dhcp6_server} OpenThread DHCPv6 Client support : ${enable_dhcp6_client} OpenThread DNS Client support : ${enable_dns_client} diff --git a/examples/Makefile-nrf52811 b/examples/Makefile-nrf52811 index 33dd30945..493caab1f 100644 --- a/examples/Makefile-nrf52811 +++ b/examples/Makefile-nrf52811 @@ -86,7 +86,7 @@ ifeq ($(DCDC),1) COMMONCFLAGS += -DDCDC_ENABLE endif -ifneq ($(CERT_LOG),1) +ifneq ($(REFERENCE_DEVICE),1) COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED endif diff --git a/examples/Makefile-nrf52840 b/examples/Makefile-nrf52840 index e1f83e56a..efdd894a5 100644 --- a/examples/Makefile-nrf52840 +++ b/examples/Makefile-nrf52840 @@ -86,7 +86,7 @@ COMMONCFLAGS := \ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk -ifneq ($(CERT_LOG),1) +ifneq ($(REFERENCE_DEVICE),1) COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED endif diff --git a/examples/Makefile-posix b/examples/Makefile-posix index 7a083e5b3..e00ba72ea 100644 --- a/examples/Makefile-posix +++ b/examples/Makefile-posix @@ -37,7 +37,6 @@ DEBUG ?= 0 BORDER_AGENT ?= 1 BORDER_ROUTER ?= 1 -CERT_LOG ?= 1 COAP ?= 1 COAPS ?= 1 COMMISSIONER ?= 1 @@ -55,6 +54,7 @@ LEGACY ?= 1 LINK_RAW ?= 1 MAC_FILTER ?= 1 MTD_NETDIAG ?= 1 +REFERENCE_DEVICE ?= 1 SERVICE ?= 1 SNTP_CLIENT ?= 1 UDP_FORWARD ?= 1 diff --git a/examples/common-switches.mk b/examples/common-switches.mk index 5d4d68e2b..fc91b8d88 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -30,7 +30,6 @@ BORDER_AGENT ?= 0 BORDER_ROUTER ?= 0 -CERT_LOG ?= 0 COAP ?= 0 COAPS ?= 0 COMMISSIONER ?= 0 @@ -52,6 +51,7 @@ LINK_RAW ?= 0 MAC_FILTER ?= 0 MTD_NETDIAG ?= 0 PLATFORM_UDP ?= 0 +REFERENCE_DEVICE ?= 0 SERVICE ?= 0 SETTINGS_RAM ?= 0 # SLAAC is enabled by default @@ -69,11 +69,6 @@ ifeq ($(BORDER_ROUTER),1) configure_OPTIONS += --enable-border-router endif -ifeq ($(CERT_LOG),1) -COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_APP -configure_OPTIONS += --enable-cert-log -endif - ifeq ($(COAP),1) configure_OPTIONS += --enable-application-coap endif @@ -158,6 +153,12 @@ ifeq ($(PLATFORM_UDP),1) configure_OPTIONS += --enable-platform-udp endif +# Enable features only required for reference device during certification. +ifeq ($(REFERENCE_DEVICE),1) +COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_APP +COMMONCFLAGS += -DOPENTHREAD_ENABLE_REFERENCE_DEVICE=1 +endif + ifeq ($(SERVICE),1) configure_OPTIONS += --enable-service endif diff --git a/examples/platforms/gp712/README.md b/examples/platforms/gp712/README.md index 48fe3bfd4..67edc4e3c 100644 --- a/examples/platforms/gp712/README.md +++ b/examples/platforms/gp712/README.md @@ -20,7 +20,7 @@ The build process will complain if additional packages are required. $ cd $ ./script/bootstrap $ ./bootstrap -$ CERT_LOG=1 CLI_LOGGING=1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BORDER_ROUTER=1 make -f examples/Makefile-gp712 +$ REFERENCE_DEVICE=1 CLI_LOGGING=1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BORDER_ROUTER=1 make -f examples/Makefile-gp712 ``` After a successful build, the `elf` files are found in diff --git a/src/core/common/logging.hpp b/src/core/common/logging.hpp index 7df820bcd..3b815922d 100644 --- a/src/core/common/logging.hpp +++ b/src/core/common/logging.hpp @@ -1020,7 +1020,7 @@ extern "C" { * * */ -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE #define otLogCertMeshCoP(aFormat, ...) \ _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aFormat, ##__VA_ARGS__) #else @@ -1858,7 +1858,7 @@ extern "C" { * @param[in] aLength Number of bytes to print. * */ -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE #define otDumpCertMeshCoP(aId, aBuf, aLength) otDump(OT_LOG_LEVEL_NONE, OT_LOG_REGION_MESH_COP, aId, aBuf, aLength) #else #define otDumpCertMeshCoP(aId, aBuf, aLength) diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index ad08eee1c..0c4d2d453 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -953,7 +953,7 @@ void Commissioner::HandleJoinerFinalize(Coap::Message &aMessage, const Ip6::Mess } } -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE if (aMessage.GetLength() <= OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE) { uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; @@ -990,7 +990,7 @@ void Commissioner::SendJoinFinalizeResponse(const Coap::Message &aRequest, State joinerMessageInfo.GetPeerAddr().SetIid(mJoinerIid); joinerMessageInfo.SetPeerPort(mJoinerPort); -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; VerifyOrExit(message->GetLength() <= sizeof(buf)); diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index 8446a280f..5e708eed9 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -463,7 +463,7 @@ void Joiner::SendJoinerFinalize(void) { assert(mFinalizeMessage != NULL); -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE LogCertMessage("[THCI] direction=send | type=JOIN_FIN.req |", *mFinalizeMessage); #endif @@ -504,7 +504,7 @@ void Joiner::HandleJoinerFinalizeResponse(Coap::Message & aMessage, otLogInfoMeshCoP("Joiner received finalize response %d", static_cast(state.GetState())); -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE LogCertMessage("[THCI] direction=recv | type=JOIN_FIN.rsp |", aMessage); #endif @@ -668,7 +668,7 @@ const char *Joiner::JoinerStateToString(otJoinerState aState) return str; } -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE void Joiner::LogCertMessage(const char *aText, const Coap::Message &aMessage) const { uint8_t buf[OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE]; diff --git a/src/core/meshcop/joiner.hpp b/src/core/meshcop/joiner.hpp index 93648b43f..6aaeba538 100644 --- a/src/core/meshcop/joiner.hpp +++ b/src/core/meshcop/joiner.hpp @@ -162,7 +162,7 @@ private: void SendJoinerFinalize(void); void SendJoinerEntrustResponse(const Coap::Message &aRequest, const Ip6::MessageInfo &aRequestInfo); -#if OPENTHREAD_ENABLE_CERT_LOG +#if OPENTHREAD_ENABLE_REFERENCE_DEVICE void LogCertMessage(const char *aText, const Coap::Message &aMessage) const; #endif diff --git a/src/core/openthread-core-config-check.h b/src/core/openthread-core-config-check.h index cd2a6cdaa..6797f8eb0 100644 --- a/src/core/openthread-core-config-check.h +++ b/src/core/openthread-core-config-check.h @@ -65,4 +65,7 @@ #error "OPENTHREAD_CONFIG_ENABLE_AUTO_START_SUPPORT was removed." #endif +#ifdef OPENTHREAD_ENABLE_CERT_LOG +#error "OPENTHREAD_ENABLE_CERT_LOG was replaced by OPENTHREAD_ENABLE_REFERENCE_DEVICE." +#endif #endif // OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/src/posix/Makefile-posix b/src/posix/Makefile-posix index b63ca4036..2a630e412 100644 --- a/src/posix/Makefile-posix +++ b/src/posix/Makefile-posix @@ -37,7 +37,6 @@ DEBUG ?= 0 BORDER_AGENT ?= 1 BORDER_ROUTER ?= 1 -CERT_LOG ?= 1 COAP ?= 1 COAPS ?= 1 COMMISSIONER ?= 1 @@ -57,6 +56,7 @@ LINK_RAW ?= 0 MAC_FILTER ?= 1 MTD_NETDIAG ?= 1 READLINE ?= edit +REFERENCE_DEVICE ?= 1 SERVICE ?= 1 SNTP_CLIENT ?= 1 UDP_FORWARD ?= 1