diff --git a/.travis/script.sh b/.travis/script.sh index 907d55a1e..2e386cc43 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -183,6 +183,48 @@ build_nrf52811() { DISABLE_TRANSPORTS=1 make -f examples/Makefile-nrf52811 || die } +build_nrf52833() { + # Default OpenThread switches for nRF52833 platform + OPENTHREAD_FLAGS="BORDER_AGENT=1 BORDER_ROUTER=1 COAP=1 COAPS=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 ECDSA=1 FULL_LOGS=1 IP6_FRAGM=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 SLAAC=1 SNTP_CLIENT=1 UDP_FORWARD=1" + + # UART transport + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + make -f examples/Makefile-nrf52833 $OPENTHREAD_FLAGS || die + arm-none-eabi-size output/nrf52833/bin/ot-cli-ftd || die + arm-none-eabi-size output/nrf52833/bin/ot-cli-mtd || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-ftd || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-mtd || die + arm-none-eabi-size output/nrf52833/bin/ot-rcp || die + + # USB transport + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + USB=1 make -f examples/Makefile-nrf52833 $OPENTHREAD_FLAGS || die + arm-none-eabi-size output/nrf52833/bin/ot-cli-ftd || die + arm-none-eabi-size output/nrf52833/bin/ot-cli-mtd || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-ftd || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-mtd || die + arm-none-eabi-size output/nrf52833/bin/ot-rcp || die + + # SPI transport for NCP + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + NCP_SPI=1 make -f examples/Makefile-nrf52833 $OPENTHREAD_FLAGS || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-ftd || die + arm-none-eabi-size output/nrf52833/bin/ot-ncp-mtd || die + arm-none-eabi-size output/nrf52833/bin/ot-rcp || die + + # Build without transport (no CLI or NCP applications) + git checkout -- . || die + git clean -xfd || die + ./bootstrap || die + DISABLE_TRANSPORTS=1 make -f examples/Makefile-nrf52833 $OPENTHREAD_FLAGS || die +} + build_nrf52840() { # Default OpenThread switches for nRF52840 platform OPENTHREAD_FLAGS="BORDER_AGENT=1 BORDER_ROUTER=1 COAP=1 COAPS=1 COMMISSIONER=1 DEBUG=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 ECDSA=1 FULL_LOGS=1 IP6_FRAGM=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 SLAAC=1 SNTP_CLIENT=1 UDP_FORWARD=1" @@ -281,6 +323,7 @@ build_samr21() { build_cc2652 build_kw41z build_nrf52811 + build_nrf52833 build_nrf52840 build_qpg6095 build_samr21 @@ -295,6 +338,7 @@ build_samr21() { build_cc2652 build_kw41z build_nrf52811 + build_nrf52833 build_nrf52840 build_qpg6095 build_samr21 @@ -309,6 +353,7 @@ build_samr21() { build_cc2652 build_kw41z build_nrf52811 + build_nrf52833 build_nrf52840 build_qpg6095 build_samr21 @@ -323,6 +368,7 @@ build_samr21() { build_cc2652 build_kw41z build_nrf52811 + build_nrf52833 build_nrf52840 build_qpg6095 build_samr21 @@ -337,6 +383,7 @@ build_samr21() { build_cc2652 build_kw41z build_nrf52811 + build_nrf52833 build_nrf52840 build_qpg6095 build_samr21 diff --git a/configure.ac b/configure.ac index 04271964a..2f26ad354 100644 --- a/configure.ac +++ b/configure.ac @@ -782,12 +782,12 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_CUSTOM_LINKER_FILE], [test "${with_custom_link AC_ARG_WITH(examples, [AS_HELP_STRING([--with-examples=TARGET], - [Specify the examples from one of: no, posix, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg21, gp712, kw41z, nrf52811, nrf52840, qpg6095, samr21 @<:@default=no@:>@.])], + [Specify the examples from one of: no, posix, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg21, gp712, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.])], [ case "${with_examples}" in no) ;; - posix|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg21|gp712|kw41z|nrf52811|nrf52840|qpg6095|samr21) + posix|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg21|gp712|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21) if test ${enable_posix_app} = "yes"; then AC_MSG_ERROR([--with-examples must be no when POSIX apps are enabled by --enable-posix-app]) fi @@ -811,6 +811,7 @@ AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG21], [test "${with_examples}" = "efr3 AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"]) AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"]) AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52811], [test "${with_examples}" = "nrf52811"]) +AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52833], [test "${with_examples}" = "nrf52833"]) AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf52840"]) AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6095], [test "${with_examples}" = "qpg6095"]) AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${with_examples}" = "samr21"]) @@ -820,7 +821,7 @@ AM_COND_IF([OPENTHREAD_EXAMPLES_POSIX], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMP AC_MSG_CHECKING([whether to enable examples]) AC_MSG_RESULT(${with_examples}) -AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF528XX], [test OPENTHREAD_EXAMPLES_NRF52811 || test OPENTHREAD_EXAMPLES_NRF52840]) +AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF528XX], [test OPENTHREAD_EXAMPLES_NRF52811 || test OPENTHREAD_EXAMPLES_NRF52833 || test OPENTHREAD_EXAMPLES_NRF52840]) # # Tools # diff --git a/examples/Makefile-nrf52833 b/examples/Makefile-nrf52833 new file mode 100644 index 000000000..29e77d4fa --- /dev/null +++ b/examples/Makefile-nrf52833 @@ -0,0 +1,330 @@ +# +# Copyright (c) 2019, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +.NOTPARALLEL: + +AR = arm-none-eabi-ar +CCAS = $(CCPREFIX) arm-none-eabi-gcc +CPP = arm-none-eabi-cpp +CC = $(CCPREFIX) arm-none-eabi-gcc +CXX = $(CCPREFIX) arm-none-eabi-g++ +LD = arm-none-eabi-ld +STRIP = arm-none-eabi-strip +NM = arm-none-eabi-nm +RANLIB = arm-none-eabi-ranlib +OBJCOPY = arm-none-eabi-objcopy + +GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`) + +configure_OPTIONS = \ + --enable-ftd \ + --enable-mtd \ + --enable-linker-map \ + --with-examples=nrf52833 \ + MBEDTLS_CPPFLAGS="$(NRF52833_MBEDTLS_CPPFLAGS)" \ + $(NULL) + +ifdef SRC_PATH +configure_OPTIONS += --srcdir="$(SRC_PATH)" +endif + +TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST)))).. +AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))).. + +NRF52833_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"' +NRF52833_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"nrf52833-mbedtls-config.h\"' +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/crypto +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/libraries/nrf_cc310/include +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/nrfx/mdk +NRF52833_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/NordicSemiconductor/cmsis +NRF52833_MBEDTLS_CPPFLAGS += -DNRF52833_XXAA + +NRF52833_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-nrf52833-config.h\"' +NRF52833_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-nrf52833-config-check.h\"' +NRF52833_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833 + +COMMONCFLAGS := \ + -fdata-sections \ + -ffunction-sections \ + -Os \ + -g \ + $(NRF52833_CONFIG_FILE_CPPFLAGS) \ + $(NULL) + +include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk + +ifeq ($(BOOTLOADER),1) +configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader.ld +COMMONCFLAGS += -DAPP_USBD_NRF_DFU_TRIGGER_ENABLED=1 +endif + +# +# Select transport which CLI, NCP and RCP examples will use to communicate. +# To disable all transports use the DISABLE_TRANSPORTS switch. This will disable +# the build of all above examples. +# If NCP_SPI switch is set, only NCP and RCP examples will be built. +# Otherwise the user can select USB transport. If no transports were selected, +# the default serial transport is UART. +# +ifndef DISABLE_TRANSPORTS +configure_OPTIONS += --enable-ncp +configure_OPTIONS += --enable-radio-only +ifeq ($(NCP_SPI),1) +COMMONCFLAGS += -DSPIS_AS_SERIAL_TRANSPORT=1 +COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1 +else +COMMONCFLAGS += -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1 +configure_OPTIONS += --enable-cli +ifeq ($(USB),1) +COMMONCFLAGS += -DUSB_CDC_AS_SERIAL_TRANSPORT=1 +else +COMMONCFLAGS += -DUART_AS_SERIAL_TRANSPORT=1 +endif # USB == 1 +endif # NCP_SPI == 1 +endif # DISABLE_TRANSPORTS + +NRF52833_MBEDTLS_CPPFLAGS += -DDISABLE_CC310=1 + +ifeq ($(shell expr $(GCCVersion) \>= 7), 1) + COMMONCFLAGS += -Wno-expansion-to-defined +endif + +CPPFLAGS += \ + $(COMMONCFLAGS) \ + $(target_CPPFLAGS) \ + $(NULL) + +CFLAGS += \ + $(COMMONCFLAGS) \ + $(target_CFLAGS) \ + $(NULL) + +CXXFLAGS += \ + $(COMMONCFLAGS) \ + $(target_CXXFLAGS) \ + -fno-exceptions \ + -fno-rtti \ + $(NULL) + +LDFLAGS += \ + $(COMMONCFLAGS) \ + $(target_LDFLAGS) \ + -specs=nano.specs \ + -specs=nosys.specs \ + -Wl,--gc-sections \ + $(NULL) + +CCASFLAGS += \ + $(COMMONCCASFLAGS) \ + $(target_CCASFLAGS) \ + -x \ + assembler-with-cpp \ + $(NULL) + +ECHO := @echo +MAKE := make +MKDIR_P := mkdir -p +LN_S := ln -s +RM_F := rm -f + +INSTALL := /usr/bin/install +INSTALLFLAGS := -p + +BuildPath = build +TopBuildDir = $(BuildPath) +AbsTopBuildDir = $(PWD)/$(TopBuildDir) + +ResultPath = output +TopResultDir = $(ResultPath) +AbsTopResultDir = $(PWD)/$(TopResultDir) + +TargetTuple = nrf52833 + +ARCHS = cortex-m4 + +TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib + +ifndef BuildJobs +BuildJobs := $(shell getconf _NPROCESSORS_ONLN) +endif +JOBSFLAG := -j$(BuildJobs) + +# +# configure-arch +# +# Configure OpenThread for the specified architecture. +# +# arch - The architecture to configure. +# +define configure-arch +$(ECHO) " CONFIG $(TargetTuple)..." +(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \ +INSTALL="$(INSTALL) $(INSTALLFLAGS)" \ +CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \ +--host=arm-none-eabi \ +--prefix=/ \ +--exec-prefix=/$(TargetTuple) \ +$(configure_OPTIONS)) +endef # configure-arch + +# +# build-arch +# +# Build the OpenThread intermediate build products for the specified +# architecture. +# +# arch - The architecture to build. +# +define build-arch +$(ECHO) " BUILD $(TargetTuple)" +$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \ +all +endef # build-arch + +# +# stage-arch +# +# Stage (install) the OpenThread final build products for the specified +# architecture. +# +# arch - The architecture to stage. +# +define stage-arch +$(ECHO) " STAGE $(TargetTuple)" +$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \ +DESTDIR=$(AbsTopResultDir) \ +install +endef # stage-arch + +# +# ARCH_template +# +# Define macros, targets and rules to configure, build, and stage the +# OpenThread for a single architecture. +# +# arch - The architecture to instantiate the template for. +# +define ARCH_template +CONFIGURE_TARGETS += configure-$(1) +BUILD_TARGETS += do-build-$(1) +STAGE_TARGETS += stage-$(1) +BUILD_DIRS += $(BuildPath)/$(TargetTuple) +DIRECTORIES += $(BuildPath)/$(TargetTuple) + +configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS) +configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS) +configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS) +configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS) +configure-$(1): target_CCASFLAGS=$($(1)_target_CCASFLAGS) + +configure-$(1): $(BuildPath)/$(TargetTuple)/config.status + +$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple) + $$(call configure-arch,$(1)) + +do-build-$(1): configure-$(1) + +do-build-$(1): + +$$(call build-arch,$(1)) + +stage-$(1): do-build-$(1) + +stage-$(1): | $(TopResultDir) + $$(call stage-arch,$(1)) + +$(1): stage-$(1) +endef # ARCH_template + +.DEFAULT_GOAL := all + +all: stage + +# +# Cortex-m4 +# + +cortex-m4_target_ABI = cortex-m4 +cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs +cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs +cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs +cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs + +# Instantiate an architecture-specific build template for each target +# architecture. + +$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch)))) + +# +# Flashing / Debugging +# + +TARGET_APP ?= ot-cli-ftd +APP_FILE_NAME = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP) +APP_FILE_HEX = $(TopResultDir)/$(TargetTuple)/bin/$(TARGET_APP).hex + +nrfjprog: $(APP_FILE_NAME) + arm-none-eabi-objcopy -O ihex $(<) $(APP_FILE_HEX) + nrfjprog -f NRF52 --sectorerase --reset --program $(APP_FILE_HEX) + +# +# Common / Finalization +# + +configure: $(CONFIGURE_TARGETS) + +build: $(BUILD_TARGETS) + +stage: $(STAGE_TARGETS) + +DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS) + +CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS) + +all: stage + +$(DIRECTORIES): + $(ECHO) " MKDIR $@" + @$(MKDIR_P) "$@" + +clean: + $(ECHO) " CLEAN" + @$(RM_F) -r $(CLEAN_DIRS) + +help: + $(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following " + $(ECHO) "architectures: " + $(ECHO) "" + $(ECHO) " $(ARCHS)" + $(ECHO) "" + $(ECHO) "To build only a particular architecture, specify: " + $(ECHO) "" + $(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) " + $(ECHO) "" diff --git a/examples/platforms/Makefile.platform.am b/examples/platforms/Makefile.platform.am index 62a3f359a..21f048bbc 100644 --- a/examples/platforms/Makefile.platform.am +++ b/examples/platforms/Makefile.platform.am @@ -77,6 +77,10 @@ if OPENTHREAD_EXAMPLES_NRF52811 include $(top_srcdir)/examples/platforms/nrf528xx/nrf52811/Makefile.platform.am endif +if OPENTHREAD_EXAMPLES_NRF52833 +include $(top_srcdir)/examples/platforms/nrf528xx/nrf52833/Makefile.platform.am +endif + if OPENTHREAD_EXAMPLES_NRF52840 include $(top_srcdir)/examples/platforms/nrf528xx/nrf52840/Makefile.platform.am endif diff --git a/examples/platforms/nrf528xx/Makefile.am b/examples/platforms/nrf528xx/Makefile.am index 80fa7cd48..c25142df0 100644 --- a/examples/platforms/nrf528xx/Makefile.am +++ b/examples/platforms/nrf528xx/Makefile.am @@ -35,6 +35,10 @@ if OPENTHREAD_EXAMPLES_NRF52811 include nrf52811/Makefile.am endif +if OPENTHREAD_EXAMPLES_NRF52833 +include nrf52833/Makefile.am +endif + if OPENTHREAD_EXAMPLES_NRF52840 include nrf52840/Makefile.am endif @@ -45,8 +49,9 @@ PRETTY_FILES = \ src/platform-fem.h \ src/platform-nrf5.h \ $(wildcard src/*.c) \ - $(wildcard nrf52840/*.h) \ $(wildcard nrf52811/*.h) \ + $(wildcard nrf52833/*.h) \ + $(wildcard nrf52840/*.h) \ $(NULL) include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/examples/platforms/nrf528xx/README.md b/examples/platforms/nrf528xx/README.md index 81d845e02..98715c7ba 100644 --- a/examples/platforms/nrf528xx/README.md +++ b/examples/platforms/nrf528xx/README.md @@ -1,13 +1,16 @@ -# OpenThread on nRF528XX Example +# OpenThread on nRF528xx Example -This directory contains example platform drivers for [Nordic Semiconductor nRF52840 SoC][nRF52840] and [Nordic Semiconductor nRF52811 SoC][nRF52811]. +This directory contains example platform drivers for [Nordic Semiconductor nRF52840 SoC][nRF52840], [Nordic Semiconductor nRF52833 SoC][nRF52833] and [Nordic Semiconductor nRF52811 SoC][nRF52811]. [nRF52840]: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52840 +[nRF52833]: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52833 [nRF52811]: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52811 To learn more about building and running the examples please check: * [OpenThread on nRF52840 examples][nrf52840-page] +* [OpenThread on nRF52833 examples][nrf52833-page] * [OpenThread on nRF52811 examples][nrf52811-page] [nrf52840-page]: ./nrf52840/README.md +[nrf52833-page]: ./nrf52833/README.md [nrf52811-page]: ./nrf52811/README.md \ No newline at end of file diff --git a/examples/platforms/nrf528xx/nrf52811/Makefile.am b/examples/platforms/nrf528xx/nrf52811/Makefile.am index 3a3949eec..6f1bdea91 100644 --- a/examples/platforms/nrf528xx/nrf52811/Makefile.am +++ b/examples/platforms/nrf528xx/nrf52811/Makefile.am @@ -53,6 +53,7 @@ COMMONCPPFLAGS -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/simple_gpio \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal \ diff --git a/examples/platforms/nrf528xx/nrf52811/platform-config.h b/examples/platforms/nrf528xx/nrf52811/platform-config.h index b9816a379..40ad62f97 100644 --- a/examples/platforms/nrf528xx/nrf52811/platform-config.h +++ b/examples/platforms/nrf528xx/nrf52811/platform-config.h @@ -384,43 +384,6 @@ #define NRF_802154_ACK_TIMEOUT_ENABLED 1 #endif -/** - * @def NRF_802154_SWI_EGU_INSTANCE - * - * SWI EGU instance used by the driver to synchronize PPIs and for requests and notifications if - * SWI is in use. - * - * @note This option is used by the core module regardless of the driver configuration. - * - */ -#ifndef NRF_802154_SWI_EGU_INSTANCE -#define NRF_802154_SWI_EGU_INSTANCE NRF_EGU0 -#endif - -/** - * @def NRF_802154_SWI_IRQ_HANDLER - * - * SWI EGU IRQ handler used by the driver for requests and notifications if SWI is in use. - * - * @note This option is used when the driver uses SWI to process requests and notifications. - * - */ -#ifndef NRF_802154_SWI_IRQ_HANDLER -#define NRF_802154_SWI_IRQ_HANDLER SWI0_EGU0_IRQHandler -#endif - -/** - * @def NRF_802154_SWI_IRQN - * - * SWI EGU IRQ number used by the driver for requests and notifications if SWI is in use. - * - * @note This option is used when the driver uses SWI to process requests and notifications. - * - */ -#ifndef NRF_802154_SWI_IRQN -#define NRF_802154_SWI_IRQN SWI0_EGU0_IRQn -#endif - /******************************************************************************* * @section Temperature sensor driver configuration. ******************************************************************************/ diff --git a/examples/platforms/nrf528xx/nrf52833/Makefile.am b/examples/platforms/nrf528xx/nrf52833/Makefile.am new file mode 100644 index 000000000..5265d991a --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/Makefile.am @@ -0,0 +1,161 @@ +# +# Copyright (c) 2019, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +include $(abs_top_nlbuild_autotools_dir)/automake/pre.am + +lib_LIBRARIES = \ + libopenthread-nrf52833.a \ + libopenthread-nrf52833-sdk.a \ + libopenthread-nrf52833-softdevice-sdk.a \ + $(NULL) + +# Do not enable -pedantic-errors for nRF52833 driver library +override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS)) +override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS)) + +COMMONCPPFLAGS = \ + -DCONFIG_GPIO_AS_PINRESET \ + -DNRF52833_XXAA \ + -I$(srcdir) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/examples/platforms \ + -I$(top_srcdir)/examples/platforms/nrf528xx/src \ + -I$(top_srcdir)/src/core \ + -I$(top_srcdir)/third_party/NordicSemiconductor \ + -I$(top_srcdir)/third_party/NordicSemiconductor/cmsis \ + -I$(top_srcdir)/third_party/NordicSemiconductor/dependencies \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/clock \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/common \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/simple_gpio \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/power \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/systick \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/usbd \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atfifo \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/atomic \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/delay \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/config \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/class/cdc \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/usb/class/cdc/acm \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/utf_converter \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/hal \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/drivers \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/drivers/include \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/soc \ + -I$(top_srcdir)/third_party/NordicSemiconductor/softdevice/s140/headers \ + -I$(top_srcdir)/third_party/NordicSemiconductor/softdevice/s140/headers/nrf52 \ + $(NULL) + +PLATFORM_COMMON_SOURCES = \ + src/alarm.c \ + src/diag.c \ + src/entropy.c \ + src/fem.c \ + src/flash.c \ + src/logging.c \ + src/misc.c \ + src/radio.c \ + src/temp.c \ + src/spi-slave.c \ + src/system.c \ + src/uart.c \ + src/usb-cdc-uart.c \ + $(NULL) + +SINGLEPHY_SOURCES = \ + src/flash_nosd.c \ + $(NULL) + +SOFTDEVICE_SOURCES = \ + src/flash_sd.c \ + src/softdevice.c \ + $(NULL) + +SOFTDEVICE_CPPFLAGS = \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice \ + -I$(top_srcdir)/third_party/NordicSemiconductor/softdevice/s140/headers \ + -DSOFTDEVICE_PRESENT \ + -DS140 \ + $(NULL) + +PLATFORM_SOURCES = \ + $(PLATFORM_COMMON_SOURCES) \ + $(NULL) + +libopenthread_nrf52833_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(SINGLEPHY_CPPFLAGS) \ + $(NULL) + +libopenthread_nrf52833_a_SOURCES = \ + $(PLATFORM_SOURCES) \ + $(SINGLEPHY_SOURCES) \ + $(NULL) + +libopenthread_nrf52833_sdk_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(SINGLEPHY_CPPFLAGS) \ + $(NULL) + +libopenthread_nrf52833_sdk_a_SOURCES = \ + $(PLATFORM_SOURCES) \ + $(SINGLEPHY_SOURCES) \ + $(NULL) + +libopenthread_nrf52833_softdevice_sdk_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(SOFTDEVICE_CPPFLAGS) \ + $(NULL) + +libopenthread_nrf52833_softdevice_sdk_a_SOURCES = \ + $(PLATFORM_SOURCES) \ + $(SOFTDEVICE_SOURCES) \ + $(NULL) + +Dash = - + +libopenthread_nrf52833_a_LIBADD = \ + $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o") \ + $(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o") + +libopenthread_nrf52833_sdk_a_LIBADD = \ + $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o") + +libopenthread_nrf52833_softdevice_sdk_a_LIBADD = \ + $(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o") + +include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/examples/platforms/nrf528xx/nrf52833/Makefile.platform.am b/examples/platforms/nrf528xx/nrf52833/Makefile.platform.am new file mode 100644 index 000000000..ab0fc8ded --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/Makefile.platform.am @@ -0,0 +1,47 @@ +# +# Copyright (c) 2019, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# nrf52833 platform-specific Makefile +# + +LDADD_COMMON += \ + $(top_builddir)/examples/platforms/nrf528xx/libopenthread-nrf52833.a \ + $(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52833-sdk.a \ + $(top_builddir)/third_party/NordicSemiconductor/libnordicsemi-nrf52833-radio-driver.a \ + $(NULL) + +if OPENTHREAD_ENABLE_CUSTOM_LINKER_FILE +LDFLAGS_COMMON += \ + -T $(OPENTHREAD_CUSTOM_LINKER_FILE) \ + $(NULL) +else +LDFLAGS_COMMON += \ + -T $(top_srcdir)/examples/platforms/nrf528xx/nrf52833/nrf52833.ld \ + $(NULL) +endif diff --git a/examples/platforms/nrf528xx/nrf52833/README.md b/examples/platforms/nrf528xx/nrf52833/README.md new file mode 100644 index 000000000..bd6bdd89c --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/README.md @@ -0,0 +1,394 @@ +# OpenThread on nRF52833 Example + +This directory contains example platform drivers for [Nordic Semiconductor nRF52833 SoC][nRF52833]. + +To facilitate Thread products development with the nRF52833 platform, Nordic Semiconductor provides nRF5 SDK for Thread and Zigbee. See [Nordic Semiconductor's nRF5 SDK for Thread and Zigbee][nRF5-SDK-section] section for more details. + +[nRF52833]: https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52833 +[nRF5-SDK-section]: #nordic-semiconductors-nrf5-sdk-for-thread-and-zigbee + +## Prerequisites + +Before you start building the examples, you must download and install the toolchain and the tools required for flashing and debugging. + +### Toolchain + +Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain]. + +[gnu-toolchain]: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm + +To install the GNU toolchain and its dependencies, run the following commands in Bash: + +```bash +$ cd +$ ./script/bootstrap +``` + +### Flashing and debugging tools + +[nRF5-Command-Line-Tools]: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF5-Command-Line-Tools + +Install the [nRF5 Command Line Tools][nRF5-Command-Line-Tools] to flash, debug, and make use of logging features on the nRF52833 DK with SEGGER J-Link. + +## Building the examples + + To build the examples, run the following command in Bash: + +```bash +$ cd +$ ./bootstrap +$ make -f examples/Makefile-nrf52833 +``` + +After a successful build, the `elf` files can be found in +`/output/nrf52833/bin`. +You can convert them to hex using `arm-none-eabi-objcopy`: +```bash +$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex +``` + +### USB CDC ACM support + +You can build the libraries with support for the native USB CDC ACM as a serial transport. +To do so, build the firmware with the following parameter: +``` +$ make -f examples/Makefile-nrf52833 USB=1 +``` + +Note that the USB CDC ACM serial transport is not supported with Engineering sample A of the nRF52833 chip. + +If you are using Windows 7 or earlier, you must load an additional USB CDC driver. +The driver can be found in `third_party/NordicSemiconductor/libraries/usb/nordic_cdc_acm_example.inf`. + +### Bootloader support + +The examples support the following bootloaders for performing a Device Firmware Upgrade (DFU): +* USB bootloader +* UART bootloader +* BLE bootloader + +The support for a particular bootloader can be enabled with the following switches: +* USB: `BOOTLOADER=USB` +* UART: `BOOTLOADER=UART` +* BLE: `BOOTLOADER=BLE` + +### Native SPI support + +You can build the libraries with support for native SPI Slave. +To build the libraries, run make with the following parameter: + +``` +$ make -f examples/Makefile-nrf52833 NCP_SPI=1 +``` + +With this option enabled, SPI communication between the NCP example and wpantund is possible +(provided that the wpantund host supports SPI Master). To achieve that, an appropriate SPI device +should be chosen in wpantund configuration file, `/etc/wpantund.conf`. You can find an example below. +``` +Config:NCP:SocketPath "system:/usr/bin/spi-hdlc-adapter --gpio-int /sys/class/gpio/gpio25 /dev/spidev0.0" +``` + +In this example, [spi-hdlc-adapter][spi-hdlc-adapter] is a tool that you can use to communicate between NCP and wpantund over SPI. For this example, `spi-hdlc-adapter` is installed in `/usr/bin`. + +The default SPI Slave pin configuration for nRF52833 is defined in `examples/platforms/nrf52833/platform-config.h`. + +Note that the native SPI Slave support is not intended to be used with Engineering sample A of the nRF52833 chip due to +single transfer size limitation. + +[spi-hdlc-adapter]: https://github.com/openthread/openthread/tree/master/tools/spi-hdlc-adapter + +### Optional prefix for compiler command + +You can prefix the compiler command using the CCPREFIX parameter. This speeds up the compilation when you use tools like [ccache][ccache-website]. Example usage: + +[ccache-website]: https://ccache.samba.org/ + +``` +$ make -f examples/Makefile-nrf52833 USB=1 CCPREFIX=ccache +``` +### Optional mbedTLS threading support +By default, mbedTLS library is built without support for multiple threads. You can enable this built-in support by building OpenThread with the following parameter: + +``` +$ make -f examples/Makefile-nrf52833 MBEDTLS_THREADING=1 +``` + +The simple mutex definition is used as shown below: + +``` +typedef void * mbedtls_threading_mutex_t; +``` + +However, you can modify it, by providing a path to a header file with proper definition. To do that, build OpenThread with the following parameter: + +``` +$ make -f examples/Makefile-nrf52833 MBEDTLS_THREADING=1 MBEDTLS_THREADING_MUTEX_DEF="path_to_a_header_file_with_mutex_definition.h" +``` + +See [mbedTls Thread Safety and Multi Threading][mbedtls-thread-safety-and-multi-threading] for more details. + +[mbedtls-thread-safety-and-multi-threading]: https://tls.mbed.org/kb/development/thread-safety-and-multi-threading + +### IEEE EUI-64 address + +When the Thread device is configured to obtain the Thread Network security credentials with either Thread Commissioning or an out-of-band method, the extended MAC address should be constructed out of the globally unique IEEE EUI-64. + +The IEEE EUI-64 address consists of two parts: + - 24 bits of MA-L (MAC Address Block Large), formerly called OUI (Organizationally Unique Identifier) + - 40-bit device unique identifier + +By default, the device uses Nordic Semiconductor's MA-L (f4-ce-36). You can modify it by overwriting the `OPENTHREAD_CONFIG_STACK_VENDOR_OUI` define, located in the `openthread-core-nrf52833-config.h` file. This value must be publicly registered by the IEEE Registration Authority. + +You can also provide the full IEEE EUI-64 address by providing a custom `otPlatRadioGetIeeeEui64` function. To do this, define the flag `OPENTHREAD_CONFIG_ENABLE_PLATFORM_EUI64_CUSTOM_SOURCE`. + +After the Thread Network security credentials have been successfully obtained, the device uses randomly generated extended MAC address. + +## Flashing the binaries + +Flash the compiled binaries onto nRF52833 using `nrfjprog` which is +part of the [nRF5 Command Line Tools][nRF5-Command-Line-Tools]. + +```bash +$ nrfjprog -f nrf52 --chiperase --program output/nrf52833/bin/ot-cli-ftd.hex --reset +``` + +## Running the example + +To test the example: + +1. Prepare two boards with the flashed `CLI Example` (as shown above). The CLI FTD example uses the direct UART connection. + +2. Open a terminal connection on two boards: + + a. Start a terminal emulator like screen. + + b. Connect to the used COM port with the following direct UART settings: + + * Baud rate: 115200 + * 8 data bits + * 1 stop bit + * No parity + * HW flow control: RTS/CTS + This allows you to view the raw UART output. + + On Linux system a port name should be called e.g. `/dev/ttyACM0` or `/dev/ttyACM1`. + + c. Run the following command to connect to a board. + + ```shell + screen /dev/ttyACM0 115200 + ``` + + Now you are connected with the CLI. + +3. Use the following commands to form a network on the first board. + + ```bash + > dataset init new + Done + > dataset + Active Timestamp: 1 + Channel: 13 + Channel Mask: 07fff800 + Ext PAN ID: d63e8e3e495ebbc3 + Mesh Local Prefix: fd3d:b50b:f96d:722d/64 + Master Key: dfd34f0f05cad978ec4e32b0413038ff + Network Name: OpenThread-8f28 + PAN ID: 0x8f28 + PSKc: c23a76e98f1a6483639b1ac1271e2e27 + Security Policy: 0, onrcb + Done + > dataset commit active + Done + > ifconfig up + Done + > thread start + Done + ``` + + After a couple of seconds the node will become a Leader of the network. + + ```bash + > state + leader + ``` + +4. Use the following commands to attach to the network on the second board. + + ```bash + > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff + Done + > dataset commit active + Done + > ifconfig up + Done + > thread start + Done + ``` + + After a couple of seconds the second node will attach and become a Child. + + ```bash + > state + child + ``` + +5. List all IPv6 addresses of the first board. + + ```bash + > ipaddr + fd3d:b50b:f96d:722d:0:ff:fe00:fc00 + fd3d:b50b:f96d:722d:0:ff:fe00:c00 + fd3d:b50b:f96d:722d:7a73:bff6:9093:9117 + fe80:0:0:0:6c41:9001:f3d6:4148 + Done + ``` + +6. Choose one of them and send an ICMPv6 ping from the second board. + + ```bash + > ping fd3d:b50b:f96d:722d:7a73:bff6:9093:9117 + 16 bytes from fd3d:b50b:f96d:722d:558:f56b:d688:799: icmp_seq=1 hlim=64 time=24ms + ``` + +For a list of all available commands, visit [OpenThread CLI Reference README.md][CLI]. + +[CLI]: ./../../../src/cli/README.md + +## SEGGER J-Link tools + +SEGGER J-Link tools allow to debug and flash generated firmware using on-board debugger or external one. + +### Working with RTT logging + +By default, the OpenThread's logging module provides functions to output logging +information over SEGGER's Real Time Transfer (RTT). + +You can set the desired log level by using the `OPENTHREAD_CONFIG_LOG_LEVEL` define. + +To enable the highest verbosity level, append `FULL_LOGS` flag to the `make` command: +``` +$ make -f examples/Makefile-nrf52833 FULL_LOGS=1 +``` + +#### Enable logging on Windows + +1. Connect the DK to your machine with a USB cable. +2. Run `J-Link RTT Viewer`. The configuration window appears. +3. From the Specify Target Device dropdown menu, select `NRF52833_XXAA`. +4. From the Target Interface & Speed dropdown menu, select `SWD`. + +#### Enable logging on Linux + +1. Connect the DK to your machine with a USB cable. +2. Run `JLinkExe` to connect to the target. For example: +``` +JLinkExe -device NRF52833_XXAA -if SWD -speed 4000 -autoconnect 1 -SelectEmuBySN -RTTTelnetPort 19021 +``` +3. Run `JLinkRTTTelnet` to obtain the RTT logs from the connected device in a separate console. For example: +``` +JLinkRTTClient -RTTTelnetPort 19021 +``` + +### Mass Storage Device known issue + +Depending on your version, due to a known issue in SEGGER's J-Link firmware, you might experience data corruption or data drops if you use the serial port. You can avoid this issue by disabling the Mass Storage Device. + +#### Disabling the Mass Storage Device on Windows + +1. Connect the DK to your machine with a USB cable. +2. Run `J-Link Commander`. The configuration window appears. +3. From the Specify Target Device dropdown menu, select `NRF52833_XXAA`. +4. From the Target Interface & Speed dropdown menu, select `SWD`. +5. Run the following command: +``` +MSDDisable +``` +6. Power cycle the DK. + +#### Disabling the Mass Storage Device on Linux + +1. Connect the DK to your machine with a USB cable. +2. Run `JLinkExe` to connect to the target. For example: +``` +JLinkExe -device NRF52833_XXAA -if SWD -speed 4000 -autoconnect 1 -SelectEmuBySN +``` +3. Run the following command: +``` +MSDDisable +``` +4. Power cycle the DK. + +### Hardware Flow Control detection + +By default, SEGGER J-Link automatically detects at runtime whether the target is using Hardware Flow Control (HWFC). + +The automatic HWFC detection is done by driving P0.07 (Clear to Send - CTS) from the interface MCU and evaluating the state of P0.05 (Request to Send - RTS) when the first data is sent or received. If the state of P0.05 (RTS) is high, it is assumed that HWFC is not used. + +To avoid potential race conditions, you can force HWFC and bypass the runtime auto-detection. + +#### Disabling the HWFC detection on Windows + +1. Connect the DK to your machine with a USB cable. +2. Run `J-Link Commander`. The configuration window appears. +3. From the Specify Target Device dropdown menu, select `NRF52833_XXAA`. +4. From the Target Interface & Speed dropdown menu, select `SWD`. +5. Run the following command: +``` +SetHWFC Force +``` +6. Power cycle the DK. + +#### Disabling the HWFC detection on Linux + +1. Connect the DK to your machine with a USB cable. +2. Run `JLinkExe` to connect to the target. For example: +``` +JLinkExe -device NRF52833_XXAA -if SWD -speed 4000 -autoconnect 1 -SelectEmuBySN +``` +3. Run the following command: +``` +SetHWFC Force +``` +4. Power cycle the DK. + +You can find more details [here][J-Link-OB]. + +[J-Link-OB]: https://wiki.segger.com/J-Link_OB_SAM3U_NordicSemi#Hardware_flow_control_support + +## Diagnostic module + +nRF52833 port extends [OpenThread Diagnostics Module][DIAG]. + +You can read about all the features [here][nRFDIAG]. + +[DIAG]: ./../../../src/core/diags/README.md +[nRFDIAG]: ./../DIAG.md + +## Radio driver documentation + +The radio driver comes with documentation that describes the operation of state +machines in this module. To open the `*.uml` sequence diagrams, use [PlantUML][PlantUML-url]. + +[PlantUML-url]: http://plantuml.com/ + +# Nordic Semiconductor's nRF5 SDK for Thread and Zigbee + +Use [nRF5 Software Development Kit (SDK) for Thread and Zigbee][nRF5-SDK-Thread-Zigbee] when developing Thread products with Nordic Semiconductor's advanced nRF52840, nRF52833 or nRF52811 SoCs. + +The nRF5 SDK for Thread and Zigbee includes: + - a pre-built OpenThread stack for the Nordic nRF52840, nRF52833 and nRF52811 SoCs, + - support for hardware-accelerated cryptographic operations using ARM® CryptoCell-310, + - unique Thread/Bluetooth Low Energy dynamic multiprotocol solution which allows for concurrent operation of Thread and Bluetooth Low Energy utilizing OpenThread and SoftDevice (Nordic’s Bluetooth Low Energy stack) with accompanying example applications, + - Thread/Bluetooth Low Energy switched multiprotocol solution with accompanying example applications, + - unique support for DFU-over-Thread (Device Firmware Upgrade), + - examples to demonstrate interactions between nodes performing different Thread roles with the use of OpenThread and CoAP, CoAP Secure or MQTT-SN protocols, + - support for OpenThread Network Co-Processor (NCP) and Radio Co-Processor (RCP) using UART, USB or SPI transport protocol, + - Border Router and cloud connectivity example (e.g. with Google Cloud Platform), + - Thread native commissioning with NFC example, + - example applications demonstrating the use of FreeRTOS with OpenThread, + - support for IAR, Keil MDK-ARM and SEGGER Embedded Studio (SES) IDEs for OpenThread stack and all example applications, + - range of PC tools including Thread Topology Monitor and nRF Sniffer for 802.15.4, + - software modules inherited from the nRF5 SDK e.g. peripheral drivers, NFC libraries, Bluetooth Low Energy libraries etc. + +[nRF5-SDK-Thread-Zigbee]: https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK-for-Thread-and-Zigbee diff --git a/examples/platforms/nrf528xx/nrf52833/nrf52833.ld b/examples/platforms/nrf528xx/nrf52833/nrf52833.ld new file mode 100644 index 000000000..88e85f722 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/nrf52833.ld @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVEpR CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * GCC linker script for nRF52833. + */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x80000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 +} + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +ENTRY(Reset_Handler) + +FLASH_PAGE_SIZE = 4096; +FLASH_DATA_PAGES_USED = 4; + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + PROVIDE(end = .); + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __stop_ot_flash_data = (ORIGIN(FLASH) + LENGTH(FLASH)); + __start_ot_flash_data = (__stop_ot_flash_data - (FLASH_PAGE_SIZE * FLASH_DATA_PAGES_USED)); + + /* Assure that code does not overlap flash data area.*/ + ASSERT((__start_ot_flash_data >= __etext + SIZEOF(.data)), "Error: Code overlaps flash data area.") + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_ble.ld b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_ble.ld new file mode 100644 index 000000000..012601659 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_ble.ld @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * GCC linker script for nRF52833 with BLE bootloader. + */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00026000, LENGTH = 0x52000 + RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0x1fff8 +} + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +ENTRY(Reset_Handler) + +FLASH_PAGE_SIZE = 4096; +FLASH_DATA_PAGES_USED = 4; + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + PROVIDE(end = .); + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __stop_ot_flash_data = (ORIGIN(FLASH) + LENGTH(FLASH)); + __start_ot_flash_data = (__stop_ot_flash_data - (FLASH_PAGE_SIZE * FLASH_DATA_PAGES_USED)); + + /* Assure that code does not overlap flash data area.*/ + ASSERT((__start_ot_flash_data >= __etext + SIZEOF(.data)), "Error: Code overlaps flash data area.") + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_uart.ld b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_uart.ld new file mode 100644 index 000000000..44ef3a943 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_uart.ld @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * GCC linker script for nRF52833 with UART bootloader. + */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00001000, LENGTH = 0x77000 + RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0x1fff8 +} + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +ENTRY(Reset_Handler) + +FLASH_PAGE_SIZE = 4096; +FLASH_DATA_PAGES_USED = 4; + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + PROVIDE(end = .); + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __stop_ot_flash_data = (ORIGIN(FLASH) + LENGTH(FLASH)); + __start_ot_flash_data = (__stop_ot_flash_data - (FLASH_PAGE_SIZE * FLASH_DATA_PAGES_USED)); + + /* Assure that code does not overlap flash data area.*/ + ASSERT((__start_ot_flash_data >= __etext + SIZEOF(.data)), "Error: Code overlaps flash data area.") + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_usb.ld b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_usb.ld new file mode 100644 index 000000000..dc4366c38 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/nrf52833_bootloader_usb.ld @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2018, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * GCC linker script for nRF52833 with USB bootloader. + */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00001000, LENGTH = 0x5f000 + RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0x1fff8 +} + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +ENTRY(Reset_Handler) + +FLASH_PAGE_SIZE = 4096; +FLASH_DATA_PAGES_USED = 4; + +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + PROVIDE(end = .); + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __stop_ot_flash_data = (ORIGIN(FLASH) + LENGTH(FLASH)); + __start_ot_flash_data = (__stop_ot_flash_data - (FLASH_PAGE_SIZE * FLASH_DATA_PAGES_USED)); + + /* Assure that code does not overlap flash data area.*/ + ASSERT((__start_ot_flash_data >= __etext + SIZEOF(.data)), "Error: Code overlaps flash data area.") + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config-check.h b/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config-check.h new file mode 100644 index 000000000..4151f0795 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config-check.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OPENTHREAD_CORE_NRF52833_CONFIG_CHECK_H_ +#define OPENTHREAD_CORE_NRF52833_CONFIG_CHECK_H_ + +#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT +#error "Platform nrf52833 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT" +#endif + +#endif /* OPENTHREAD_CORE_NRF52833_CONFIG_CHECK_H_ */ diff --git a/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config.h b/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config.h new file mode 100644 index 000000000..43e909cda --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/openthread-core-nrf52833-config.h @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes nrf52833 compile-time configuration constants + * for OpenThread. + */ + +#ifndef OPENTHREAD_CORE_NRF52833_CONFIG_H_ +#define OPENTHREAD_CORE_NRF52833_CONFIG_H_ + +/* + * The GNU Autoconf system defines a PACKAGE macro which is the name + * of the software package. This name collides with PACKAGE field in + * the nRF52 Factory Information Configuration Registers (FICR) + * structure. + */ +#undef PACKAGE + +/** + * @def OPENTHREAD_CONFIG_LOG_OUTPUT + * + * The nrf52833 platform provides an otPlatLog() function. + */ +#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT +#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_INFO + * + * The platform-specific string to insert into the OpenThread version string. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_INFO +#define OPENTHREAD_CONFIG_PLATFORM_INFO "NRF52833" +#endif + +/** + * @def OPENTHREAD_CONFIG_STACK_VENDOR_OUI + * + * The Organizationally Unique Identifier for the vendor. + * + */ +#ifndef OPENTHREAD_CONFIG_STACK_VENDOR_OUI +#define OPENTHREAD_CONFIG_STACK_VENDOR_OUI 0xf4ce36 +#endif + +/** + * @def OPENTHREAD_CONFIG_MLE_MAX_CHILDREN + * + * The maximum number of children. + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_MAX_CHILDREN +#define OPENTHREAD_CONFIG_MLE_MAX_CHILDREN 32 +#endif + +/** + * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS + * + * The number of message buffers in the buffer pool. + * + */ +#ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS +#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 160 +#endif + +/** + * @def OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD + * + * The maximum number of supported IPv6 address registrations per child. + * + */ +#ifndef OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD +#define OPENTHREAD_CONFIG_MLE_IP_ADDRS_PER_CHILD 6 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS + * + * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`). + * + */ +#ifndef OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS +#define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3 +#endif + +/** + * @def OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES + * + * The number of EID-to-RLOC cache entries. + * + */ +#ifndef OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES +#define OPENTHREAD_CONFIG_TMF_ADDRESS_CACHE_ENTRIES 32 +#endif + +/** + * @def OPENTHREAD_CONFIG_LOG_PREPREND_LEVEL + * + * Define to prepend the log level to all log messages + * + */ +#ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL +#define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_SOFTWARE_ACK_TIMEOUT_ENABLE + * + * Define to 1 if you want to enable software ACK timeout logic. + * + */ +#ifndef OPENTHREAD_CONFIG_SOFTWARE_ACK_TIMEOUT_ENABLE +#define OPENTHREAD_CONFIG_SOFTWARE_ACK_TIMEOUT_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_SOFTWARE_RETRANSMIT_ENABLE + * + * Define to 1 if you want to enable software retransmission logic. + * + */ +#ifndef OPENTHREAD_CONFIG_SOFTWARE_RETRANSMIT_ENABLE +#define OPENTHREAD_CONFIG_SOFTWARE_RETRANSMIT_ENABLE 1 +#endif + +/** + * @def OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE + * + * Define to 1 if you want to enable software CSMA-CA backoff logic. + * + */ +#ifndef OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE +#define OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE + * + * Define to 1 if you want to support microsecond timer in platform. + * + */ +#ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 +#endif + +/** + * @def SETTINGS_CONFIG_BASE_ADDRESS + * + * The base address of settings. + * + */ +#ifndef SETTINGS_CONFIG_BASE_ADDRESS +#define SETTINGS_CONFIG_BASE_ADDRESS 0 +#endif + +/** + * @def SETTINGS_CONFIG_PAGE_SIZE + * + * The page size of settings. + * + */ +#ifndef SETTINGS_CONFIG_PAGE_SIZE +#define SETTINGS_CONFIG_PAGE_SIZE 4096 +#endif + +/** + * @def SETTINGS_CONFIG_PAGE_NUM + * + * The page number of settings. + * + */ +#ifndef SETTINGS_CONFIG_PAGE_NUM +#define SETTINGS_CONFIG_PAGE_NUM 4 +#endif + +/** + * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE + * + * The size of heap buffer when DTLS is enabled. + * + */ +#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE +#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (4096 * sizeof(void *)) +#endif + +/** + * @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS + * + * The size of heap buffer when DTLS is disabled. + * + */ +#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS +#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE_NO_DTLS 2048 +#endif + +/** + * @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE + * + * Define as 1 to enable the time synchronization service feature. + * + */ +#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_CLI_TX_BUFFER_SIZE + * + * The size of CLI message buffer in bytes + * + */ +#ifndef OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE +#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 2048 +#endif + +/** + * @def OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT + * + * Define as 1 to support IEEE 802.15.4-2015 Header IE (Information Element) generation and parsing, it must be set + * to support following features: + * 1. Time synchronization service feature (i.e., OPENTHREAD_CONFIG_TIME_SYNC_ENABLE is set). + * + * @note If it's enabled, plaforms must support interrupt context and concurrent access AES. + * + */ +#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE +#define OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT 1 +#endif + +/* + * Suppress the ARMCC warning on unreachable statement, + * e.g. break after assert(false) or ExitNow() macro. + */ +#if defined(__CC_ARM) +_Pragma("diag_suppress=111") _Pragma("diag_suppress=128") +#endif + +#endif // OPENTHREAD_CORE_NRF52833_CONFIG_H_ diff --git a/examples/platforms/nrf528xx/nrf52833/platform-config.h b/examples/platforms/nrf528xx/nrf52833/platform-config.h new file mode 100644 index 000000000..182c8cc29 --- /dev/null +++ b/examples/platforms/nrf528xx/nrf52833/platform-config.h @@ -0,0 +1,467 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes the platform-specific configuration. + * + */ + +#ifndef PLATFORM_CONFIG_H_ +#define PLATFORM_CONFIG_H_ + +#include "nrf.h" +#include "nrf_peripherals.h" +#include "drivers/clock/nrf_drv_clock.h" +#include "hal/nrf_radio.h" +#include "hal/nrf_uart.h" + +#include "openthread-core-config.h" +#include + +/******************************************************************************* + * @section UART Driver Configuration. + ******************************************************************************/ + +/** + * @def UART_INSTANCE + * + * UART Instance. + * + */ +#ifndef UART_INSTANCE +#define UART_INSTANCE NRF_UART0 +#endif + +/** + * @def UART_PARITY + * + * UART Parity configuration. + * + * @brief Possible values: + * \ref NRF_UART_PARITY_EXCLUDED - Parity bit is not present. + * \ref NRF_UART_PARITY_INCLUDED - Parity bit is present. + * + */ +#ifndef UART_PARITY +#define UART_PARITY NRF_UART_PARITY_EXCLUDED +#endif + +/** + * @def UART_HWFC_ENABLED + * + * Enable UART Hardware Flow Control. + * + */ +#ifndef UART_HWFC_ENABLED +#define UART_HWFC_ENABLED 1 +#endif + +/** + * @def UART_BAUDRATE + * + * UART Baudrate. + * + * @brief Possible values: + * \ref NRF_UART_BAUDRATE_1200 - 1200 baud. + * \ref NRF_UART_BAUDRATE_2400 - 2400 baud. + * \ref NRF_UART_BAUDRATE_4800 - 4800 baud. + * \ref NRF_UART_BAUDRATE_9600 - 9600 baud. + * \ref NRF_UART_BAUDRATE_14400 - 14400 baud. + * \ref NRF_UART_BAUDRATE_19200 - 19200 baud. + * \ref NRF_UART_BAUDRATE_28800 - 28800 baud. + * \ref NRF_UART_BAUDRATE_38400 - 38400 baud. + * \ref NRF_UART_BAUDRATE_57600 - 57600 baud. + * \ref NRF_UART_BAUDRATE_76800 - 76800 baud. + * \ref NRF_UART_BAUDRATE_115200 - 115200 baud. + * \ref NRF_UART_BAUDRATE_230400 - 230400 baud. + * \ref NRF_UART_BAUDRATE_250000 - 250000 baud. + * \ref NRF_UART_BAUDRATE_460800 - 460800 baud. + * \ref NRF_UART_BAUDRATE_921600 - 921600 baud. + * \ref NRF_UART_BAUDRATE_1000000 - 1000000 baud. + * + */ +#ifndef UART_BAUDRATE +#define UART_BAUDRATE NRF_UART_BAUDRATE_115200 +#endif + +/** + * @def UART_IRQN + * + * UART Interrupt number. + * + */ +#ifndef UART_IRQN +#define UART_IRQN UARTE0_UART0_IRQn +#endif + +/** + * @def UART_IRQ_PRIORITY + * + * UART Interrupt priority. + * + */ +#ifndef UART_IRQ_PRIORITY +#define UART_IRQ_PRIORITY 6 +#endif + +/** + * @def UART_RX_BUFFER_SIZE + * + * UART Receive buffer size. + * + */ +#ifndef UART_RX_BUFFER_SIZE +#define UART_RX_BUFFER_SIZE 256 +#endif + +/** + * @def UART_PIN_TX + * + * UART TX Pin. + * + */ +#ifndef UART_PIN_TX +#define UART_PIN_TX 6 +#endif + +/** + * @def UART_PIN_RX + * + * UART RX Pin. + * + */ +#ifndef UART_PIN_RX +#define UART_PIN_RX 8 +#endif + +/** + * @def UART_PIN_CTS + * + * UART CTS Pin. + * + */ +#ifndef UART_PIN_CTS +#define UART_PIN_CTS 7 +#endif + +/** + * @def UART_PIN_RTS + * + * UART RTS Pin. + * + */ +#ifndef UART_PIN_RTS +#define UART_PIN_RTS 5 +#endif + +/******************************************************************************* + * @section Alarm Driver Configuration. + ******************************************************************************/ + +/** + * @def RTC_INSTANCE + * + * RTC Instance. + * + */ +#ifndef RTC_INSTANCE +#define RTC_INSTANCE NRF_RTC2 +#endif + +/** + * @def RTC_IRQ_HANDLER + * + * RTC interrupt handler name + * + */ +#ifndef RTC_IRQ_HANDLER +#define RTC_IRQ_HANDLER RTC2_IRQHandler +#endif + +/** + * @def RTC_IRQN + * + * RTC Interrupt number. + * + */ +#ifndef RTC_IRQN +#define RTC_IRQN RTC2_IRQn +#endif + +/** + * @def RTC_IRQ_PRIORITY + * + * RTC Interrupt priority. + * + */ +#ifndef RTC_IRQ_PRIORITY +#define RTC_IRQ_PRIORITY 6 +#endif + +/******************************************************************************* + * @section Random Number Generator Driver Configuration. + ******************************************************************************/ + +/** + * @def RNG_BUFFER_SIZE + * + * True Random Number Generator buffer size. + * + */ +#ifndef RNG_BUFFER_SIZE +#define RNG_BUFFER_SIZE 128 +#endif + +/** + * @def RNG_IRQ_PRIORITY + * + * RNG Interrupt priority. + * + */ +#ifndef RNG_IRQ_PRIORITY +#define RNG_IRQ_PRIORITY 6 +#endif + +/******************************************************************************* + * @section SPI Slave configuration. + ******************************************************************************/ + +/** + * @def SPIS Instance. + */ +#ifndef SPIS_INSTANCE +#define SPIS_INSTANCE 0 +#endif + +/** + * @def SPIS mode. + * + * @brief Possible values: + * \ref NRF_SPIS_MODE_0 - SCK active high, sample on leading edge of clock. + * \ref NRF_SPIS_MODE_1 - SCK active high, sample on trailing edge of clock. + * \ref NRF_SPIS_MODE_2 - SCK active low, sample on leading edge of clock. + * \ref NRF_SPIS_MODE_3 - SCK active low, sample on trailing edge of clock. + */ +#ifndef SPIS_MODE +#define SPIS_MODE NRF_SPIS_MODE_0 +#endif + +/** + * @def SPIS bit orders. + * + * @brief Possible values: + * \ref NRF_SPIS_BIT_ORDER_MSB_FIRST - Most significant bit shifted out first. + * \ref NRF_SPIS_BIT_ORDER_LSB_FIRST - Least significant bit shifted out first. + */ +#ifndef SPIS_BIT_ORDER +#define SPIS_BIT_ORDER NRF_SPIS_BIT_ORDER_MSB_FIRST +#endif + +/** + * @def SPIS Interrupt priority. + */ +#ifndef SPIS_IRQ_PRIORITY +#define SPIS_IRQ_PRIORITY 6 +#endif + +/** + * @def SPIS MOSI Pin. + */ +#ifndef SPIS_PIN_MOSI +#define SPIS_PIN_MOSI 4 +#endif + +/** + * @def SPIS MISO Pin. + */ +#ifndef SPIS_PIN_MISO +#define SPIS_PIN_MISO 28 +#endif + +/** + * @def SPIS SCK Pin. + */ +#ifndef SPIS_PIN_SCK +#define SPIS_PIN_SCK 3 +#endif + +/** + * @def SPIS CSN Pin. + */ +#ifndef SPIS_PIN_CSN +#define SPIS_PIN_CSN 29 +#endif + +/** + * @def SPIS Host IRQ Pin. + */ +#ifndef SPIS_PIN_HOST_IRQ +#define SPIS_PIN_HOST_IRQ 30 +#endif + +/******************************************************************************* + * @section USB driver configuration. + ******************************************************************************/ + +/** + * @def USB_HOST_UART_CONFIG_DELAY_MS + * + * Delay after DTR gets asserted that we start send any queued data. This allows slow + * Linux-based hosts to have enough time to configure their port for raw mode. + * + */ +#ifndef USB_HOST_UART_CONFIG_DELAY_MS +#define USB_HOST_UART_CONFIG_DELAY_MS 10 +#endif + +/** + * @def USB_CDC_AS_SERIAL_TRANSPORT + * + * Use USB CDC driver for serial communication. + */ +#ifndef USB_CDC_AS_SERIAL_TRANSPORT +#define USB_CDC_AS_SERIAL_TRANSPORT 0 +#endif + +/** + * @def The USB interface to use for CDC ACM COMM. + * + * According to the USB Specification, interface numbers cannot have gaps. Tailor this value to adhere to this + * limitation. Takes values between 0-255. + */ +#ifndef USB_CDC_ACM_COMM_INTERFACE +#define USB_CDC_ACM_COMM_INTERFACE 1 +#endif + +/** + * @def The USB interface to use for CDC ACM DATA. + * + * According to the USB Specification, interface numbers cannot have gaps. Tailor this value to adhere to this + * limitation. Takes values between 0-255. + */ +#ifndef USB_CDC_ACM_DATA_INTERFACE +#define USB_CDC_ACM_DATA_INTERFACE 2 +#endif + +/** + * @def OPENTHREAD_PLATFORM_USE_PSEUDO_RESET + * + * Reset the application, not the chip, when a software reset is requested. + * via `otPlatReset()`. + */ +#ifndef OPENTHREAD_PLATFORM_USE_PSEUDO_RESET +#define OPENTHREAD_PLATFORM_USE_PSEUDO_RESET USB_CDC_AS_SERIAL_TRANSPORT +#endif + +/******************************************************************************* + * @section Platform FEM Configuration + ******************************************************************************/ + +/** + * @def PLATFORM_FEM_ENABLE_DEFAULT_CONFIG + * + * Enable default front end module configuration. + * + */ +#ifndef PLATFORM_FEM_ENABLE_DEFAULT_CONFIG +#define PLATFORM_FEM_ENABLE_DEFAULT_CONFIG 0 +#endif + +/******************************************************************************* + * @section Radio driver configuration. + ******************************************************************************/ + +/** + * @def NRF_802154_PENDING_SHORT_ADDRESSES + * + * Number of slots containing short addresses of nodes for which pending data is stored. + * + */ +#ifndef NRF_802154_PENDING_SHORT_ADDRESSES +#define NRF_802154_PENDING_SHORT_ADDRESSES OPENTHREAD_CONFIG_MLE_MAX_CHILDREN +#endif + +/** + * @def NRF_802154_PENDING_EXTENDED_ADDRESSES + * + * Number of slots containing extended addresses of nodes for which pending data is stored. + * + */ +#ifndef NRF_802154_PENDING_EXTENDED_ADDRESSES +#define NRF_802154_PENDING_EXTENDED_ADDRESSES OPENTHREAD_CONFIG_MLE_MAX_CHILDREN +#endif + +/** + * @def NRF_802154_CSMA_CA_ENABLED + * + * If CSMA-CA procedure should be enabled by the driver. Disabling CSMA-CA procedure improves + * driver performance. + * + */ +#ifndef NRF_802154_CSMA_CA_ENABLED +#define NRF_802154_CSMA_CA_ENABLED 1 +#endif + +/** + * @def NRF_802154_ACK_TIMEOUT_ENABLED + * + * If ACK timeout feature should be enabled in the driver. + * + */ +#ifndef NRF_802154_ACK_TIMEOUT_ENABLED +#define NRF_802154_ACK_TIMEOUT_ENABLED 1 +#endif + +/******************************************************************************* + * @section Temperature sensor driver configuration. + ******************************************************************************/ + +/** + * @def TEMP_MEASUREMENT_INTERVAL + * + * Interval of consecutive temperature measurements [s]. + * + */ +#ifndef TEMP_MEASUREMENT_INTERVAL +#define TEMP_MEASUREMENT_INTERVAL 30 +#endif + +/** + * @def NRF_802154_TX_STARTED_NOTIFY_ENABLED + * + * If notification of started transmission should be enabled in the driver. + * + * @note This feature must be enabled to support Header IE related features. + * + */ +#ifndef NRF_802154_TX_STARTED_NOTIFY_ENABLED +#define NRF_802154_TX_STARTED_NOTIFY_ENABLED 1 +#endif + +#endif // PLATFORM_CONFIG_H_ diff --git a/examples/platforms/nrf528xx/nrf52840/Makefile.am b/examples/platforms/nrf528xx/nrf52840/Makefile.am index e0069f962..9c342f468 100644 --- a/examples/platforms/nrf528xx/nrf52840/Makefile.am +++ b/examples/platforms/nrf528xx/nrf52840/Makefile.am @@ -52,6 +52,7 @@ COMMONCPPFLAGS -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/clock \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/common \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/simple_gpio \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/ack_generator \ diff --git a/examples/platforms/nrf528xx/nrf52840/README.md b/examples/platforms/nrf528xx/nrf52840/README.md index fbb4b55b6..1b6eca2a8 100644 --- a/examples/platforms/nrf528xx/nrf52840/README.md +++ b/examples/platforms/nrf528xx/nrf52840/README.md @@ -531,7 +531,7 @@ The following toolchains have been used for testing and verification: # Nordic Semiconductor's nRF5 SDK for Thread and Zigbee -Use [nRF5 Software Development Kit (SDK) for Thread and Zigbee][nRF5-SDK-Thread-Zigbee] when developing Thread products with Nordic Semiconductor's advanced nRF52840 or nRF52811 SoCs. +Use [nRF5 Software Development Kit (SDK) for Thread and Zigbee][nRF5-SDK-Thread-Zigbee] when developing Thread products with Nordic Semiconductor's advanced nRF52840, nRF52833 or nRF52811 SoCs. The nRF5 SDK for Thread and Zigbee includes: - a pre-built OpenThread stack for the Nordic nRF52840 and nRF52811 SoCs, diff --git a/third_party/Makefile.am b/third_party/Makefile.am index 7bbd29278..01ee07d93 100644 --- a/third_party/Makefile.am +++ b/third_party/Makefile.am @@ -66,6 +66,13 @@ SUBDIRS += \ $(NULL) endif +if OPENTHREAD_EXAMPLES_NRF52833 +SUBDIRS += \ + jlink \ + NordicSemiconductor \ + $(NULL) +endif + if OPENTHREAD_EXAMPLES_NRF52811 SUBDIRS += \ jlink \ diff --git a/third_party/NordicSemiconductor/Makefile.am b/third_party/NordicSemiconductor/Makefile.am index 32344f7cc..0f67f1559 100644 --- a/third_party/NordicSemiconductor/Makefile.am +++ b/third_party/NordicSemiconductor/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2016-2017, The OpenThread Authors. +# Copyright (c) 2016-2019, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -43,6 +43,14 @@ lib_LIBRARIES $(NULL) endif +if OPENTHREAD_EXAMPLES_NRF52833 +lib_LIBRARIES = \ + libnordicsemi-nrf52833-sdk.a \ + libnordicsemi-nrf52833-radio-driver.a \ + libnordicsemi-nrf52833-radio-driver-softdevice.a \ + $(NULL) +endif + # Do not enable -pedantic-errors for Nordic Semiconductor driver library override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS)) override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS)) @@ -59,6 +67,8 @@ COMMONCPPFLAGS -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/clock \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/common \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem \ + -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/simple_gpio \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/hal \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch \ -I$(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/rsch/raal \ @@ -87,6 +97,12 @@ COMMONCPPFLAGS -I$(top_srcdir)/third_party/NordicSemiconductor/softdevice/s140/headers/nrf52 \ $(NULL) +NRF52833_CPPFLAGS = \ + -DNRF52833_XXAA \ + -DNRF_802154_PROJECT_CONFIG=\"platform-config.h\" \ + -I$(top_srcdir)/examples/platforms/nrf52833 \ + $(NULL) + NRF52840_CPPFLAGS = \ -DNRF52840_XXAA \ -DNRF_802154_PROJECT_CONFIG=\"platform-config.h\" \ @@ -129,6 +145,11 @@ NORDICSEMI_USB_SOURCES libraries/usb/class/cdc/acm/app_usbd_cdc_acm.c \ $(NULL) +NORDICSEMI_NRF52833_SOURCES = \ + nrfx/mdk/gcc_startup_nrf52833.S \ + nrfx/mdk/system_nrf52833.c \ + $(NULL) + NORDICSEMI_NRF52840_SOURCES = \ nrfx/mdk/gcc_startup_nrf52840.S \ nrfx/mdk/system_nrf52840.c \ @@ -141,7 +162,6 @@ NORDICSEMI_NRF52811_SOURCES RADIO_DRIVER_SOURCES = \ drivers/radio/fal/nrf_802154_fal.c \ - drivers/radio/fem/nrf_fem_control.c \ drivers/radio/mac_features/ack_generator/nrf_802154_ack_data.c \ drivers/radio/mac_features/ack_generator/nrf_802154_ack_generator.c \ drivers/radio/mac_features/ack_generator/nrf_802154_enh_ack_generator.c \ @@ -151,17 +171,17 @@ RADIO_DRIVER_SOURCES drivers/radio/mac_features/nrf_802154_filter.c \ drivers/radio/mac_features/nrf_802154_frame_parser.c \ drivers/radio/mac_features/nrf_802154_precise_ack_timeout.c \ + drivers/radio/fem/simple_gpio/nrf_fem_simple_gpio.c \ drivers/radio/nrf_802154_core_hooks.c \ drivers/radio/nrf_802154_core.c \ drivers/radio/nrf_802154_critical_section.c \ drivers/radio/nrf_802154_debug.c \ drivers/radio/nrf_802154_pib.c \ - drivers/radio/nrf_802154_revision.c \ drivers/radio/nrf_802154_rssi.c \ drivers/radio/nrf_802154_rx_buffer.c \ drivers/radio/nrf_802154_timer_coord.c \ drivers/radio/nrf_802154.c \ - drivers/radio/platform/clock/nrf_802154_clock_sdk.c \ + drivers/radio/platform/clock/nrf_802154_clock_ot.c \ drivers/radio/platform/hp_timer/nrf_802154_hp_timer.c \ drivers/radio/rsch/nrf_802154_rsch_crit_sect.c \ drivers/radio/rsch/nrf_802154_rsch.c \ @@ -231,6 +251,40 @@ libnordicsemi_nrf52840_radio_driver_softdevice_a_SOURCES $(RADIO_DRIVER_SOFTDEVICE_SOURCES) \ $(NULL) +libnordicsemi_nrf52833_sdk_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(NRF52833_CPPFLAGS) \ + $(NULL) + +libnordicsemi_nrf52833_sdk_a_SOURCES = \ + $(NORDICSEMI_COMMON_SOURCES) \ + $(NORDICSEMI_USB_SOURCES) \ + $(NORDICSEMI_NRF52833_SOURCES) \ + $(NULL) + +libnordicsemi_nrf52833_radio_driver_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(NRF52833_CPPFLAGS) \ + $(RADIO_DRIVER_SINGLE_PHY_CPPFLAGS) \ + $(NULL) + +libnordicsemi_nrf52833_radio_driver_a_SOURCES = \ + $(RADIO_DRIVER_SOURCES) \ + $(RADIO_DRIVER_SINGLE_PHY_SOURCES) \ + $(NULL) + +libnordicsemi_nrf52833_radio_driver_softdevice_a_CPPFLAGS = \ + $(COMMONCPPFLAGS) \ + $(NRF52833_CPPFLAGS) \ + $(SOFTDEVICE_CPPFLAGS) \ + $(RADIO_DRIVER_SOFTDEVICE_CPPFLAGS) \ + $(NULL) + +libnordicsemi_nrf52833_radio_driver_softdevice_a_SOURCES = \ + $(RADIO_DRIVER_SOURCES) \ + $(RADIO_DRIVER_SOFTDEVICE_SOURCES) \ + $(NULL) + libnordicsemi_nrf52811_sdk_a_CPPFLAGS = \ $(COMMONCPPFLAGS) \ $(NRF52811_CPPFLAGS) \ @@ -302,15 +356,15 @@ noinst_HEADERS $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_priority_drop.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_procedures_duration.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_request.h \ - $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_revision.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_rssi.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_rx_buffer.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_timer_coord.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_swi.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/nrf_802154_utils.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fal/nrf_802154_fal.h \ - $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/nrf_fem_control_api.h \ + $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/nrf_fem_protocol_api.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/nrf_fem_control_config.h \ + $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/fem/nrf_fem_protocol_legacy_api.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/nrf_802154_ack_timeout.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/nrf_802154_csma_ca.h \ $(top_srcdir)/third_party/NordicSemiconductor/drivers/radio/mac_features/nrf_802154_filter.h \ @@ -386,11 +440,16 @@ noinst_HEADERS $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf51_to_nrf52810.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52_to_nrf52810.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf51_to_nrf52840.h \ + $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52_to_nrf52833.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52_to_nrf52840.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52810_to_nrf52811.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52811.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52811_bitfields.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52811_peripherals.h \ + $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52833.h \ + $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52833_bitfields.h \ + $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52833_peripherals.h \ + $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/system_nrf52833.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52840.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52840_bitfields.h \ $(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk/nrf52840_peripherals.h \ diff --git a/third_party/NordicSemiconductor/libraries/crypto/nrf52833-mbedtls-config.h b/third_party/NordicSemiconductor/libraries/crypto/nrf52833-mbedtls-config.h new file mode 100644 index 000000000..90672cf90 --- /dev/null +++ b/third_party/NordicSemiconductor/libraries/crypto/nrf52833-mbedtls-config.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NRF52833_MBEDTLS_CONFIG_H_ +#define NRF52833_MBEDTLS_CONFIG_H_ + +#if defined(__ICCARM__) + _Pragma("diag_suppress=Pe550") +#endif + +#if defined(__CC_ARM) + _Pragma("diag_suppress=550") + _Pragma("diag_suppress=68") +#endif + +#endif // NRF52833_MBEDTLS_CONFIG_H_ diff --git a/third_party/jlink/Makefile.am b/third_party/jlink/Makefile.am index 4872e3e4c..5b5f35122 100644 --- a/third_party/jlink/Makefile.am +++ b/third_party/jlink/Makefile.am @@ -32,11 +32,11 @@ lib_LIBRARIES = libjlinkrtt.a libjlinkrtt_a_CPPFLAGS = \ -I$(top_srcdir)/third_party/jlink/SEGGER_RTT_V640/RTT \ - $(NULL) + $(NULL) libjlinkrtt_a_SOURCES = \ SEGGER_RTT_V640/RTT/SEGGER_RTT.c \ - $(NULL) + $(NULL) noinst_HEADERS = \ SEGGER_RTT_V640/RTT/SEGGER_RTT.h \ @@ -55,6 +55,18 @@ libjlinkrtt_a_CPPFLAGS $(NULL) endif +if OPENTHREAD_EXAMPLES_NRF52833 +libjlinkrtt_a_CPPFLAGS += \ + -DNRF52833_XXAA \ + -DSEGGER_RTT_CONFIG_H=\"$(top_srcdir)/third_party/NordicSemiconductor/segger_rtt/SEGGER_RTT_Conf.h\" \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/third_party/NordicSemiconductor/dependencies \ + -I$(top_srcdir)/third_party/NordicSemiconductor/libraries/app_error \ + -I$(top_srcdir)/third_party/NordicSemiconductor/nrfx/mdk \ + -I$(top_srcdir)/third_party/NordicSemiconductor/cmsis \ + $(NULL) +endif + if OPENTHREAD_EXAMPLES_NRF52811 libjlinkrtt_a_CPPFLAGS += \ -DNRF52811_XXAA \