mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
[efr32] add support for EFR32MG13 (#4488)
This commit is contained in:
+7
-2
@@ -824,12 +824,12 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_CUSTOM_LINKER_FILE], [test "${with_custom_link
|
|||||||
|
|
||||||
AC_ARG_WITH(examples,
|
AC_ARG_WITH(examples,
|
||||||
[AS_HELP_STRING([--with-examples=TARGET],
|
[AS_HELP_STRING([--with-examples=TARGET],
|
||||||
[Specify the examples from one of: no, posix, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg21, gp712, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.])],
|
[Specify the examples from one of: no, posix, cc1352, cc2538, cc2650, cc2652, efr32mg12, efr32mg13, efr32mg21, gp712, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.])],
|
||||||
[
|
[
|
||||||
case "${with_examples}" in
|
case "${with_examples}" in
|
||||||
no)
|
no)
|
||||||
;;
|
;;
|
||||||
posix|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg21|gp712|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
|
posix|cc1352|cc2538|cc2650|cc2652|efr32mg12|efr32mg13|efr32mg21|gp712|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
|
||||||
if test ${enable_posix_app} = "yes"; then
|
if test ${enable_posix_app} = "yes"; then
|
||||||
AC_MSG_ERROR([--with-examples must be no when POSIX apps are enabled by --enable-posix-app])
|
AC_MSG_ERROR([--with-examples must be no when POSIX apps are enabled by --enable-posix-app])
|
||||||
fi
|
fi
|
||||||
@@ -849,6 +849,7 @@ AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc25
|
|||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${with_examples}" = "cc2650"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${with_examples}" = "cc2650"])
|
||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2652], [test "${with_examples}" = "cc2652"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2652], [test "${with_examples}" = "cc2652"])
|
||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG12], [test "${with_examples}" = "efr32mg12"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG12], [test "${with_examples}" = "efr32mg12"])
|
||||||
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG13], [test "${with_examples}" = "efr32mg13"])
|
||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG21], [test "${with_examples}" = "efr32mg21"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG21], [test "${with_examples}" = "efr32mg21"])
|
||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"])
|
||||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"])
|
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"])
|
||||||
@@ -995,6 +996,10 @@ examples/platforms/efr32mg12/Makefile
|
|||||||
examples/platforms/efr32mg12/sleepy-demo/Makefile
|
examples/platforms/efr32mg12/sleepy-demo/Makefile
|
||||||
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile
|
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-ftd/Makefile
|
||||||
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile
|
examples/platforms/efr32mg12/sleepy-demo/sleepy-demo-mtd/Makefile
|
||||||
|
examples/platforms/efr32mg13/Makefile
|
||||||
|
examples/platforms/efr32mg13/sleepy-demo/Makefile
|
||||||
|
examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-ftd/Makefile
|
||||||
|
examples/platforms/efr32mg13/sleepy-demo/sleepy-demo-mtd/Makefile
|
||||||
examples/platforms/efr32mg21/Makefile
|
examples/platforms/efr32mg21/Makefile
|
||||||
examples/platforms/efr32mg21/sleepy-demo/Makefile
|
examples/platforms/efr32mg21/sleepy-demo/Makefile
|
||||||
examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile
|
examples/platforms/efr32mg21/sleepy-demo/sleepy-demo-ftd/Makefile
|
||||||
|
|||||||
@@ -0,0 +1,314 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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 = arm-none-eabi-as
|
||||||
|
CPP = arm-none-eabi-cpp
|
||||||
|
CC = arm-none-eabi-gcc
|
||||||
|
CXX = 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
|
||||||
|
|
||||||
|
BuildJobs ?= 10
|
||||||
|
|
||||||
|
configure_OPTIONS = \
|
||||||
|
--enable-cli \
|
||||||
|
--enable-ftd \
|
||||||
|
--enable-mtd \
|
||||||
|
--enable-ncp \
|
||||||
|
--enable-radio-only \
|
||||||
|
--enable-linker-map \
|
||||||
|
--with-examples=efr32mg13 \
|
||||||
|
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
|
||||||
|
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)"
|
||||||
|
endif
|
||||||
|
|
||||||
|
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||||
|
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Differentiate between boards
|
||||||
|
# - BRD4168A / SLWSTK6000B / MGM13P Module / 2.4GHz@19dBm
|
||||||
|
#
|
||||||
|
ifeq ($(BOARD),BRD4168A)
|
||||||
|
MCU = EFR32MG13P732F512GM48
|
||||||
|
else
|
||||||
|
$(error Please provide a value for BOARD variable e.g BOARD=BRD4168A (currently supported BRD4168A))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32mg13/crypto
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/configs
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/CMSIS/Include
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/include
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG13P/Include
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/emlib/inc
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/chip/efr32/efr32xg1x
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
|
||||||
|
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
|
||||||
|
|
||||||
|
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/efr32mg13/
|
||||||
|
HAL_CONF_DIR = $(CONFIG_FILE_PATH)/$(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
|
EFR32MG13_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-efr32-config.h\"'
|
||||||
|
EFR32MG13_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-efr32-config-check.h\"'
|
||||||
|
EFR32MG13_CONFIG_FILE_CPPFLAGS += -I$(CONFIG_FILE_PATH)
|
||||||
|
|
||||||
|
COMMONCFLAGS := \
|
||||||
|
-fdata-sections \
|
||||||
|
-ffunction-sections \
|
||||||
|
-Os \
|
||||||
|
-g \
|
||||||
|
-I$(HAL_CONF_DIR) \
|
||||||
|
-D__START=main \
|
||||||
|
-D$(MCU) \
|
||||||
|
$(EFR32MG13_CONFIG_FILE_CPPFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||||
|
|
||||||
|
#
|
||||||
|
# Platform-Specific switches
|
||||||
|
#
|
||||||
|
|
||||||
|
DMP ?= 0
|
||||||
|
RADIODEBUG ?= 0
|
||||||
|
|
||||||
|
ifeq ($(DMP),1)
|
||||||
|
COMMONCFLAGS += -DRADIO_CONFIG_DMP_SUPPORT=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(RADIODEBUG),1)
|
||||||
|
COMMONCFLAGS += -DRADIO_CONFIG_DEBUG_COUNTERS_SUPPORT=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
CPPFLAGS += \
|
||||||
|
$(COMMONCFLAGS) \
|
||||||
|
$(target_CPPFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
$(COMMONCFLAGS) \
|
||||||
|
$(target_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CXXFLAGS += \
|
||||||
|
$(COMMONCFLAGS) \
|
||||||
|
$(target_CXXFLAGS) \
|
||||||
|
-fno-exceptions \
|
||||||
|
-fno-rtti \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDFLAGS += \
|
||||||
|
$(COMMONCFLAGS) \
|
||||||
|
$(target_LDFLAGS) \
|
||||||
|
-nostartfiles \
|
||||||
|
-specs=nano.specs \
|
||||||
|
-specs=nosys.specs \
|
||||||
|
-Wl,--gc-sections \
|
||||||
|
$(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 = efr32mg13
|
||||||
|
|
||||||
|
ARCHS = cortex-m4
|
||||||
|
|
||||||
|
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
|
||||||
|
|
||||||
|
ifndef BuildJobs
|
||||||
|
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
|
||||||
|
endif
|
||||||
|
JOBSFLAG := -j$(BuildJobs)
|
||||||
|
|
||||||
|
#
|
||||||
|
# configure-arch <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)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||||
|
--host=arm-none-eabi \
|
||||||
|
--prefix=/ \
|
||||||
|
--exec-prefix=/$(TargetTuple) \
|
||||||
|
$(configure_OPTIONS))
|
||||||
|
endef # configure-arch
|
||||||
|
|
||||||
|
#
|
||||||
|
# build-arch <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 <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 <arch>
|
||||||
|
#
|
||||||
|
# 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): $(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=soft -mthumb
|
||||||
|
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
|
||||||
|
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
|
||||||
|
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mfloat-abi=soft -mthumb
|
||||||
|
|
||||||
|
# Instantiate an architecture-specific build template for each target
|
||||||
|
# architecture.
|
||||||
|
|
||||||
|
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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)) <architecture>"
|
||||||
|
$(ECHO) ""
|
||||||
@@ -36,6 +36,7 @@ DIST_SUBDIRS = \
|
|||||||
cc2650 \
|
cc2650 \
|
||||||
cc2652 \
|
cc2652 \
|
||||||
efr32mg12 \
|
efr32mg12 \
|
||||||
|
efr32mg13 \
|
||||||
efr32mg21 \
|
efr32mg21 \
|
||||||
gp712 \
|
gp712 \
|
||||||
kw41z \
|
kw41z \
|
||||||
@@ -72,6 +73,10 @@ if OPENTHREAD_EXAMPLES_EFR32MG12
|
|||||||
SUBDIRS += efr32mg12
|
SUBDIRS += efr32mg12
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_EXAMPLES_EFR32MG13
|
||||||
|
SUBDIRS += efr32mg13
|
||||||
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_EXAMPLES_EFR32MG21
|
if OPENTHREAD_EXAMPLES_EFR32MG21
|
||||||
SUBDIRS += efr32mg21
|
SUBDIRS += efr32mg21
|
||||||
endif
|
endif
|
||||||
@@ -112,6 +117,7 @@ PRETTY_SUBDIRS = \
|
|||||||
cc2650 \
|
cc2650 \
|
||||||
cc2652 \
|
cc2652 \
|
||||||
efr32mg12 \
|
efr32mg12 \
|
||||||
|
efr32mg13 \
|
||||||
efr32mg21 \
|
efr32mg21 \
|
||||||
gp712 \
|
gp712 \
|
||||||
kw41z \
|
kw41z \
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ if OPENTHREAD_EXAMPLES_EFR32MG12
|
|||||||
include $(top_srcdir)/examples/platforms/efr32mg12/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/efr32mg12/Makefile.platform.am
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_EXAMPLES_EFR32MG13
|
||||||
|
include $(top_srcdir)/examples/platforms/efr32mg13/Makefile.platform.am
|
||||||
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_EXAMPLES_EFR32MG21
|
if OPENTHREAD_EXAMPLES_EFR32MG21
|
||||||
include $(top_srcdir)/examples/platforms/efr32mg21/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/efr32mg21/Makefile.platform.am
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -28,26 +28,26 @@
|
|||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
|
|
||||||
lib_LIBRARIES = libopenthread-efr32mg12.a
|
lib_LIBRARIES = libopenthread-efr32mg12.a
|
||||||
|
|
||||||
# Do not enable -Wconversion for rail
|
# Do not enable -Wconversion for rail
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -pedantic-errors for rail
|
# Do not enable -pedantic-errors for rail
|
||||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -Wundef for rail
|
# Do not enable -Wundef for rail
|
||||||
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
libopenthread_efr32mg12_a_CPPFLAGS = \
|
libopenthread_efr32mg12_a_CPPFLAGS = \
|
||||||
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-DCORTEXM3 \
|
-DCORTEXM3 \
|
||||||
@@ -55,42 +55,42 @@ libopenthread_efr32mg12_a_CPPFLAGS =
|
|||||||
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
-DCORTEXM3_EFM32_MICRO \
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR) \
|
-I$(SDK_SRC_DIR) \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/mpu/inc \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@@ -127,7 +127,7 @@ PRETTY_FILES =
|
|||||||
$(PLATFORM_SOURCES) \
|
$(PLATFORM_SOURCES) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
Dash = -
|
Dash = -
|
||||||
libopenthread_efr32mg12_a_LIBADD = \
|
libopenthread_efr32mg12_a_LIBADD = \
|
||||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o") \
|
$(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")
|
$(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
|
||||||
|
|||||||
@@ -29,130 +29,126 @@
|
|||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
|
$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
|
||||||
(cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
|
(cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-I$(top_srcdir)/include \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
-I$(top_srcdir)/src/core \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-I$(top_srcdir)/examples/platforms \
|
|
||||||
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-DCORTEXM3 \
|
-DCORTEXM3 \
|
||||||
-D__START=main \
|
|
||||||
-DPHY=EMBER_PHY_RAIL \
|
-DPHY=EMBER_PHY_RAIL \
|
||||||
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
-DCORTEXM3_EFM32_MICRO \
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
-D__STARTUP_CLEAR_BSS \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread/stack \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDFLAGS_COMMON += \
|
LDFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBTOOLFLAGS_COMMON += \
|
LIBTOOLFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SOURCES_COMMON += \
|
SOURCES_COMMON += \
|
||||||
main.c \
|
main.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_EXECUTABLE
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
bin_PROGRAMS += \
|
bin_PROGRAMS += \
|
||||||
sleepy-demo-ftd \
|
sleepy-demo-ftd \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sleepy_demo_ftd_CPPFLAGS = \
|
sleepy_demo_ftd_CPPFLAGS = \
|
||||||
$(CPPFLAGS_COMMON) \
|
$(CPPFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LDADD = \
|
sleepy_demo_ftd_LDADD = \
|
||||||
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
||||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LDFLAGS = \
|
sleepy_demo_ftd_LDFLAGS = \
|
||||||
$(LDFLAGS_COMMON) \
|
$(LDFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LIBTOOLFLAGS = \
|
sleepy_demo_ftd_LIBTOOLFLAGS = \
|
||||||
$(LIBTOOLFLAGS_COMMON) \
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_SOURCES = \
|
sleepy_demo_ftd_SOURCES = \
|
||||||
$(SOURCES_COMMON) \
|
$(SOURCES_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_LINKER_MAP
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
|
sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_BUILD_COVERAGE
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-DOPENTHREAD_ENABLE_COVERAGE \
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
endif # OPENTHREAD_BUILD_COVERAGE
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
|
|||||||
@@ -29,130 +29,126 @@
|
|||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
|
$(top_builddir)/examples/platforms/efr32mg12/libopenthread-efr32mg12.a:
|
||||||
(cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
|
(cd $(top_builddir)/examples/platforms/efr32mg12/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg12.a )
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-I$(top_srcdir)/include \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
-I$(top_srcdir)/src/core \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-I$(top_srcdir)/examples/platforms \
|
|
||||||
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-DCORTEXM3 \
|
-DCORTEXM3 \
|
||||||
-D__START=main \
|
|
||||||
-DPHY=EMBER_PHY_RAIL \
|
-DPHY=EMBER_PHY_RAIL \
|
||||||
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
-DCORTEXM3_EFM32_MICRO \
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
-D__STARTUP_CLEAR_BSS \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg12/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread/stack \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDFLAGS_COMMON += \
|
LDFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBTOOLFLAGS_COMMON += \
|
LIBTOOLFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SOURCES_COMMON += \
|
SOURCES_COMMON += \
|
||||||
main.c \
|
main.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_EXECUTABLE
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
bin_PROGRAMS += \
|
bin_PROGRAMS += \
|
||||||
sleepy-demo-mtd \
|
sleepy-demo-mtd \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sleepy_demo_mtd_CPPFLAGS = \
|
sleepy_demo_mtd_CPPFLAGS = \
|
||||||
$(CPPFLAGS_COMMON) \
|
$(CPPFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LDADD = \
|
sleepy_demo_mtd_LDADD = \
|
||||||
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
||||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LDFLAGS = \
|
sleepy_demo_mtd_LDFLAGS = \
|
||||||
$(LDFLAGS_COMMON) \
|
$(LDFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LIBTOOLFLAGS = \
|
sleepy_demo_mtd_LIBTOOLFLAGS = \
|
||||||
$(LIBTOOLFLAGS_COMMON) \
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_SOURCES = \
|
sleepy_demo_mtd_SOURCES = \
|
||||||
$(SOURCES_COMMON) \
|
$(SOURCES_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_LINKER_MAP
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
|
sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_BUILD_COVERAGE
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-DOPENTHREAD_ENABLE_COVERAGE \
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
endif # OPENTHREAD_BUILD_COVERAGE
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
|
|||||||
@@ -0,0 +1,147 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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-efr32mg13.a
|
||||||
|
|
||||||
|
# Do not enable -Wconversion for rail
|
||||||
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
|
# Do not enable -pedantic-errors for rail
|
||||||
|
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||||
|
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||||
|
|
||||||
|
# Do not enable -Wundef for rail
|
||||||
|
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
||||||
|
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
||||||
|
|
||||||
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
|
libopenthread_efr32mg13_a_CPPFLAGS = \
|
||||||
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
|
-Wno-sign-compare \
|
||||||
|
-DCORTEXM3 \
|
||||||
|
-DPHY=EMBER_PHY_RAIL \
|
||||||
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
|
-I$(top_srcdir)/examples/platforms \
|
||||||
|
-I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
|
-I$(top_srcdir)/src/core \
|
||||||
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
|
-I$(SDK_SRC_DIR) \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-missing-field-initializers \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
PLATFORM_SOURCES = \
|
||||||
|
alarm.c \
|
||||||
|
diag.c \
|
||||||
|
entropy.c \
|
||||||
|
fem-control.c \
|
||||||
|
flash.c \
|
||||||
|
logging.c \
|
||||||
|
misc.c \
|
||||||
|
openthread-core-efr32-config.h \
|
||||||
|
openthread-core-efr32-config-check.h \
|
||||||
|
platform-efr32.h \
|
||||||
|
platform-band.h \
|
||||||
|
radio.c \
|
||||||
|
rail_config.h \
|
||||||
|
startup-gcc.c \
|
||||||
|
system.c \
|
||||||
|
uart.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
noinst_HEADERS = \
|
||||||
|
platform-efr32.h \
|
||||||
|
platform-band.h \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
libopenthread_efr32mg13_a_SOURCES = \
|
||||||
|
$(PLATFORM_SOURCES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
PRETTY_FILES = \
|
||||||
|
$(PLATFORM_SOURCES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
Dash = -
|
||||||
|
libopenthread_efr32mg13_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")
|
||||||
|
|
||||||
|
DIST_SUBDIRS = \
|
||||||
|
sleepy-demo \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
SUBDIRS = \
|
||||||
|
sleepy-demo \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
PRETTY_SUBDIRS = \
|
||||||
|
sleepy-demo \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# efr32mg13 platform-specific Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
LIBRAIL = $(shell \
|
||||||
|
if [ "$(DMP)" = "1" ]; then \
|
||||||
|
echo "librail_multiprotocol_efr32xg13_gcc_release.a"; \
|
||||||
|
else \
|
||||||
|
echo "librail_efr32xg13_gcc_release.a"; \
|
||||||
|
fi )
|
||||||
|
|
||||||
|
LDADD_COMMON += \
|
||||||
|
$(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a \
|
||||||
|
$(top_builddir)/third_party/silabs/libsilabs-efr32mg13-sdk.a \
|
||||||
|
$(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/radio/rail_lib/autogen/librail_release/$(LIBRAIL) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDFLAGS_COMMON += \
|
||||||
|
-T $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG13P/Source/GCC/efr32mg13p.ld \
|
||||||
|
$(NULL)
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
# OpenThread on EFR32MG13 Example
|
||||||
|
|
||||||
|
This directory contains example platform drivers for the [Silicon Labs EFR32MG13][efr32mg13]
|
||||||
|
based on [EFR32™ Mighty Gecko Wireless Starter Kit][SLWSTK6000B].
|
||||||
|
|
||||||
|
[efr32mg]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc
|
||||||
|
[SLWSTK6000B]: http://www.silabs.com/products/development-tools/wireless/mesh-networking/mighty-gecko-starter-kit
|
||||||
|
|
||||||
|
The example platform drivers are intended to present the minimal code
|
||||||
|
necessary to support OpenThread. [EFR32MG13P SoC][efr32mg13p]
|
||||||
|
has rich memory and peripheral resources which can support all OpenThread
|
||||||
|
capabilities. See the "Run the example with EFR32MG13 boards" section below
|
||||||
|
for an example using basic OpenThread capabilities.
|
||||||
|
|
||||||
|
See [sleepy-demo/README.md](sleepy-demo/README.md) for instructions for an example that uses the low-energy
|
||||||
|
modes of the EFR32MG13 when running as a Sleepy End Device.
|
||||||
|
|
||||||
|
[efr32mg13p]: http://www.silabs.com/products/wireless/mesh-networking/efr32mg-mighty-gecko-zigbee-thread-soc/device.EFR32MG13P432F1024GL125
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
|
||||||
|
Download and install the [GNU toolchain for ARM Cortex-M][gnu-toolchain].
|
||||||
|
|
||||||
|
[gnu-toolchain]: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
|
||||||
|
|
||||||
|
In a Bash terminal, follow these instructions to install the GNU toolchain and
|
||||||
|
other dependencies.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>
|
||||||
|
$ ./script/bootstrap
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build Examples
|
||||||
|
|
||||||
|
1. Download and install the [Simplicity Studio][simplicity_studio].
|
||||||
|
|
||||||
|
[simplicity_studio]: http://www.silabs.com/products/development-tools/software/simplicity-studio
|
||||||
|
|
||||||
|
2. Install Flex (Gecko) SDK including RAIL Library from Simplicity Studio.
|
||||||
|
- Connect EFR32MG13P Wireless Starter Kit to Simplicity Studio.
|
||||||
|
- Find Flex SDK v2.7 in the Software Update page and click Install.
|
||||||
|
- Flex SDK v2.7 will be installed in the path: `/SimplicityStudio_v4/developer/sdks/gecko_sdk_suite`.
|
||||||
|
|
||||||
|
For more information on configuring, building, and installing applications for the Wireless Gecko (EFR32)
|
||||||
|
portfolio using FLEX, see [Getting Started with the Silicon Labs Flex Software Development Kit for the
|
||||||
|
Wireless Gecko (EFR32™) Portfolio][QSG138]. For more information
|
||||||
|
on RAIL, see [Radio Abstraction Interface Layer][rail].
|
||||||
|
|
||||||
|
[QSG138]: https://www.silabs.com/documents/public/quick-start-guides/qsg138-flex-efr32.pdf
|
||||||
|
[rail]: http://www.silabs.com/products/development-tools/software/radio-abstraction-interface-layer-sdk
|
||||||
|
|
||||||
|
3. Configure the path to Flex SDK source code.
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>/third_party
|
||||||
|
$ mkdir silabs
|
||||||
|
$ cd <path-to-Simplicity-Studio>/developer/sdks
|
||||||
|
$ cp -rf gecko_sdk_suite <path-to-openthread>/third_party/silabs/
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively create a symbolic link to the Flex SDK source code.
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>/third_party
|
||||||
|
$ mkdir silabs
|
||||||
|
$ ln -s <path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite silabs/gecko_sdk_suite
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Build OpenThread Firmware (CLI example) on EFR32 platform.
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>
|
||||||
|
$ ./bootstrap
|
||||||
|
```
|
||||||
|
For EFR32MG13™ Mighty Gecko Wireless Starter Kit:
|
||||||
|
```bash
|
||||||
|
$ make -f examples/Makefile-efr32mg13 BOARD=BRD4168A
|
||||||
|
```
|
||||||
|
|
||||||
|
After a successful build, the `elf` files are found in
|
||||||
|
`<path-to-openthread>/output/efr32mg13/bin`.
|
||||||
|
|
||||||
|
## Flash Binaries
|
||||||
|
|
||||||
|
Compiled binaries may be flashed onto the EFR32 using [JLinkGDBServer][jlinkgdbserver].
|
||||||
|
EFR32 Starter kit mainboard integrates an on-board SEGGER J-Link debugger.
|
||||||
|
|
||||||
|
[jlinkgdbserver]: https://www.segger.com/jlink-gdb-server.html
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-JLinkGDBServer>
|
||||||
|
$ sudo ./JLinkGDBServer -if swd -device EFR32MG13PxxxF1024
|
||||||
|
$ cd <path-to-openthread>/output/efr32/bin
|
||||||
|
$ arm-none-eabi-gdb ot-cli-ftd
|
||||||
|
$ (gdb) target remote 127.0.0.1:2331
|
||||||
|
$ (gdb) load
|
||||||
|
$ (gdb) monitor reset
|
||||||
|
$ (gdb) c
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: Support for the "EFR32MG13PxxxF1024" device was added to JLinkGDBServer V6.14d.
|
||||||
|
|
||||||
|
Or
|
||||||
|
Compiled binaries also may be flashed onto the specified EFR32 dev board using [J-Link Commander][j-link-commander].
|
||||||
|
|
||||||
|
[j-link-commander]: https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>/output/efr32mg13/bin
|
||||||
|
$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.hex
|
||||||
|
$ JLinkExe -device EFR32MG13PxxxF1024 -speed 4000 -if SWD -autoconnect 1 -SelectEmuBySN <SerialNo>
|
||||||
|
$ J-Link>loadfile ot-cli-ftd.hex
|
||||||
|
$ J-Link>r
|
||||||
|
$ J-Link>q
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: SerialNo is J-Link serial number. Use the following command to get the serial number of the connected J-Link.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ JLinkExe
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively Simplicity Commander provides a graphical interface for J-Link Commander.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>/output/efr32mg13/bin
|
||||||
|
$ arm-none-eabi-objcopy -O ihex ot-cli-ftd ot-cli-ftd.ihex
|
||||||
|
$ <path-to-simplicity-studio>/developer/adapter_packs/commander/commander
|
||||||
|
```
|
||||||
|
|
||||||
|
In the J-Link Device drop-down list select the serial number of the device to flash. Click the Adapter Connect button.
|
||||||
|
Esnure the Debug Interface drop-down list is set to SWD and click the Target Connect button.
|
||||||
|
Click on the Flash icon on the left side of the window to switch to the flash page.
|
||||||
|
In the Flash MCU pane enter the path of the ot-cli-ftd.s37 file or choose the file with the Browse... button.
|
||||||
|
Click the Flash button located under the Browse... button.
|
||||||
|
|
||||||
|
## Run the example with EFR32MG13 boards
|
||||||
|
1. Flash two EFR32 boards with the `CLI example` firmware (as shown above).
|
||||||
|
2. Open terminal to first device `/dev/ttyACM0` (serial port settings: 115200 8-N-1).
|
||||||
|
Type `help` for a list of commands.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> help
|
||||||
|
help
|
||||||
|
channel
|
||||||
|
childtimeout
|
||||||
|
contextreusedelay
|
||||||
|
extaddr
|
||||||
|
extpanid
|
||||||
|
ipaddr
|
||||||
|
keysequence
|
||||||
|
leaderweight
|
||||||
|
masterkey
|
||||||
|
mode
|
||||||
|
netdataregister
|
||||||
|
networkidtimeout
|
||||||
|
networkname
|
||||||
|
panid
|
||||||
|
ping
|
||||||
|
prefix
|
||||||
|
releaserouterid
|
||||||
|
rloc16
|
||||||
|
route
|
||||||
|
routerupgradethreshold
|
||||||
|
scan
|
||||||
|
start
|
||||||
|
state
|
||||||
|
stop
|
||||||
|
whitelist
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Start a Thread network as Leader.
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
|
wait a couple of seconds...
|
||||||
|
|
||||||
|
> state
|
||||||
|
leader
|
||||||
|
Done
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Open terminal to second device `/dev/ttyACM1` (serial port settings: 115200 8-N-1)
|
||||||
|
and attach it to the Thread network as a Router.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
|
||||||
|
Done
|
||||||
|
> dataset commit active
|
||||||
|
Done
|
||||||
|
> routerselectionjitter 1
|
||||||
|
Done
|
||||||
|
> ifconfig up
|
||||||
|
Done
|
||||||
|
> thread start
|
||||||
|
Done
|
||||||
|
|
||||||
|
wait a couple of seconds...
|
||||||
|
|
||||||
|
> state
|
||||||
|
router
|
||||||
|
Done
|
||||||
|
```
|
||||||
|
|
||||||
|
5. List all IPv6 addresses of Leader.
|
||||||
|
|
||||||
|
```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. Send an ICMPv6 ping to Leader's Mesh-EID IPv6 address.
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
|
The above example demonstrates basic OpenThread capabilities. Enable more features/roles (e.g. commissioner,
|
||||||
|
joiner, DHCPv6 Server/Client, etc.) by assigning compile-options before compiling.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>
|
||||||
|
$ ./bootstrap
|
||||||
|
$ make -f examples/Makefile-efr32mg13 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1
|
||||||
|
```
|
||||||
|
|
||||||
|
For a list of all available commands, visit [OpenThread CLI Reference README.md][CLI].
|
||||||
|
|
||||||
|
[CLI]: https://github.com/openthread/openthread/blob/master/src/cli/README.md
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
The following toolchain has been used for testing and verification:
|
||||||
|
- gcc version 7.3.1
|
||||||
|
|
||||||
|
The EFR32 example has been verified with following Flex SDK/RAIL Library version:
|
||||||
|
- Flex SDK version 2.7.0.0
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements the OpenThread platform abstraction for the alarm.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "openthread-system.h"
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/platform/alarm-milli.h>
|
||||||
|
#include <openthread/platform/diag.h>
|
||||||
|
#include "common/logging.hpp"
|
||||||
|
|
||||||
|
#include "platform-efr32.h"
|
||||||
|
#include "utils/code_utils.h"
|
||||||
|
|
||||||
|
#include "em_core.h"
|
||||||
|
#include "rail.h"
|
||||||
|
#include "sl_sleeptimer.h"
|
||||||
|
|
||||||
|
#define XTAL_ACCURACY 200
|
||||||
|
|
||||||
|
static sl_sleeptimer_timer_handle_t sl_handle;
|
||||||
|
static uint32_t sAlarm = 0;
|
||||||
|
static bool sIsRunning = false;
|
||||||
|
|
||||||
|
static void AlarmCallback(sl_sleeptimer_timer_handle_t *aHandle, void *aData)
|
||||||
|
{
|
||||||
|
otSysEventSignalPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32AlarmInit(void)
|
||||||
|
{
|
||||||
|
memset(&sl_handle, 0, sizeof sl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t otPlatAlarmMilliGetNow(void)
|
||||||
|
{
|
||||||
|
uint64_t ticks;
|
||||||
|
uint64_t now;
|
||||||
|
sl_status_t status;
|
||||||
|
|
||||||
|
ticks = sl_sleeptimer_get_tick_count64();
|
||||||
|
status = sl_sleeptimer_tick64_to_ms(ticks, &now);
|
||||||
|
assert(status == SL_STATUS_OK);
|
||||||
|
return (uint32_t)now;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t otPlatTimeGetXtalAccuracy(void)
|
||||||
|
{
|
||||||
|
return XTAL_ACCURACY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
sl_status_t status;
|
||||||
|
int32_t remaining;
|
||||||
|
uint32_t ticks;
|
||||||
|
|
||||||
|
sl_sleeptimer_stop_timer(&sl_handle);
|
||||||
|
|
||||||
|
sAlarm = aT0 + aDt;
|
||||||
|
remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
|
||||||
|
sIsRunning = true;
|
||||||
|
|
||||||
|
if (remaining <= 0)
|
||||||
|
{
|
||||||
|
otSysEventSignalPending();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = sl_sleeptimer_ms32_to_tick(remaining, &ticks);
|
||||||
|
assert(status == SL_STATUS_OK);
|
||||||
|
|
||||||
|
status = sl_sleeptimer_start_timer(&sl_handle, ticks, AlarmCallback, NULL, 0,
|
||||||
|
SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG);
|
||||||
|
assert(status == SL_STATUS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatAlarmMilliStop(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
|
sl_sleeptimer_stop_timer(&sl_handle);
|
||||||
|
sIsRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32AlarmProcess(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
int32_t remaining;
|
||||||
|
|
||||||
|
if (sIsRunning)
|
||||||
|
{
|
||||||
|
remaining = (int32_t)(sAlarm - otPlatAlarmMilliGetNow());
|
||||||
|
|
||||||
|
if (remaining <= 0)
|
||||||
|
{
|
||||||
|
sIsRunning = false;
|
||||||
|
|
||||||
|
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||||
|
if (otPlatDiagModeGet())
|
||||||
|
{
|
||||||
|
otPlatDiagAlarmFired(aInstance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
otPlatAlarmMilliFired(aInstance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 dev borad compile-time configuration constants for efr32.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __BOARD_CONFIG_H__
|
||||||
|
#define __BOARD_CONFIG_H__
|
||||||
|
|
||||||
|
#define RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT 1 /// Dev board suppports OQPSK modulation in 2.4GHz band.
|
||||||
|
|
||||||
|
#ifndef RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT
|
||||||
|
#define RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT 0 /// Set to 1 to enable debug counters in radio.c
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RADIO_CONFIG_DMP_SUPPORT
|
||||||
|
#define RADIO_CONFIG_DMP_SUPPORT 0 /// Set to 1 to enable Dynamic Multi-Protocol support in radio.c
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __BOARD_CONFIG_H__
|
||||||
@@ -0,0 +1,445 @@
|
|||||||
|
#ifndef HAL_CONFIG_BOARD_H
|
||||||
|
#define HAL_CONFIG_BOARD_H
|
||||||
|
|
||||||
|
#include "em_device.h"
|
||||||
|
#include "hal-config-types.h"
|
||||||
|
|
||||||
|
// This file is auto-generated by Hardware Configurator in Simplicity Studio.
|
||||||
|
// Any content between $[ and ]$ will be replaced whenever the file is regenerated.
|
||||||
|
// Content outside these regions will be preserved.
|
||||||
|
|
||||||
|
// $[ACMP0]
|
||||||
|
// [ACMP0]$
|
||||||
|
|
||||||
|
// $[ACMP1]
|
||||||
|
// [ACMP1]$
|
||||||
|
|
||||||
|
// $[ADC0]
|
||||||
|
// [ADC0]$
|
||||||
|
|
||||||
|
// $[ANTDIV]
|
||||||
|
// [ANTDIV]$
|
||||||
|
|
||||||
|
// $[BATTERYMON]
|
||||||
|
|
||||||
|
// [BATTERYMON]$
|
||||||
|
|
||||||
|
// $[BTL_BUTTON]
|
||||||
|
|
||||||
|
#define BSP_BTL_BUTTON_PIN (6U)
|
||||||
|
#define BSP_BTL_BUTTON_PORT (gpioPortF)
|
||||||
|
|
||||||
|
// [BTL_BUTTON]$
|
||||||
|
|
||||||
|
// $[BULBPWM]
|
||||||
|
// [BULBPWM]$
|
||||||
|
|
||||||
|
// $[BULBPWM_COLOR]
|
||||||
|
// [BULBPWM_COLOR]$
|
||||||
|
|
||||||
|
// $[BUTTON]
|
||||||
|
#define BSP_BUTTON_PRESENT (1)
|
||||||
|
|
||||||
|
#define BSP_BUTTON0_PIN (6U)
|
||||||
|
#define BSP_BUTTON0_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_BUTTON1_PIN (7U)
|
||||||
|
#define BSP_BUTTON1_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_BUTTON_COUNT (2U)
|
||||||
|
#define BSP_BUTTON_INIT { { BSP_BUTTON0_PORT, BSP_BUTTON0_PIN }, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN } }
|
||||||
|
#define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
|
||||||
|
#define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
|
||||||
|
// [BUTTON]$
|
||||||
|
|
||||||
|
// $[CMU]
|
||||||
|
#define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
|
||||||
|
#define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
|
||||||
|
#define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
|
||||||
|
|
||||||
|
#define BSP_CLK_HFXO_PRESENT (1)
|
||||||
|
#define BSP_CLK_HFXO_FREQ (38400000UL)
|
||||||
|
#define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
|
||||||
|
#define BSP_CLK_HFXO_CTUNE (330)
|
||||||
|
#define BSP_CLK_LFXO_PRESENT (1)
|
||||||
|
#define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
|
||||||
|
#define BSP_CLK_LFXO_FREQ (32768U)
|
||||||
|
#define BSP_CLK_LFXO_CTUNE (32U)
|
||||||
|
// [CMU]$
|
||||||
|
|
||||||
|
// $[COEX]
|
||||||
|
// [COEX]$
|
||||||
|
|
||||||
|
// $[CS5463]
|
||||||
|
// [CS5463]$
|
||||||
|
|
||||||
|
// $[CSEN]
|
||||||
|
// [CSEN]$
|
||||||
|
|
||||||
|
// $[DCDC]
|
||||||
|
#define BSP_DCDC_PRESENT (1)
|
||||||
|
|
||||||
|
#define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
|
||||||
|
// [DCDC]$
|
||||||
|
|
||||||
|
// $[EMU]
|
||||||
|
// [EMU]$
|
||||||
|
|
||||||
|
// $[EXTFLASH]
|
||||||
|
#define BSP_EXTFLASH_CS_PIN (4U)
|
||||||
|
#define BSP_EXTFLASH_CS_PORT (gpioPortA)
|
||||||
|
|
||||||
|
#define BSP_EXTFLASH_INTERNAL (0)
|
||||||
|
#define BSP_EXTFLASH_USART (HAL_SPI_PORT_USART1)
|
||||||
|
#define BSP_EXTFLASH_MOSI_PIN (6U)
|
||||||
|
#define BSP_EXTFLASH_MOSI_PORT (gpioPortC)
|
||||||
|
#define BSP_EXTFLASH_MOSI_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_EXTFLASH_MISO_PIN (7U)
|
||||||
|
#define BSP_EXTFLASH_MISO_PORT (gpioPortC)
|
||||||
|
#define BSP_EXTFLASH_MISO_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_EXTFLASH_CLK_PIN (8U)
|
||||||
|
#define BSP_EXTFLASH_CLK_PORT (gpioPortC)
|
||||||
|
#define BSP_EXTFLASH_CLK_LOC (11U)
|
||||||
|
|
||||||
|
// [EXTFLASH]$
|
||||||
|
|
||||||
|
// $[EZRADIOPRO]
|
||||||
|
// [EZRADIOPRO]$
|
||||||
|
|
||||||
|
// $[FEM]
|
||||||
|
// [FEM]$
|
||||||
|
|
||||||
|
// $[GPIO]
|
||||||
|
#define PORTIO_GPIO_SWV_PIN (2U)
|
||||||
|
#define PORTIO_GPIO_SWV_PORT (gpioPortF)
|
||||||
|
#define PORTIO_GPIO_SWV_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_TRACE_SWO_PIN (2U)
|
||||||
|
#define BSP_TRACE_SWO_PORT (gpioPortF)
|
||||||
|
#define BSP_TRACE_SWO_LOC (0U)
|
||||||
|
|
||||||
|
// [GPIO]$
|
||||||
|
|
||||||
|
// $[I2C0]
|
||||||
|
#define PORTIO_I2C0_SCL_PIN (10U)
|
||||||
|
#define PORTIO_I2C0_SCL_PORT (gpioPortC)
|
||||||
|
#define PORTIO_I2C0_SCL_LOC (14U)
|
||||||
|
|
||||||
|
#define PORTIO_I2C0_SDA_PIN (11U)
|
||||||
|
#define PORTIO_I2C0_SDA_PORT (gpioPortC)
|
||||||
|
#define PORTIO_I2C0_SDA_LOC (16U)
|
||||||
|
|
||||||
|
#define BSP_I2C0_SCL_PIN (10U)
|
||||||
|
#define BSP_I2C0_SCL_PORT (gpioPortC)
|
||||||
|
#define BSP_I2C0_SCL_LOC (14U)
|
||||||
|
|
||||||
|
#define BSP_I2C0_SDA_PIN (11U)
|
||||||
|
#define BSP_I2C0_SDA_PORT (gpioPortC)
|
||||||
|
#define BSP_I2C0_SDA_LOC (16U)
|
||||||
|
|
||||||
|
// [I2C0]$
|
||||||
|
|
||||||
|
// $[I2C1]
|
||||||
|
// [I2C1]$
|
||||||
|
|
||||||
|
// $[I2CSENSOR]
|
||||||
|
|
||||||
|
#define BSP_I2CSENSOR_ENABLE_PIN (15U)
|
||||||
|
#define BSP_I2CSENSOR_ENABLE_PORT (gpioPortD)
|
||||||
|
|
||||||
|
#define BSP_I2CSENSOR_PERIPHERAL (HAL_I2C_PORT_I2C0)
|
||||||
|
#define BSP_I2CSENSOR_SCL_PIN (10U)
|
||||||
|
#define BSP_I2CSENSOR_SCL_PORT (gpioPortC)
|
||||||
|
#define BSP_I2CSENSOR_SCL_LOC (14U)
|
||||||
|
|
||||||
|
#define BSP_I2CSENSOR_SDA_PIN (11U)
|
||||||
|
#define BSP_I2CSENSOR_SDA_PORT (gpioPortC)
|
||||||
|
#define BSP_I2CSENSOR_SDA_LOC (16U)
|
||||||
|
|
||||||
|
// [I2CSENSOR]$
|
||||||
|
|
||||||
|
// $[IDAC0]
|
||||||
|
// [IDAC0]$
|
||||||
|
|
||||||
|
// $[IOEXP]
|
||||||
|
// [IOEXP]$
|
||||||
|
|
||||||
|
// $[LED]
|
||||||
|
#define BSP_LED_PRESENT (1)
|
||||||
|
|
||||||
|
#define BSP_LED0_PIN (4U)
|
||||||
|
#define BSP_LED0_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_LED1_PIN (5U)
|
||||||
|
#define BSP_LED1_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_LED_COUNT (2U)
|
||||||
|
#define BSP_LED_INIT { { BSP_LED0_PORT, BSP_LED0_PIN }, { BSP_LED1_PORT, BSP_LED1_PIN } }
|
||||||
|
#define BSP_LED_POLARITY (1)
|
||||||
|
// [LED]$
|
||||||
|
|
||||||
|
// $[LESENSE]
|
||||||
|
// [LESENSE]$
|
||||||
|
|
||||||
|
// $[LETIMER0]
|
||||||
|
// [LETIMER0]$
|
||||||
|
|
||||||
|
// $[LEUART0]
|
||||||
|
// [LEUART0]$
|
||||||
|
|
||||||
|
// $[LFXO]
|
||||||
|
// [LFXO]$
|
||||||
|
|
||||||
|
// $[MODEM]
|
||||||
|
// [MODEM]$
|
||||||
|
|
||||||
|
// $[PA]
|
||||||
|
|
||||||
|
#define BSP_PA_VOLTAGE (3300U)
|
||||||
|
// [PA]$
|
||||||
|
|
||||||
|
// $[PCNT0]
|
||||||
|
// [PCNT0]$
|
||||||
|
|
||||||
|
// $[PORTIO]
|
||||||
|
// [PORTIO]$
|
||||||
|
|
||||||
|
// $[PRS]
|
||||||
|
#define PORTIO_PRS_CH4_PIN (13U)
|
||||||
|
#define PORTIO_PRS_CH4_PORT (gpioPortD)
|
||||||
|
#define PORTIO_PRS_CH4_LOC (4U)
|
||||||
|
|
||||||
|
// [PRS]$
|
||||||
|
|
||||||
|
// $[PTI]
|
||||||
|
#define PORTIO_PTI_DCLK_PIN (11U)
|
||||||
|
#define PORTIO_PTI_DCLK_PORT (gpioPortB)
|
||||||
|
#define PORTIO_PTI_DCLK_LOC (6U)
|
||||||
|
|
||||||
|
#define PORTIO_PTI_DFRAME_PIN (13U)
|
||||||
|
#define PORTIO_PTI_DFRAME_PORT (gpioPortB)
|
||||||
|
#define PORTIO_PTI_DFRAME_LOC (6U)
|
||||||
|
|
||||||
|
#define PORTIO_PTI_DOUT_PIN (12U)
|
||||||
|
#define PORTIO_PTI_DOUT_PORT (gpioPortB)
|
||||||
|
#define PORTIO_PTI_DOUT_LOC (6U)
|
||||||
|
|
||||||
|
#define BSP_PTI_DFRAME_PIN (13U)
|
||||||
|
#define BSP_PTI_DFRAME_PORT (gpioPortB)
|
||||||
|
#define BSP_PTI_DFRAME_LOC (6U)
|
||||||
|
|
||||||
|
#define BSP_PTI_DOUT_PIN (12U)
|
||||||
|
#define BSP_PTI_DOUT_PORT (gpioPortB)
|
||||||
|
#define BSP_PTI_DOUT_LOC (6U)
|
||||||
|
|
||||||
|
// [PTI]$
|
||||||
|
|
||||||
|
// $[PYD1698]
|
||||||
|
// [PYD1698]$
|
||||||
|
|
||||||
|
// $[SERIAL]
|
||||||
|
#define BSP_SERIAL_APP_PORT (HAL_SERIAL_PORT_USART0)
|
||||||
|
#define BSP_SERIAL_APP_TX_PIN (0U)
|
||||||
|
#define BSP_SERIAL_APP_TX_PORT (gpioPortA)
|
||||||
|
#define BSP_SERIAL_APP_TX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_SERIAL_APP_RX_PIN (1U)
|
||||||
|
#define BSP_SERIAL_APP_RX_PORT (gpioPortA)
|
||||||
|
#define BSP_SERIAL_APP_RX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_SERIAL_APP_CTS_PIN (2U)
|
||||||
|
#define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
|
||||||
|
#define BSP_SERIAL_APP_CTS_LOC (30U)
|
||||||
|
|
||||||
|
#define BSP_SERIAL_APP_RTS_PIN (3U)
|
||||||
|
#define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
|
||||||
|
#define BSP_SERIAL_APP_RTS_LOC (30U)
|
||||||
|
|
||||||
|
#define HAL_SERIAL_APP_RX_QUEUE_SIZE (128)
|
||||||
|
#define HAL_SERIAL_APP_BAUD_RATE (115200)
|
||||||
|
#define HAL_SERIAL_APP_RXSTOP (16)
|
||||||
|
#define HAL_SERIAL_APP_RXSTART (16)
|
||||||
|
#define HAL_SERIAL_APP_TX_QUEUE_SIZE (128)
|
||||||
|
#define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_HWUART)
|
||||||
|
// [SERIAL]$
|
||||||
|
|
||||||
|
// $[SPIDISPLAY]
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_CS_PIN (14U)
|
||||||
|
#define BSP_SPIDISPLAY_CS_PORT (gpioPortD)
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_ENABLE_PIN (15U)
|
||||||
|
#define BSP_SPIDISPLAY_ENABLE_PORT (gpioPortD)
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_EXTCOMIN_PIN (13U)
|
||||||
|
#define BSP_SPIDISPLAY_EXTCOMIN_PORT (gpioPortD)
|
||||||
|
#define BSP_SPIDISPLAY_EXTCOMIN_LOC (4U)
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_DISPLAY (HAL_DISPLAY_SHARP_LS013B7DH03)
|
||||||
|
#define BSP_SPIDISPLAY_USART (HAL_SPI_PORT_USART1)
|
||||||
|
#define BSP_SPIDISPLAY_EXTCOMIN_CHANNEL (4)
|
||||||
|
#define BSP_SPIDISPLAY_MOSI_PIN (6U)
|
||||||
|
#define BSP_SPIDISPLAY_MOSI_PORT (gpioPortC)
|
||||||
|
#define BSP_SPIDISPLAY_MOSI_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_MISO_PIN (7U)
|
||||||
|
#define BSP_SPIDISPLAY_MISO_PORT (gpioPortC)
|
||||||
|
#define BSP_SPIDISPLAY_MISO_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_SPIDISPLAY_CLK_PIN (8U)
|
||||||
|
#define BSP_SPIDISPLAY_CLK_PORT (gpioPortC)
|
||||||
|
#define BSP_SPIDISPLAY_CLK_LOC (11U)
|
||||||
|
|
||||||
|
// [SPIDISPLAY]$
|
||||||
|
|
||||||
|
// $[SPINCP]
|
||||||
|
#define BSP_SPINCP_NHOSTINT_PIN (6U)
|
||||||
|
#define BSP_SPINCP_NHOSTINT_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_SPINCP_NWAKE_PIN (7U)
|
||||||
|
#define BSP_SPINCP_NWAKE_PORT (gpioPortF)
|
||||||
|
|
||||||
|
#define BSP_SPINCP_USART_PORT (HAL_SPI_PORT_USART1)
|
||||||
|
#define BSP_SPINCP_MOSI_PIN (6U)
|
||||||
|
#define BSP_SPINCP_MOSI_PORT (gpioPortC)
|
||||||
|
#define BSP_SPINCP_MOSI_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_SPINCP_MISO_PIN (7U)
|
||||||
|
#define BSP_SPINCP_MISO_PORT (gpioPortC)
|
||||||
|
#define BSP_SPINCP_MISO_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_SPINCP_CLK_PIN (8U)
|
||||||
|
#define BSP_SPINCP_CLK_PORT (gpioPortC)
|
||||||
|
#define BSP_SPINCP_CLK_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_SPINCP_CS_PIN (9U)
|
||||||
|
#define BSP_SPINCP_CS_PORT (gpioPortC)
|
||||||
|
#define BSP_SPINCP_CS_LOC (11U)
|
||||||
|
|
||||||
|
// [SPINCP]$
|
||||||
|
|
||||||
|
// $[TIMER0]
|
||||||
|
// [TIMER0]$
|
||||||
|
|
||||||
|
// $[TIMER1]
|
||||||
|
// [TIMER1]$
|
||||||
|
|
||||||
|
// $[UARTNCP]
|
||||||
|
#define BSP_UARTNCP_USART_PORT (HAL_SERIAL_PORT_USART0)
|
||||||
|
#define BSP_UARTNCP_TX_PIN (0U)
|
||||||
|
#define BSP_UARTNCP_TX_PORT (gpioPortA)
|
||||||
|
#define BSP_UARTNCP_TX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_UARTNCP_RX_PIN (1U)
|
||||||
|
#define BSP_UARTNCP_RX_PORT (gpioPortA)
|
||||||
|
#define BSP_UARTNCP_RX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_UARTNCP_CTS_PIN (2U)
|
||||||
|
#define BSP_UARTNCP_CTS_PORT (gpioPortA)
|
||||||
|
#define BSP_UARTNCP_CTS_LOC (30U)
|
||||||
|
|
||||||
|
#define BSP_UARTNCP_RTS_PIN (3U)
|
||||||
|
#define BSP_UARTNCP_RTS_PORT (gpioPortA)
|
||||||
|
#define BSP_UARTNCP_RTS_LOC (30U)
|
||||||
|
|
||||||
|
// [UARTNCP]$
|
||||||
|
|
||||||
|
// $[USART0]
|
||||||
|
#define PORTIO_USART0_CTS_PIN (2U)
|
||||||
|
#define PORTIO_USART0_CTS_PORT (gpioPortA)
|
||||||
|
#define PORTIO_USART0_CTS_LOC (30U)
|
||||||
|
|
||||||
|
#define PORTIO_USART0_RTS_PIN (3U)
|
||||||
|
#define PORTIO_USART0_RTS_PORT (gpioPortA)
|
||||||
|
#define PORTIO_USART0_RTS_LOC (30U)
|
||||||
|
|
||||||
|
#define PORTIO_USART0_RX_PIN (1U)
|
||||||
|
#define PORTIO_USART0_RX_PORT (gpioPortA)
|
||||||
|
#define PORTIO_USART0_RX_LOC (0U)
|
||||||
|
|
||||||
|
#define PORTIO_USART0_TX_PIN (0U)
|
||||||
|
#define PORTIO_USART0_TX_PORT (gpioPortA)
|
||||||
|
#define PORTIO_USART0_TX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_USART0_TX_PIN (0U)
|
||||||
|
#define BSP_USART0_TX_PORT (gpioPortA)
|
||||||
|
#define BSP_USART0_TX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_USART0_RX_PIN (1U)
|
||||||
|
#define BSP_USART0_RX_PORT (gpioPortA)
|
||||||
|
#define BSP_USART0_RX_LOC (0U)
|
||||||
|
|
||||||
|
#define BSP_USART0_CTS_PIN (2U)
|
||||||
|
#define BSP_USART0_CTS_PORT (gpioPortA)
|
||||||
|
#define BSP_USART0_CTS_LOC (30U)
|
||||||
|
|
||||||
|
#define BSP_USART0_RTS_PIN (3U)
|
||||||
|
#define BSP_USART0_RTS_PORT (gpioPortA)
|
||||||
|
#define BSP_USART0_RTS_LOC (30U)
|
||||||
|
|
||||||
|
// [USART0]$
|
||||||
|
|
||||||
|
// $[USART1]
|
||||||
|
#define PORTIO_USART1_CLK_PIN (8U)
|
||||||
|
#define PORTIO_USART1_CLK_PORT (gpioPortC)
|
||||||
|
#define PORTIO_USART1_CLK_LOC (11U)
|
||||||
|
|
||||||
|
#define PORTIO_USART1_CS_PIN (9U)
|
||||||
|
#define PORTIO_USART1_CS_PORT (gpioPortC)
|
||||||
|
#define PORTIO_USART1_CS_LOC (11U)
|
||||||
|
|
||||||
|
#define PORTIO_USART1_RX_PIN (7U)
|
||||||
|
#define PORTIO_USART1_RX_PORT (gpioPortC)
|
||||||
|
#define PORTIO_USART1_RX_LOC (11U)
|
||||||
|
|
||||||
|
#define PORTIO_USART1_TX_PIN (6U)
|
||||||
|
#define PORTIO_USART1_TX_PORT (gpioPortC)
|
||||||
|
#define PORTIO_USART1_TX_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_USART1_MOSI_PIN (6U)
|
||||||
|
#define BSP_USART1_MOSI_PORT (gpioPortC)
|
||||||
|
#define BSP_USART1_MOSI_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_USART1_MISO_PIN (7U)
|
||||||
|
#define BSP_USART1_MISO_PORT (gpioPortC)
|
||||||
|
#define BSP_USART1_MISO_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_USART1_CLK_PIN (8U)
|
||||||
|
#define BSP_USART1_CLK_PORT (gpioPortC)
|
||||||
|
#define BSP_USART1_CLK_LOC (11U)
|
||||||
|
|
||||||
|
#define BSP_USART1_CS_PIN (9U)
|
||||||
|
#define BSP_USART1_CS_PORT (gpioPortC)
|
||||||
|
#define BSP_USART1_CS_LOC (11U)
|
||||||
|
|
||||||
|
// [USART1]$
|
||||||
|
|
||||||
|
// $[USART2]
|
||||||
|
// [USART2]$
|
||||||
|
|
||||||
|
// $[VCOM]
|
||||||
|
|
||||||
|
#define BSP_VCOM_ENABLE_PIN (5U)
|
||||||
|
#define BSP_VCOM_ENABLE_PORT (gpioPortA)
|
||||||
|
|
||||||
|
// [VCOM]$
|
||||||
|
|
||||||
|
// $[VDAC0]
|
||||||
|
// [VDAC0]$
|
||||||
|
|
||||||
|
// $[VUART]
|
||||||
|
// [VUART]$
|
||||||
|
|
||||||
|
// $[WDOG]
|
||||||
|
// [WDOG]$
|
||||||
|
|
||||||
|
// $[WTIMER0]
|
||||||
|
// [WTIMER0]$
|
||||||
|
|
||||||
|
#if defined(_SILICON_LABS_MODULE)
|
||||||
|
#include "sl_module.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* HAL_CONFIG_BOARD_H */
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 EFR32_MBEDTLS_CONFIG_H
|
||||||
|
#define EFR32_MBEDTLS_CONFIG_H
|
||||||
|
|
||||||
|
#include "em_device.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def MBEDTLS_AES_ALT
|
||||||
|
*
|
||||||
|
* Enable hardware acceleration for the AES block cipher
|
||||||
|
*
|
||||||
|
* Module: sl_crypto/src/crypto_aes.c for devices with CRYPTO
|
||||||
|
* sl_crypto/src/aes_aes.c for devices with AES
|
||||||
|
*
|
||||||
|
* See MBEDTLS_AES_C for more information.
|
||||||
|
*/
|
||||||
|
#define MBEDTLS_AES_ALT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def MBEDTLS_ECP_INTERNAL_ALT
|
||||||
|
* \def ECP_SHORTWEIERSTRASS
|
||||||
|
* \def MBEDTLS_ECP_ADD_MIXED_ALT
|
||||||
|
* \def MBEDTLS_ECP_DOUBLE_JAC_ALT
|
||||||
|
* \def MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
|
||||||
|
* \def MBEDTLS_ECP_NORMALIZE_JAC_ALT
|
||||||
|
*
|
||||||
|
* Enable hardware acceleration for the elliptic curve over GF(p) library.
|
||||||
|
*
|
||||||
|
* Module: sl_crypto/src/crypto_ecp.c
|
||||||
|
* Caller: library/ecp.c
|
||||||
|
*
|
||||||
|
* Requires: MBEDTLS_BIGNUM_C, MBEDTLS_ECP_C and at least one
|
||||||
|
* MBEDTLS_ECP_DP_XXX_ENABLED and (CRYPTO_COUNT > 0)
|
||||||
|
*/
|
||||||
|
#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
|
||||||
|
#define MBEDTLS_ECP_INTERNAL_ALT
|
||||||
|
#define ECP_SHORTWEIERSTRASS
|
||||||
|
#define MBEDTLS_ECP_ADD_MIXED_ALT
|
||||||
|
#define MBEDTLS_ECP_DOUBLE_JAC_ALT
|
||||||
|
#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
|
||||||
|
#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
|
||||||
|
#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def MBEDTLS_SHA256_ALT
|
||||||
|
*
|
||||||
|
* Enable hardware acceleration for the SHA-224 and SHA-256 cryptographic
|
||||||
|
* hash algorithms.
|
||||||
|
*
|
||||||
|
* Module: sl_crypto/src/crypto_sha.c
|
||||||
|
* Caller: library/entropy.c
|
||||||
|
* library/mbedtls_md.c
|
||||||
|
* library/ssl_cli.c
|
||||||
|
* library/ssl_srv.c
|
||||||
|
* library/ssl_tls.c
|
||||||
|
*
|
||||||
|
* Requires: MBEDTLS_SHA256_C and (CRYPTO_COUNT > 0)
|
||||||
|
* See MBEDTLS_SHA256_C for more information.
|
||||||
|
*/
|
||||||
|
#if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
|
||||||
|
//#define MBEDTLS_SHA256_ALT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // EFR32_MBEDTLS_CONFIG_H
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements the OpenThread platform abstraction for the diagnostics.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/platform/alarm-milli.h>
|
||||||
|
#include <openthread/platform/radio.h>
|
||||||
|
|
||||||
|
#include "platform-efr32.h"
|
||||||
|
|
||||||
|
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diagnostics mode variables.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static bool sDiagMode = false;
|
||||||
|
|
||||||
|
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
OT_UNUSED_VARIABLE(argc);
|
||||||
|
|
||||||
|
// Add more platform specific diagnostics features here.
|
||||||
|
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatDiagModeSet(bool aMode)
|
||||||
|
{
|
||||||
|
sDiagMode = aMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool otPlatDiagModeGet()
|
||||||
|
{
|
||||||
|
return sDiagMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatDiagChannelSet(uint8_t aChannel)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatDiagTxPowerSet(int8_t aTxPower)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aTxPower);
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
OT_UNUSED_VARIABLE(aFrame);
|
||||||
|
OT_UNUSED_VARIABLE(aError);
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // #if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements an entropy source based on ADC.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openthread/platform/entropy.h>
|
||||||
|
|
||||||
|
#include "utils/code_utils.h"
|
||||||
|
|
||||||
|
#include "em_adc.h"
|
||||||
|
#include "em_cmu.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
EFR32_ADC_REF_CLOCK = 7000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
void efr32RandomInit(void)
|
||||||
|
{
|
||||||
|
/* Enable ADC Clock */
|
||||||
|
CMU_ClockEnable(cmuClock_ADC0, true);
|
||||||
|
ADC_Init_TypeDef init = ADC_INIT_DEFAULT;
|
||||||
|
ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT;
|
||||||
|
|
||||||
|
/* Initialize the ADC with the required values */
|
||||||
|
init.timebase = ADC_TimebaseCalc(0);
|
||||||
|
init.prescale = ADC_PrescaleCalc(EFR32_ADC_REF_CLOCK, 0);
|
||||||
|
ADC_Init(ADC0, &init);
|
||||||
|
|
||||||
|
/* Initialize for single conversion specific to RNG */
|
||||||
|
singleInit.reference = adcRefVEntropy;
|
||||||
|
singleInit.diff = true;
|
||||||
|
singleInit.posSel = adcPosSelVSS;
|
||||||
|
singleInit.negSel = adcNegSelVSS;
|
||||||
|
ADC_InitSingle(ADC0, &singleInit);
|
||||||
|
|
||||||
|
/* Set VINATT to maximum value and clear FIFO */
|
||||||
|
ADC0->SINGLECTRLX |= _ADC_SINGLECTRLX_VINATT_MASK;
|
||||||
|
ADC0->SINGLEFIFOCLEAR = ADC_SINGLEFIFOCLEAR_SINGLEFIFOCLEAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t randomUint32Get(void)
|
||||||
|
{
|
||||||
|
uint8_t tmp;
|
||||||
|
uint32_t random = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
tmp = 0;
|
||||||
|
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
ADC_Start(ADC0, adcStartSingle);
|
||||||
|
|
||||||
|
while ((ADC0->IF & ADC_IF_SINGLE) == 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
tmp |= ((ADC_DataSingleGet(ADC0) & 0x07) << (j * 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
random |= (tmp & 0xff) << (i * 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
return random;
|
||||||
|
}
|
||||||
|
|
||||||
|
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
|
||||||
|
{
|
||||||
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
|
otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
|
||||||
|
|
||||||
|
for (uint16_t length = 0; length < aOutputLength; length++)
|
||||||
|
{
|
||||||
|
aOutput[length] = (uint8_t)randomUint32Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return error;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 "hal-config.h"
|
||||||
|
|
||||||
|
#if (HAL_FEM_ENABLE)
|
||||||
|
#include "util/plugin/plugin-common/fem-control/fem-control.c"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements the OpenThread platform abstraction for the non-volatile storage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openthread-core-config.h>
|
||||||
|
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/platform/alarm-milli.h>
|
||||||
|
|
||||||
|
#include "utils/code_utils.h"
|
||||||
|
#include "utils/flash.h"
|
||||||
|
|
||||||
|
#include "em_msc.h"
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
#define FLASH_DATA_END_ADDR (FLASH_BASE + FLASH_SIZE)
|
||||||
|
#define FLASH_DATA_START_ADDR (FLASH_DATA_END_ADDR - (FLASH_PAGE_SIZE * SETTINGS_CONFIG_PAGE_NUM))
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
static inline uint32_t mapAddress(uint32_t aAddress)
|
||||||
|
{
|
||||||
|
return aAddress + FLASH_DATA_START_ADDR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static otError returnTypeConvert(int32_t aStatus)
|
||||||
|
{
|
||||||
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
|
switch (aStatus)
|
||||||
|
{
|
||||||
|
case mscReturnOk:
|
||||||
|
error = OT_ERROR_NONE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case mscReturnInvalidAddr:
|
||||||
|
case mscReturnUnaligned:
|
||||||
|
error = OT_ERROR_INVALID_ARGS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
error = OT_ERROR_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
otError utilsFlashInit(void)
|
||||||
|
{
|
||||||
|
MSC_Init();
|
||||||
|
return OT_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t utilsFlashGetSize(void)
|
||||||
|
{
|
||||||
|
return FLASH_DATA_END_ADDR - FLASH_DATA_START_ADDR;
|
||||||
|
}
|
||||||
|
|
||||||
|
otError utilsFlashErasePage(uint32_t aAddress)
|
||||||
|
{
|
||||||
|
int32_t status;
|
||||||
|
|
||||||
|
status = MSC_ErasePage((uint32_t *)mapAddress(aAddress));
|
||||||
|
|
||||||
|
return returnTypeConvert(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
otError utilsFlashStatusWait(uint32_t aTimeout)
|
||||||
|
{
|
||||||
|
otError error = OT_ERROR_BUSY;
|
||||||
|
uint32_t start = otPlatAlarmMilliGetNow();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (MSC->STATUS & MSC_STATUS_WDATAREADY)
|
||||||
|
{
|
||||||
|
error = OT_ERROR_NONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (aTimeout && ((otPlatAlarmMilliGetNow() - start) < aTimeout));
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t utilsFlashWrite(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||||
|
{
|
||||||
|
uint32_t rval = aSize;
|
||||||
|
int32_t status;
|
||||||
|
|
||||||
|
otEXPECT_ACTION(aData, rval = 0);
|
||||||
|
otEXPECT_ACTION(((aAddress + aSize) < utilsFlashGetSize()) && (!(aAddress & 3)) && (!(aSize & 3)), rval = 0);
|
||||||
|
|
||||||
|
status = MSC_WriteWord((uint32_t *)mapAddress(aAddress), aData, aSize);
|
||||||
|
otEXPECT_ACTION(returnTypeConvert(status) == OT_ERROR_NONE, rval = 0);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t utilsFlashRead(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||||
|
{
|
||||||
|
uint32_t rval = aSize;
|
||||||
|
uint32_t pAddress = mapAddress(aAddress);
|
||||||
|
uint8_t *byte = aData;
|
||||||
|
|
||||||
|
otEXPECT_ACTION(aData, rval = 0);
|
||||||
|
otEXPECT_ACTION((aAddress + aSize) < utilsFlashGetSize(), rval = 0);
|
||||||
|
|
||||||
|
while (aSize--)
|
||||||
|
{
|
||||||
|
*byte++ = (*(uint8_t *)(pAddress++));
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 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 logging.c
|
||||||
|
* Platform abstraction for the logging
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openthread-core-config.h>
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/platform/alarm-milli.h>
|
||||||
|
#include <openthread/platform/logging.h>
|
||||||
|
|
||||||
|
#include <utils/logging_rtt.h>
|
||||||
|
|
||||||
|
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
|
||||||
|
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL)
|
||||||
|
void efr32LogInit(void)
|
||||||
|
{
|
||||||
|
utilsLogRttInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32LogDeinit(void)
|
||||||
|
{
|
||||||
|
utilsLogRttDeinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, aFormat);
|
||||||
|
|
||||||
|
utilsLogRttOutput(aLogLevel, aLogRegion, aFormat, ap);
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements the OpenThread platform abstraction for miscellaneous behaviors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openthread/platform/misc.h>
|
||||||
|
|
||||||
|
#include "em_rmu.h"
|
||||||
|
#include "platform-efr32.h"
|
||||||
|
|
||||||
|
static uint32_t sResetCause;
|
||||||
|
|
||||||
|
void efr32MiscInit(void)
|
||||||
|
{
|
||||||
|
// Read the cause of last reset.
|
||||||
|
sResetCause = RMU_ResetCauseGet();
|
||||||
|
|
||||||
|
// Clear the register, as the causes cumulate over resets.
|
||||||
|
RMU_ResetCauseClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatReset(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
|
otPlatResetReason reason;
|
||||||
|
|
||||||
|
if (sResetCause & RMU_RSTCAUSE_PORST)
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_POWER_ON;
|
||||||
|
}
|
||||||
|
else if (sResetCause & RMU_RSTCAUSE_SYSREQRST)
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_SOFTWARE;
|
||||||
|
}
|
||||||
|
else if (sResetCause & RMU_RSTCAUSE_WDOGRST)
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_WATCHDOG;
|
||||||
|
}
|
||||||
|
else if (sResetCause & RMU_RSTCAUSE_EXTRST)
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_EXTERNAL;
|
||||||
|
}
|
||||||
|
else if (sResetCause & RMU_RSTCAUSE_LOCKUPRST)
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_FAULT;
|
||||||
|
}
|
||||||
|
else if ((sResetCause & RMU_RSTCAUSE_AVDDBOD) || (sResetCause & RMU_RSTCAUSE_DECBOD) ||
|
||||||
|
(sResetCause & RMU_RSTCAUSE_DVDDBOD) || (sResetCause & RMU_RSTCAUSE_EM4RST))
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_ASSERT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reason = OT_PLAT_RESET_REASON_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
void otPlatWakeHost(void)
|
||||||
|
{
|
||||||
|
// TODO: implement an operation to wake the host from sleep state.
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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_EFR32_CONFIG_CHECK_H_
|
||||||
|
#define OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_
|
||||||
|
|
||||||
|
#include "board_config.h"
|
||||||
|
|
||||||
|
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||||
|
#error "Platform efr32mg13 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
|
||||||
|
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||||
|
#error "Platform efr32mg13 not configured to support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OPENTHREAD_CORE_EFR32_CONFIG_CHECK_H_ */
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 efr32 compile-time configuration constants
|
||||||
|
* for OpenThread.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "board_config.h"
|
||||||
|
#include "em_msc.h"
|
||||||
|
|
||||||
|
#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
|
||||||
|
#define OPENTHREAD_CORE_EFR32_CONFIG_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_LOG_OUTPUT
|
||||||
|
*
|
||||||
|
* The efr32 platform provides an otPlatLog() function.
|
||||||
|
*/
|
||||||
|
#ifndef OPENTHREAD_CONFIG_LOG_OUTPUT /* allow command line override */
|
||||||
|
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @def OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||||
|
*
|
||||||
|
* Define to 1 if you want to enable physical layer to support OQPSK modulation in 915MHz band.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifdef RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
|
||||||
|
#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 1
|
||||||
|
#else
|
||||||
|
#define OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @def OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT
|
||||||
|
*
|
||||||
|
* Define to 1 if you want to enable physical layer to support OQPSK modulation in 2.4GHz band.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifdef RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
|
||||||
|
#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 1
|
||||||
|
#else
|
||||||
|
#define OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||||
|
*
|
||||||
|
* The platform-specific string to insert into the OpenThread version string.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define OPENTHREAD_CONFIG_PLATFORM_INFO "EFR32"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @def OPENTHREAD_CONFIG_SOFTWARE_RETRANSMIT_ENABLE
|
||||||
|
*
|
||||||
|
* Define to 1 if you want to enable software retransmission logic.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define OPENTHREAD_CONFIG_SOFTWARE_RETRANSMIT_ENABLE 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE
|
||||||
|
*
|
||||||
|
* Define to 1 if you want to enable software CSMA-CA backoff logic.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define OPENTHREAD_CONFIG_SOFTWARE_CSMA_BACKOFF_ENABLE 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_SOFTWARE_ENERGY_SCAN_ENABLE
|
||||||
|
*
|
||||||
|
* Define to 1 if you want to enable software energy scanning logic.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define OPENTHREAD_CONFIG_SOFTWARE_ENERGY_SCAN_ENABLE 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def SETTINGS_CONFIG_BASE_ADDRESS
|
||||||
|
*
|
||||||
|
* The base address of settings.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define SETTINGS_CONFIG_BASE_ADDRESS 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def SETTINGS_CONFIG_PAGE_SIZE
|
||||||
|
*
|
||||||
|
* The page size of settings.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define SETTINGS_CONFIG_PAGE_SIZE FLASH_PAGE_SIZE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def SETTINGS_CONFIG_PAGE_NUM
|
||||||
|
*
|
||||||
|
* The page number of settings.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define SETTINGS_CONFIG_PAGE_NUM 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM
|
||||||
|
*
|
||||||
|
* The number of short source address table entries.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define RADIO_CONFIG_SRC_MATCH_SHORT_ENTRY_NUM 6
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM
|
||||||
|
*
|
||||||
|
* The number of extended source address table entries.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM 6
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||||
|
*
|
||||||
|
* Define to 1 to enable NCP UART support.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||||
|
|
||||||
|
#endif // OPENTHREAD_CORE_EFR32_CONFIG_H_
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 defines the frequency band configuration structure for efr32.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLATFORM_BAND_H_
|
||||||
|
#define PLATFORM_BAND_H_
|
||||||
|
|
||||||
|
#include <openthread/platform/radio.h>
|
||||||
|
|
||||||
|
#include "rail.h"
|
||||||
|
#include "rail_config.h"
|
||||||
|
#include "rail_ieee802154.h"
|
||||||
|
|
||||||
|
#define RAIL_TX_FIFO_SIZE (OT_RADIO_FRAME_MAX_SIZE + 1)
|
||||||
|
|
||||||
|
#define RADIO_SCHEDULER_BACKGROUND_RX_PRIORITY 255
|
||||||
|
#define RADIO_SCHEDULER_CHANNEL_SCAN_PRIORITY 255
|
||||||
|
#define RADIO_SCHEDULER_CHANNEL_SLIP_TIME 500000UL
|
||||||
|
#define RADIO_SCHEDULER_TX_PRIORITY 100
|
||||||
|
#define RADIO_SCHEDULER_TX_SLIP_TIME 500000UL
|
||||||
|
|
||||||
|
#define RADIO_TIMING_CSMA_OVERHEAD_US 500
|
||||||
|
#define RADIO_TIMING_DEFAULT_BYTETIME_US 32 // only used if RAIL_GetBitRate returns 0
|
||||||
|
#define RADIO_TIMING_DEFAULT_SYMBOLTIME_US 16 // only used if RAIL_GetSymbolRate returns 0
|
||||||
|
|
||||||
|
typedef struct efr32RadioCounters
|
||||||
|
{
|
||||||
|
uint64_t mRailPlatTxTriggered;
|
||||||
|
uint64_t mRailPlatRadioReceiveDoneCbCount;
|
||||||
|
uint64_t mRailPlatRadioEnergyScanDoneCbCount;
|
||||||
|
uint64_t mRailPlatRadioTxDoneCbCount;
|
||||||
|
uint64_t mRailTxStarted;
|
||||||
|
uint64_t mRailTxStartFailed;
|
||||||
|
uint64_t mRailEventConfigScheduled;
|
||||||
|
uint64_t mRailEventConfigUnScheduled;
|
||||||
|
uint64_t mRailEventPacketSent;
|
||||||
|
uint64_t mRailEventChannelBusy;
|
||||||
|
uint64_t mRailEventEnergyScanCompleted;
|
||||||
|
uint64_t mRailEventCalNeeded;
|
||||||
|
uint64_t mRailEventPacketReceived;
|
||||||
|
uint64_t mRailEventNoAck;
|
||||||
|
uint64_t mRailEventTxAbort;
|
||||||
|
uint64_t mRailEventSchedulerStatusError;
|
||||||
|
uint64_t mRailEventsSchedulerStatusTransmitBusy;
|
||||||
|
uint32_t mRailEventsSchedulerStatusLastStatus;
|
||||||
|
} efr32RadioCounters;
|
||||||
|
|
||||||
|
typedef struct efr32CommonConfig
|
||||||
|
{
|
||||||
|
RAIL_Config_t mRailConfig;
|
||||||
|
#if RADIO_CONFIG_DMP_SUPPORT
|
||||||
|
RAILSched_Config_t railSchedState;
|
||||||
|
#endif
|
||||||
|
uint8_t
|
||||||
|
mRailTxFifo[RAIL_TX_FIFO_SIZE]; // must be 2 power between 64 and 4096, and bigger than OT_RADIO_FRAME_MAX_SIZE
|
||||||
|
} efr32CommonConfig;
|
||||||
|
|
||||||
|
typedef struct efr32BandConfig
|
||||||
|
{
|
||||||
|
const RAIL_ChannelConfig_t *mChannelConfig;
|
||||||
|
uint8_t mChannelMin;
|
||||||
|
uint8_t mChannelMax;
|
||||||
|
} efr32BandConfig;
|
||||||
|
|
||||||
|
#endif // PLATFORM_BAND_H_
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 initializers.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLATFORM_EFR32_H_
|
||||||
|
#define PLATFORM_EFR32_H_
|
||||||
|
|
||||||
|
#include <openthread/instance.h>
|
||||||
|
|
||||||
|
#include "em_device.h"
|
||||||
|
#include "em_system.h"
|
||||||
|
|
||||||
|
#include "core_cm4.h"
|
||||||
|
#include "rail.h"
|
||||||
|
|
||||||
|
// Global OpenThread instance structure
|
||||||
|
extern otInstance *sInstance;
|
||||||
|
|
||||||
|
// Global reference to rail handle
|
||||||
|
extern RAIL_Handle_t gRailHandle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function initializes the alarm service used by OpenThread.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32AlarmInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs alarm driver processing.
|
||||||
|
*
|
||||||
|
* @param[in] aInstance The OpenThread instance structure.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32AlarmProcess(otInstance *aInstance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function initializes the radio service used by OpenThead.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32RadioInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function deinitializes the radio service used by OpenThead.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32RadioDeinit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs radio driver processing.
|
||||||
|
*
|
||||||
|
* @param[in] aInstance The OpenThread instance structure.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32RadioProcess(otInstance *aInstance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs UART driver processing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32UartProcess(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of Misc module.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32MiscInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of ADC module for random number generator.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32RandomInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of Logger driver.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32LogInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deinitialization of Logger driver.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32LogDeinit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the sleep callback handler. The callback is used to check that
|
||||||
|
* the application has no work pending and that it is safe to put the EFR32
|
||||||
|
* into a low energy sleep mode.
|
||||||
|
*
|
||||||
|
* The callback should return true if it is ok to enter sleep mode. Note
|
||||||
|
* that the callback itself is run with interrupts disabled and so should
|
||||||
|
* be kept as short as possible. Anny interrupt including those from timers
|
||||||
|
* will wake the EFR32 out of sleep mode.
|
||||||
|
*
|
||||||
|
* @param[in] aCallback Callback function.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void efr32SetSleepCallback(bool (*aCallback)(void));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put the EFR32 into a low power mode. Before sleeping it will call a callback
|
||||||
|
* in the application registered with efr32SetSleepCallback to ensure that there
|
||||||
|
* is no outstanding work in the application to do.
|
||||||
|
*/
|
||||||
|
void efr32Sleep(void);
|
||||||
|
|
||||||
|
#endif // PLATFORM_EFR32_H_
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef __RAIL_CONFIG_H__
|
||||||
|
#define __RAIL_CONFIG_H__
|
||||||
|
|
||||||
|
#include "board_config.h"
|
||||||
|
#include "rail_types.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL
|
||||||
|
|
||||||
|
#if RADIO_CONFIG_915MHZ_OQPSK_SUPPORT
|
||||||
|
extern const RAIL_ChannelConfig_t *channelConfigs[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __RAIL_CONFIG_H__
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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
|
||||||
|
|
||||||
|
# Always package (e.g. for 'make dist') these subdirectories.
|
||||||
|
|
||||||
|
DIST_SUBDIRS = \
|
||||||
|
sleepy-demo-mtd \
|
||||||
|
sleepy-demo-ftd \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
# Always build (e.g. for 'make all') these subdirectories.
|
||||||
|
|
||||||
|
SUBDIRS = \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
|
SUBDIRS += sleepy-demo-mtd sleepy-demo-ftd
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Always pretty (e.g. for 'make pretty') these subdirectories.
|
||||||
|
|
||||||
|
PRETTY_SUBDIRS = \
|
||||||
|
sleepy-demo-mtd \
|
||||||
|
sleepy-demo-ftd \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
|
||||||
|
# EFR32MG13 Sleepy Demo Example
|
||||||
|
|
||||||
|
The EFR32 Sleepy applications demonstrates Sleepy End Device behaviour using
|
||||||
|
the EFR32's low power EM2 mode. The steps below will take you through the
|
||||||
|
process of building and running the demo
|
||||||
|
|
||||||
|
For setting up the build environment refer to [examples/platforms/efr32mg13/README.md](../README.md).
|
||||||
|
|
||||||
|
|
||||||
|
## 1. Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd <path-to-openthread>
|
||||||
|
$ ./bootstrap
|
||||||
|
$ make -f examples/Makefile-efr32mg13 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BOARD=BRD4168A
|
||||||
|
```
|
||||||
|
|
||||||
|
Convert the resulting executables into S-Record format and append a s37 suffix.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cd output/efr32mg13/bin
|
||||||
|
$ arm-none-eabi-objcopy -O srec sleepy-demo-mtd sleepy-demo-mtd.s37
|
||||||
|
$ arm-none-eabi-objcopy -O srec sleepy-demo-ftd sleepy-demo-ftd.s37
|
||||||
|
```
|
||||||
|
|
||||||
|
In Silicon Labs Simplicity Studio flash one device with the sleepy-demo-mtd.s37
|
||||||
|
image and the other device with the sleepy-demo-ftd.s37 image.
|
||||||
|
|
||||||
|
For instructions on flashing firmware see [examples/platforms/efr32mg13/README.md](../README.md#flash-binaries)
|
||||||
|
|
||||||
|
|
||||||
|
## 2. Starting nodes
|
||||||
|
|
||||||
|
For demonstration purposes the network settings are hardcoded within the source files.
|
||||||
|
The devices start Thread and form a network within a few seconds of powering on. In a real-life
|
||||||
|
application the devices should implement and go through a commissioning process to create
|
||||||
|
a network and add devices.
|
||||||
|
|
||||||
|
When the sleepy-demo-ftd device is started in the CLI the user shall see:
|
||||||
|
|
||||||
|
```
|
||||||
|
sleepy-demo-ftd started
|
||||||
|
sleepy-demo-ftd changed to leader
|
||||||
|
```
|
||||||
|
|
||||||
|
When the sleepy-demo-mtd device starts it joins the preconfigured Thread network
|
||||||
|
before disabling Rx-On-Idle to become a Sleepy-End-Device.
|
||||||
|
|
||||||
|
Use the command "child table" in the FTD console and observe the R flag of the child is 0.
|
||||||
|
|
||||||
|
```
|
||||||
|
> child table
|
||||||
|
| ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|S|D|N| Extended MAC |
|
||||||
|
+-----+--------+------------+------------+-------+------+-+-+-+-+------------------+
|
||||||
|
| 1 | 0x8401 | 240 | 3 | 3 | 3 |0|1|0|0| 8e8582dbd78c243c |
|
||||||
|
|
||||||
|
Done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 3. Buttons on the MTD
|
||||||
|
|
||||||
|
Pressing button 0 on the MTD toggles between operating as a Minimal End Device (MED) and
|
||||||
|
a Sleepy End Device (SED) with the RX off when idle.
|
||||||
|
|
||||||
|
Pressing button 1 on the MTD sends a multicast UDP message containing the
|
||||||
|
string "mtd button". The FTD listens on the multicast address and will toggle
|
||||||
|
LED 0 and display a message in the CLI showing "Message Received: mtd button".
|
||||||
|
|
||||||
|
## 4. Buttons on the FTD
|
||||||
|
|
||||||
|
Pressing either button 0 or 1 on the FTD will send a UDP message to the FTD containing the string
|
||||||
|
"ftd button". The MTD must first send a multicast message by pressing the MTD's button 1 so that
|
||||||
|
the FTD knows the address of the MTD to send messages to.
|
||||||
|
|
||||||
|
This will toggle the state of LED0 on the MTD. If the MTD is operating as a sleepy end device then
|
||||||
|
the MTD polls the parent every 5 seconds for messages and will update the LED state on the
|
||||||
|
next poll.
|
||||||
|
|
||||||
|
## 5. Monitoring power consumption of the MTD
|
||||||
|
|
||||||
|
Open the Energy Profiler within Silicon Labs Simplicity Studio. Within the Quick Access menu
|
||||||
|
select Start Energy Capture... and select the MTD device. When operating as a Sleepy End Device
|
||||||
|
with no LEDs on the current should be under 20 microamps with occassional spikes during waking
|
||||||
|
and polling the parent. With the LED on the MTD has a current consumption of approximately 1mA.
|
||||||
|
|
||||||
|
When operating as a Minial End Device with the Rx on Idle observe that the current is in the order
|
||||||
|
of 10ma.
|
||||||
|
|
||||||
|
With further configuration of GPIOs and peripherals it is possible to reduce the sleepy current
|
||||||
|
consumption further.
|
||||||
|
|
||||||
|
## 6. Notes on sleeping, sleepy callback and interrupts
|
||||||
|
|
||||||
|
To allow the EFR32 to enter sleepy mode the application must register a callback with efr32SetSleepCallback.
|
||||||
|
The return value of callback is used to indicate that the application has no further work to do and that
|
||||||
|
it is safe to go into a low power mode. The callback is called with interrupts disabled so should do
|
||||||
|
the minimum required to check if it can sleep.
|
||||||
|
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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
|
||||||
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
|
$(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a:
|
||||||
|
(cd $(top_builddir)/examples/platforms/efr32mg13/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg13.a )
|
||||||
|
|
||||||
|
bin_PROGRAMS = \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CPPFLAGS_COMMON += \
|
||||||
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
|
-Wno-sign-compare \
|
||||||
|
-DCORTEXM3 \
|
||||||
|
-DPHY=EMBER_PHY_RAIL \
|
||||||
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
|
-I$(top_srcdir)/examples/platforms \
|
||||||
|
-I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
|
-I$(top_srcdir)/src/core \
|
||||||
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-missing-field-initializers \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDADD_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDFLAGS_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LIBTOOLFLAGS_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
SOURCES_COMMON += \
|
||||||
|
main.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
LDADD_COMMON += \
|
||||||
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
|
$(NULL)
|
||||||
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
|
bin_PROGRAMS += \
|
||||||
|
sleepy-demo-ftd \
|
||||||
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
sleepy_demo_ftd_CPPFLAGS = \
|
||||||
|
$(CPPFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_ftd_LDADD = \
|
||||||
|
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
||||||
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
|
$(LDADD_COMMON) \
|
||||||
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
|
$(LDADD_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_ftd_LDFLAGS = \
|
||||||
|
$(LDFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_ftd_LIBTOOLFLAGS = \
|
||||||
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_ftd_SOURCES = \
|
||||||
|
$(SOURCES_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
|
sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
|
||||||
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
|
CPPFLAGS_COMMON += \
|
||||||
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 "bsp.h"
|
||||||
|
#include "em_cmu.h"
|
||||||
|
#include "em_emu.h"
|
||||||
|
#include "gpiointerrupt.h"
|
||||||
|
#include "hal-config.h"
|
||||||
|
#include "hal_common.h"
|
||||||
|
#include "openthread-system.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <common/logging.hpp>
|
||||||
|
#include <openthread-core-config.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <openthread/cli.h>
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/dataset_ftd.h>
|
||||||
|
#include <openthread/diag.h>
|
||||||
|
#include <openthread/instance.h>
|
||||||
|
#include <openthread/message.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
|
#include <openthread/thread.h>
|
||||||
|
#include <openthread/udp.h>
|
||||||
|
#include <openthread/platform/logging.h>
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
#define MULTICAST_ADDR "ff03::1"
|
||||||
|
#define MULTICAST_PORT 123
|
||||||
|
#define RECV_PORT 234
|
||||||
|
#define MTD_MESSAGE "mtd button"
|
||||||
|
#define FTD_MESSAGE "ftd button"
|
||||||
|
|
||||||
|
// Types
|
||||||
|
typedef struct ButtonArray
|
||||||
|
{
|
||||||
|
GPIO_Port_TypeDef port;
|
||||||
|
unsigned int pin;
|
||||||
|
} ButtonArray_t;
|
||||||
|
|
||||||
|
// Prototypes
|
||||||
|
void setNetworkConfiguration(otInstance *aInstance);
|
||||||
|
void handleNetifStateChanged(uint32_t aFlags, void *aContext);
|
||||||
|
void gpioInit(void (*gpioCallback)(uint8_t pin));
|
||||||
|
void buttonCallback(uint8_t pin);
|
||||||
|
void initUdp(void);
|
||||||
|
void applicationTick(void);
|
||||||
|
void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
static otInstance * instance;
|
||||||
|
static otUdpSocket sFtdSocket;
|
||||||
|
static bool sLedOn = false;
|
||||||
|
static bool sHaveSwitchAddress = false;
|
||||||
|
static otIp6Address sSwitchAddress;
|
||||||
|
static bool sFtdButtonPressed = false;
|
||||||
|
static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
|
||||||
|
|
||||||
|
void otTaskletsSignalPending(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
(void)aInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
otSysInit(argc, argv);
|
||||||
|
gpioInit(buttonCallback);
|
||||||
|
|
||||||
|
instance = otInstanceInitSingle();
|
||||||
|
assert(instance);
|
||||||
|
|
||||||
|
otCliUartInit(instance);
|
||||||
|
otCliOutputFormat("sleepy-demo-ftd started\r\n");
|
||||||
|
|
||||||
|
setNetworkConfiguration(instance);
|
||||||
|
otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
|
||||||
|
initUdp();
|
||||||
|
|
||||||
|
otIp6SetEnabled(instance, true);
|
||||||
|
otThreadSetEnabled(instance, true);
|
||||||
|
|
||||||
|
while (!otSysPseudoResetWasRequested())
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
otSysProcessDrivers(instance);
|
||||||
|
applicationTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
otInstanceFinalize(instance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provide, if required an "otPlatLog()" function
|
||||||
|
*/
|
||||||
|
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
|
||||||
|
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aLogLevel);
|
||||||
|
OT_UNUSED_VARIABLE(aLogRegion);
|
||||||
|
OT_UNUSED_VARIABLE(aFormat);
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, aFormat);
|
||||||
|
otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override default network settings, such as panid, so the devices can join a network
|
||||||
|
*/
|
||||||
|
void setNetworkConfiguration(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
static char aNetworkName[] = "SleepyEFR32";
|
||||||
|
otOperationalDataset aDataset;
|
||||||
|
|
||||||
|
memset(&aDataset, 0, sizeof(otOperationalDataset));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fields that can be configured in otOperationDataset to override defaults:
|
||||||
|
* Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
|
||||||
|
* Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
|
||||||
|
*/
|
||||||
|
aDataset.mActiveTimestamp = 1;
|
||||||
|
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||||
|
|
||||||
|
/* Set Channel to 15 */
|
||||||
|
aDataset.mChannel = 15;
|
||||||
|
aDataset.mComponents.mIsChannelPresent = true;
|
||||||
|
|
||||||
|
/* Set Pan ID to 2222 */
|
||||||
|
aDataset.mPanId = (otPanId)0x2222;
|
||||||
|
aDataset.mComponents.mIsPanIdPresent = true;
|
||||||
|
|
||||||
|
/* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
|
||||||
|
uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
|
||||||
|
memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
|
||||||
|
aDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||||
|
|
||||||
|
/* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
|
||||||
|
uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
|
||||||
|
memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
|
||||||
|
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||||
|
|
||||||
|
/* Set Network Name to SleepyEFR32 */
|
||||||
|
size_t length = strlen(aNetworkName);
|
||||||
|
assert(length <= OT_NETWORK_NAME_MAX_SIZE);
|
||||||
|
memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
|
||||||
|
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||||
|
|
||||||
|
otDatasetSetActive(aInstance, &aDataset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleNetifStateChanged(uint32_t aFlags, void *aContext)
|
||||||
|
{
|
||||||
|
if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
|
||||||
|
{
|
||||||
|
otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
|
||||||
|
|
||||||
|
switch (changedRole)
|
||||||
|
{
|
||||||
|
case OT_DEVICE_ROLE_LEADER:
|
||||||
|
otCliOutputFormat("sleepy-demo-ftd changed to leader\r\n");
|
||||||
|
break;
|
||||||
|
case OT_DEVICE_ROLE_ROUTER:
|
||||||
|
otCliOutputFormat("sleepy-demo-ftd changed to router\r\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_DEVICE_ROLE_CHILD:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_DEVICE_ROLE_DETACHED:
|
||||||
|
case OT_DEVICE_ROLE_DISABLED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gpioInit(void (*callback)(uint8_t pin))
|
||||||
|
{
|
||||||
|
// set up button GPIOs to input with pullups
|
||||||
|
for (int i = 0; i < BSP_BUTTON_COUNT; i++)
|
||||||
|
{
|
||||||
|
GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
|
||||||
|
}
|
||||||
|
// set up interrupt based callback function on falling edge
|
||||||
|
GPIOINT_Init();
|
||||||
|
GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
|
||||||
|
GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
|
||||||
|
GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
|
||||||
|
GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
|
||||||
|
|
||||||
|
BSP_LedsInit();
|
||||||
|
BSP_LedClear(0);
|
||||||
|
BSP_LedClear(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initUdp(void)
|
||||||
|
{
|
||||||
|
otError error;
|
||||||
|
otSockAddr sockaddr;
|
||||||
|
|
||||||
|
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||||
|
|
||||||
|
otIp6AddressFromString(MULTICAST_ADDR, &sockaddr.mAddress);
|
||||||
|
sockaddr.mPort = MULTICAST_PORT;
|
||||||
|
|
||||||
|
error = otUdpOpen(instance, &sFtdSocket, sFtdReceiveCallback, NULL);
|
||||||
|
if (error != OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
otCliOutputFormat("FTD failed to open udp multicast\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = otUdpBind(&sFtdSocket, &sockaddr);
|
||||||
|
if (error != OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
otUdpClose(&sFtdSocket);
|
||||||
|
otCliOutputFormat("FTD failed to bind udp multicast\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void buttonCallback(uint8_t pin)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(pin);
|
||||||
|
sFtdButtonPressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void applicationTick(void)
|
||||||
|
{
|
||||||
|
otError error = 0;
|
||||||
|
otMessageInfo messageInfo;
|
||||||
|
otMessage * message = NULL;
|
||||||
|
char * payload = FTD_MESSAGE;
|
||||||
|
|
||||||
|
if (sFtdButtonPressed == true)
|
||||||
|
{
|
||||||
|
sFtdButtonPressed = false;
|
||||||
|
|
||||||
|
if (sHaveSwitchAddress)
|
||||||
|
{
|
||||||
|
memset(&messageInfo, 0, sizeof(messageInfo));
|
||||||
|
memcpy(&messageInfo.mPeerAddr, &sSwitchAddress, sizeof messageInfo.mPeerAddr);
|
||||||
|
messageInfo.mPeerPort = RECV_PORT;
|
||||||
|
|
||||||
|
message = otUdpNewMessage(instance, NULL);
|
||||||
|
|
||||||
|
if (message != NULL)
|
||||||
|
{
|
||||||
|
error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
|
||||||
|
|
||||||
|
if (error == OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
error = otUdpSend(&sFtdSocket, message, &messageInfo);
|
||||||
|
|
||||||
|
if (error == OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message != NULL)
|
||||||
|
{
|
||||||
|
otMessageFree(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sFtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aContext);
|
||||||
|
OT_UNUSED_VARIABLE(aMessage);
|
||||||
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
|
uint8_t buf[1500];
|
||||||
|
int length;
|
||||||
|
|
||||||
|
sLedOn = !sLedOn;
|
||||||
|
|
||||||
|
if (sLedOn)
|
||||||
|
{
|
||||||
|
BSP_LedSet(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BSP_LedClear(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
length = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
|
||||||
|
buf[length] = '\0';
|
||||||
|
otCliOutputFormat("Message Received: %s\r\n", buf);
|
||||||
|
|
||||||
|
sHaveSwitchAddress = true;
|
||||||
|
memcpy(&sSwitchAddress, &aMessageInfo->mPeerAddr, sizeof sSwitchAddress);
|
||||||
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2020, 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
|
||||||
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
|
$(top_builddir)/examples/platforms/efr32mg13/libopenthread-efr32mg13.a:
|
||||||
|
(cd $(top_builddir)/examples/platforms/efr32mg13/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg13.a )
|
||||||
|
|
||||||
|
bin_PROGRAMS = \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CPPFLAGS_COMMON += \
|
||||||
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
|
-Wno-sign-compare \
|
||||||
|
-DCORTEXM3 \
|
||||||
|
-DPHY=EMBER_PHY_RAIL \
|
||||||
|
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
||||||
|
-DCORTEXM3_EFM32_MICRO \
|
||||||
|
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
||||||
|
-I$(top_srcdir)/examples/platforms \
|
||||||
|
-I$(top_srcdir)/examples/platforms/efr32mg13/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
|
-I$(top_srcdir)/src/core \
|
||||||
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-missing-field-initializers \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDADD_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LDFLAGS_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
LIBTOOLFLAGS_COMMON += \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
SOURCES_COMMON += \
|
||||||
|
main.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
LDADD_COMMON += \
|
||||||
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
|
$(NULL)
|
||||||
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
|
bin_PROGRAMS += \
|
||||||
|
sleepy-demo-mtd \
|
||||||
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
sleepy_demo_mtd_CPPFLAGS = \
|
||||||
|
$(CPPFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_mtd_LDADD = \
|
||||||
|
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
||||||
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
|
$(LDADD_COMMON) \
|
||||||
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
|
$(LDADD_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_mtd_LDFLAGS = \
|
||||||
|
$(LDFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_mtd_LIBTOOLFLAGS = \
|
||||||
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
sleepy_demo_mtd_SOURCES = \
|
||||||
|
$(SOURCES_COMMON) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
|
sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
|
||||||
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
|
CPPFLAGS_COMMON += \
|
||||||
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
@@ -0,0 +1,376 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "bsp.h"
|
||||||
|
#include "em_cmu.h"
|
||||||
|
#include "em_emu.h"
|
||||||
|
#include "gpiointerrupt.h"
|
||||||
|
#include "hal-config.h"
|
||||||
|
#include "hal_common.h"
|
||||||
|
#include "openthread-system.h"
|
||||||
|
#include "platform-efr32.h"
|
||||||
|
#include <common/logging.hpp>
|
||||||
|
#include <openthread-core-config.h>
|
||||||
|
#include <openthread/cli.h>
|
||||||
|
#include <openthread/config.h>
|
||||||
|
#include <openthread/dataset_ftd.h>
|
||||||
|
#include <openthread/diag.h>
|
||||||
|
#include <openthread/instance.h>
|
||||||
|
#include <openthread/link.h>
|
||||||
|
#include <openthread/message.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
|
#include <openthread/thread.h>
|
||||||
|
#include <openthread/udp.h>
|
||||||
|
#include <openthread/platform/logging.h>
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
#define MULTICAST_ADDR "ff03::1"
|
||||||
|
#define MULTICAST_PORT 123
|
||||||
|
#define RECV_PORT 234
|
||||||
|
#define SLEEPY_POLL_PERIOD_MS 5000
|
||||||
|
#define MTD_MESSAGE "mtd button"
|
||||||
|
#define FTD_MESSAGE "ftd button"
|
||||||
|
|
||||||
|
// Types
|
||||||
|
typedef struct ButtonArray
|
||||||
|
{
|
||||||
|
GPIO_Port_TypeDef port;
|
||||||
|
unsigned int pin;
|
||||||
|
} ButtonArray_t;
|
||||||
|
|
||||||
|
// Prototypes
|
||||||
|
bool sleepCb(void);
|
||||||
|
void setNetworkConfiguration(otInstance *aInstance);
|
||||||
|
void handleNetifStateChanged(uint32_t aFlags, void *aContext);
|
||||||
|
void gpioInit(void (*gpioCallback)(uint8_t pin));
|
||||||
|
void buttonCallback(uint8_t pin);
|
||||||
|
void initUdp(void);
|
||||||
|
void applicationTick(void);
|
||||||
|
void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
static otInstance * instance;
|
||||||
|
static otUdpSocket sMtdSocket;
|
||||||
|
static otSockAddr sMulticastSockAddr;
|
||||||
|
static const ButtonArray_t sButtonArray[BSP_BUTTON_COUNT] = BSP_BUTTON_INIT;
|
||||||
|
static bool sButtonPressed = false;
|
||||||
|
static bool sRxOnIdleButtonPressed = false;
|
||||||
|
static bool sLedOn = false;
|
||||||
|
static bool sAllowDeepSleep = false;
|
||||||
|
static bool sTaskletsPendingSem = true;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
otLinkModeConfig config;
|
||||||
|
|
||||||
|
otSysInit(argc, argv);
|
||||||
|
gpioInit(buttonCallback);
|
||||||
|
|
||||||
|
instance = otInstanceInitSingle();
|
||||||
|
assert(instance);
|
||||||
|
|
||||||
|
otCliUartInit(instance);
|
||||||
|
|
||||||
|
otLinkSetPollPeriod(instance, SLEEPY_POLL_PERIOD_MS);
|
||||||
|
setNetworkConfiguration(instance);
|
||||||
|
otSetStateChangedCallback(instance, handleNetifStateChanged, instance);
|
||||||
|
|
||||||
|
config.mRxOnWhenIdle = true;
|
||||||
|
config.mSecureDataRequests = true;
|
||||||
|
config.mDeviceType = 0;
|
||||||
|
config.mNetworkData = 0;
|
||||||
|
otThreadSetLinkMode(instance, config);
|
||||||
|
|
||||||
|
initUdp();
|
||||||
|
otIp6SetEnabled(instance, true);
|
||||||
|
otThreadSetEnabled(instance, true);
|
||||||
|
efr32SetSleepCallback(sleepCb);
|
||||||
|
|
||||||
|
while (!otSysPseudoResetWasRequested())
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
otSysProcessDrivers(instance);
|
||||||
|
|
||||||
|
applicationTick();
|
||||||
|
|
||||||
|
// Put the EFR32 into deep sleep if callback sleepCb permits.
|
||||||
|
efr32Sleep();
|
||||||
|
}
|
||||||
|
|
||||||
|
otInstanceFinalize(instance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback from efr32Sleep to indicate if it is ok to go into sleep mode.
|
||||||
|
* This runs with interrupts disabled.
|
||||||
|
*/
|
||||||
|
bool sleepCb(void)
|
||||||
|
{
|
||||||
|
bool allow;
|
||||||
|
allow = (sAllowDeepSleep && !sTaskletsPendingSem);
|
||||||
|
sTaskletsPendingSem = false;
|
||||||
|
return allow;
|
||||||
|
}
|
||||||
|
|
||||||
|
void otTaskletsSignalPending(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
(void)aInstance;
|
||||||
|
sTaskletsPendingSem = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override default network settings, such as panid, so the devices can join a network
|
||||||
|
*/
|
||||||
|
void setNetworkConfiguration(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
static char aNetworkName[] = "SleepyEFR32";
|
||||||
|
otOperationalDataset aDataset;
|
||||||
|
|
||||||
|
memset(&aDataset, 0, sizeof(otOperationalDataset));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fields that can be configured in otOperationDataset to override defaults:
|
||||||
|
* Network Name, Mesh Local Prefix, Extended PAN ID, PAN ID, Delay Timer,
|
||||||
|
* Channel, Channel Mask Page 0, Network Master Key, PSKc, Security Policy
|
||||||
|
*/
|
||||||
|
aDataset.mActiveTimestamp = 1;
|
||||||
|
aDataset.mComponents.mIsActiveTimestampPresent = true;
|
||||||
|
|
||||||
|
/* Set Channel to 15 */
|
||||||
|
aDataset.mChannel = 15;
|
||||||
|
aDataset.mComponents.mIsChannelPresent = true;
|
||||||
|
|
||||||
|
/* Set Pan ID to 2222 */
|
||||||
|
aDataset.mPanId = (otPanId)0x2222;
|
||||||
|
aDataset.mComponents.mIsPanIdPresent = true;
|
||||||
|
|
||||||
|
/* Set Extended Pan ID to C0DE1AB5C0DE1AB5 */
|
||||||
|
uint8_t extPanId[OT_EXT_PAN_ID_SIZE] = {0xC0, 0xDE, 0x1A, 0xB5, 0xC0, 0xDE, 0x1A, 0xB5};
|
||||||
|
memcpy(aDataset.mExtendedPanId.m8, extPanId, sizeof(aDataset.mExtendedPanId));
|
||||||
|
aDataset.mComponents.mIsExtendedPanIdPresent = true;
|
||||||
|
|
||||||
|
/* Set master key to 1234C0DE1AB51234C0DE1AB51234C0DE */
|
||||||
|
uint8_t key[OT_MASTER_KEY_SIZE] = {0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5, 0x12, 0x34, 0xC0, 0xDE, 0x1A, 0xB5};
|
||||||
|
memcpy(aDataset.mMasterKey.m8, key, sizeof(aDataset.mMasterKey));
|
||||||
|
aDataset.mComponents.mIsMasterKeyPresent = true;
|
||||||
|
|
||||||
|
/* Set Network Name to SleepyEFR32 */
|
||||||
|
size_t length = strlen(aNetworkName);
|
||||||
|
assert(length <= OT_NETWORK_NAME_MAX_SIZE);
|
||||||
|
memcpy(aDataset.mNetworkName.m8, aNetworkName, length);
|
||||||
|
aDataset.mComponents.mIsNetworkNamePresent = true;
|
||||||
|
|
||||||
|
otDatasetSetActive(aInstance, &aDataset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleNetifStateChanged(uint32_t aFlags, void *aContext)
|
||||||
|
{
|
||||||
|
otLinkModeConfig config;
|
||||||
|
|
||||||
|
if ((aFlags & OT_CHANGED_THREAD_ROLE) != 0)
|
||||||
|
{
|
||||||
|
otDeviceRole changedRole = otThreadGetDeviceRole(aContext);
|
||||||
|
|
||||||
|
switch (changedRole)
|
||||||
|
{
|
||||||
|
case OT_DEVICE_ROLE_LEADER:
|
||||||
|
case OT_DEVICE_ROLE_ROUTER:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_DEVICE_ROLE_CHILD:
|
||||||
|
config.mRxOnWhenIdle = 0;
|
||||||
|
config.mSecureDataRequests = true;
|
||||||
|
config.mDeviceType = 0;
|
||||||
|
config.mNetworkData = 0;
|
||||||
|
otThreadSetLinkMode(instance, config);
|
||||||
|
sAllowDeepSleep = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_DEVICE_ROLE_DETACHED:
|
||||||
|
case OT_DEVICE_ROLE_DISABLED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provide, if required an "otPlatLog()" function
|
||||||
|
*/
|
||||||
|
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
|
||||||
|
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aLogLevel);
|
||||||
|
OT_UNUSED_VARIABLE(aLogRegion);
|
||||||
|
OT_UNUSED_VARIABLE(aFormat);
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, aFormat);
|
||||||
|
otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void gpioInit(void (*callback)(uint8_t pin))
|
||||||
|
{
|
||||||
|
// set up button GPIOs to input with pullups
|
||||||
|
for (int i = 0; i < BSP_BUTTON_COUNT; i++)
|
||||||
|
{
|
||||||
|
GPIO_PinModeSet(sButtonArray[i].port, sButtonArray[i].pin, gpioModeInputPull, 1);
|
||||||
|
}
|
||||||
|
// set up interrupt based callback function on falling edge
|
||||||
|
GPIOINT_Init();
|
||||||
|
GPIOINT_CallbackRegister(sButtonArray[0].pin, callback);
|
||||||
|
GPIOINT_CallbackRegister(sButtonArray[1].pin, callback);
|
||||||
|
GPIO_IntConfig(sButtonArray[0].port, sButtonArray[0].pin, false, true, true);
|
||||||
|
GPIO_IntConfig(sButtonArray[1].port, sButtonArray[1].pin, false, true, true);
|
||||||
|
|
||||||
|
BSP_LedsInit();
|
||||||
|
BSP_LedClear(0);
|
||||||
|
BSP_LedClear(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initUdp(void)
|
||||||
|
{
|
||||||
|
otError error;
|
||||||
|
otSockAddr sockaddr;
|
||||||
|
|
||||||
|
memset(&sMulticastSockAddr, 0, sizeof sMulticastSockAddr);
|
||||||
|
otIp6AddressFromString(MULTICAST_ADDR, &sMulticastSockAddr.mAddress);
|
||||||
|
sMulticastSockAddr.mPort = MULTICAST_PORT;
|
||||||
|
|
||||||
|
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||||
|
sockaddr.mPort = RECV_PORT;
|
||||||
|
|
||||||
|
error = otUdpOpen(instance, &sMtdSocket, mtdReceiveCallback, NULL);
|
||||||
|
|
||||||
|
if (error != OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = otUdpBind(&sMtdSocket, &sockaddr);
|
||||||
|
|
||||||
|
if (error != OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
otUdpClose(&sMtdSocket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void buttonCallback(uint8_t pin)
|
||||||
|
{
|
||||||
|
if ((pin & 0x01) == 0x01)
|
||||||
|
{
|
||||||
|
sButtonPressed = true;
|
||||||
|
}
|
||||||
|
else if ((pin & 0x01) == 0x00)
|
||||||
|
{
|
||||||
|
sRxOnIdleButtonPressed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void applicationTick(void)
|
||||||
|
{
|
||||||
|
otError error = 0;
|
||||||
|
otMessageInfo messageInfo;
|
||||||
|
otMessage * message = NULL;
|
||||||
|
char * payload = MTD_MESSAGE;
|
||||||
|
otLinkModeConfig config;
|
||||||
|
|
||||||
|
if (sRxOnIdleButtonPressed == true)
|
||||||
|
{
|
||||||
|
sRxOnIdleButtonPressed = false;
|
||||||
|
sAllowDeepSleep = !sAllowDeepSleep;
|
||||||
|
config.mRxOnWhenIdle = !sAllowDeepSleep;
|
||||||
|
config.mSecureDataRequests = true;
|
||||||
|
config.mDeviceType = 0;
|
||||||
|
config.mNetworkData = 0;
|
||||||
|
otThreadSetLinkMode(instance, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sButtonPressed == true)
|
||||||
|
{
|
||||||
|
sButtonPressed = false;
|
||||||
|
|
||||||
|
memset(&messageInfo, 0, sizeof(messageInfo));
|
||||||
|
memcpy(&messageInfo.mPeerAddr, &sMulticastSockAddr.mAddress, sizeof messageInfo.mPeerAddr);
|
||||||
|
messageInfo.mPeerPort = sMulticastSockAddr.mPort;
|
||||||
|
|
||||||
|
message = otUdpNewMessage(instance, NULL);
|
||||||
|
|
||||||
|
if (message != NULL)
|
||||||
|
{
|
||||||
|
error = otMessageAppend(message, payload, (uint16_t)strlen(payload));
|
||||||
|
|
||||||
|
if (error == OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
error = otUdpSend(&sMtdSocket, message, &messageInfo);
|
||||||
|
|
||||||
|
if (error == OT_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message != NULL)
|
||||||
|
{
|
||||||
|
otMessageFree(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mtdReceiveCallback(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(aContext);
|
||||||
|
OT_UNUSED_VARIABLE(aMessage);
|
||||||
|
OT_UNUSED_VARIABLE(aMessageInfo);
|
||||||
|
uint8_t buf[1500];
|
||||||
|
int length;
|
||||||
|
|
||||||
|
length = otMessageRead(aMessage, otMessageGetOffset(aMessage), buf, sizeof(buf) - 1);
|
||||||
|
buf[length] = '\0';
|
||||||
|
|
||||||
|
if (strcmp((char *)buf, FTD_MESSAGE) == 0)
|
||||||
|
{
|
||||||
|
sLedOn = !sLedOn;
|
||||||
|
|
||||||
|
if (sLedOn)
|
||||||
|
{
|
||||||
|
BSP_LedSet(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BSP_LedClear(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements gcc-specific startup code for the efr32.
|
||||||
|
*/
|
||||||
|
|
||||||
|
__extension__ typedef int __guard __attribute__((mode(__DI__)));
|
||||||
|
|
||||||
|
int __cxa_guard_acquire(__guard *g)
|
||||||
|
{
|
||||||
|
return !*(char *)(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __cxa_guard_release(__guard *g)
|
||||||
|
{
|
||||||
|
*(char *)g = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __cxa_guard_abort(__guard *g)
|
||||||
|
{
|
||||||
|
(void)g;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __cxa_pure_virtual(void)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
;
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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
|
||||||
|
* @brief
|
||||||
|
* This file includes the platform-specific initializers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "openthread-system.h"
|
||||||
|
#include <openthread/platform/uart.h>
|
||||||
|
|
||||||
|
#include "common/logging.hpp"
|
||||||
|
|
||||||
|
#include "bsp.h"
|
||||||
|
#include "em_chip.h"
|
||||||
|
#include "em_cmu.h"
|
||||||
|
#include "em_core.h"
|
||||||
|
#include "em_emu.h"
|
||||||
|
#include "em_system.h"
|
||||||
|
#include "hal-config.h"
|
||||||
|
#include "hal_common.h"
|
||||||
|
#include "rail.h"
|
||||||
|
#include "sl_mpu.h"
|
||||||
|
#include "sl_sleeptimer.h"
|
||||||
|
|
||||||
|
#include "openthread-core-efr32-config.h"
|
||||||
|
#include "platform-efr32.h"
|
||||||
|
|
||||||
|
#if (HAL_FEM_ENABLE)
|
||||||
|
#include "fem-control.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_EFR32_LOG \
|
||||||
|
((OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
|
||||||
|
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL))
|
||||||
|
|
||||||
|
void halInitChipSpecific(void);
|
||||||
|
|
||||||
|
otInstance *sInstance;
|
||||||
|
static bool (*sCanSleepCallback)(void);
|
||||||
|
|
||||||
|
void otSysInit(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
OT_UNUSED_VARIABLE(argc);
|
||||||
|
OT_UNUSED_VARIABLE(argv);
|
||||||
|
sl_status_t status;
|
||||||
|
|
||||||
|
__disable_irq();
|
||||||
|
|
||||||
|
#undef FIXED_EXCEPTION
|
||||||
|
#define FIXED_EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler)
|
||||||
|
#define EXCEPTION(vectorNumber, functionName, deviceIrqn, deviceIrqHandler, priorityLevel, subpriority) \
|
||||||
|
NVIC_SetPriority(deviceIrqn, NVIC_EncodePriority(PRIGROUP_POSITION, priorityLevel, subpriority));
|
||||||
|
#include NVIC_CONFIG
|
||||||
|
#undef EXCEPTION
|
||||||
|
|
||||||
|
NVIC_SetPriorityGrouping(PRIGROUP_POSITION);
|
||||||
|
CHIP_Init();
|
||||||
|
halInitChipSpecific();
|
||||||
|
BSP_Init(BSP_INIT_BCC);
|
||||||
|
|
||||||
|
CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFRCO);
|
||||||
|
CMU_ClockEnable(cmuClock_CORELE, true);
|
||||||
|
CMU_ClockEnable(cmuClock_RTCC, true);
|
||||||
|
status = sl_sleeptimer_init();
|
||||||
|
assert(status == SL_STATUS_OK);
|
||||||
|
|
||||||
|
#if (HAL_FEM_ENABLE)
|
||||||
|
initFem();
|
||||||
|
wakeupFem();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__enable_irq();
|
||||||
|
|
||||||
|
#if USE_EFR32_LOG
|
||||||
|
efr32LogInit();
|
||||||
|
#endif
|
||||||
|
efr32RadioInit();
|
||||||
|
efr32AlarmInit();
|
||||||
|
efr32MiscInit();
|
||||||
|
efr32RandomInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool otSysPseudoResetWasRequested(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void otSysDeinit(void)
|
||||||
|
{
|
||||||
|
efr32RadioDeinit();
|
||||||
|
|
||||||
|
#if USE_EFR32_LOG
|
||||||
|
efr32LogDeinit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32SetSleepCallback(bool (*aCallback)(void))
|
||||||
|
{
|
||||||
|
sCanSleepCallback = aCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32Sleep(void)
|
||||||
|
{
|
||||||
|
bool canDeepSleep = false;
|
||||||
|
int wakeupProcessTime = 1000;
|
||||||
|
CORE_DECLARE_IRQ_STATE;
|
||||||
|
|
||||||
|
if (RAIL_Sleep(wakeupProcessTime, &canDeepSleep) == RAIL_STATUS_NO_ERROR)
|
||||||
|
{
|
||||||
|
if (canDeepSleep)
|
||||||
|
{
|
||||||
|
CORE_ENTER_ATOMIC();
|
||||||
|
if (sCanSleepCallback != NULL && sCanSleepCallback())
|
||||||
|
{
|
||||||
|
EMU_EnterEM2(true);
|
||||||
|
}
|
||||||
|
CORE_EXIT_ATOMIC();
|
||||||
|
// TODO OT will handle an interrupt here and it mustn't call any RAIL APIs
|
||||||
|
|
||||||
|
while (RAIL_Wake(0) != RAIL_STATUS_NO_ERROR)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CORE_ENTER_ATOMIC();
|
||||||
|
if (sCanSleepCallback != NULL && sCanSleepCallback())
|
||||||
|
{
|
||||||
|
EMU_EnterEM1();
|
||||||
|
}
|
||||||
|
CORE_EXIT_ATOMIC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void otSysProcessDrivers(otInstance *aInstance)
|
||||||
|
{
|
||||||
|
sInstance = aInstance;
|
||||||
|
|
||||||
|
// should sleep and wait for interrupts here
|
||||||
|
|
||||||
|
efr32UartProcess();
|
||||||
|
efr32RadioProcess(aInstance);
|
||||||
|
efr32AlarmProcess(aInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
__WEAK void otSysEventSignalPending(void)
|
||||||
|
{
|
||||||
|
// Intentionally empty
|
||||||
|
}
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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 implements the OpenThread platform abstraction for UART communication.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "openthread-system.h"
|
||||||
|
#include <openthread/platform/uart.h>
|
||||||
|
|
||||||
|
#include "utils/code_utils.h"
|
||||||
|
|
||||||
|
#include "em_core.h"
|
||||||
|
#include "uartdrv.h"
|
||||||
|
|
||||||
|
#include "hal-config.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
kReceiveFifoSize = 128,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define USART_INIT \
|
||||||
|
{ \
|
||||||
|
USART0, /* USART port */ \
|
||||||
|
115200, /* Baud rate */ \
|
||||||
|
BSP_SERIAL_APP_TX_LOC, /* USART Tx pin location number */ \
|
||||||
|
BSP_SERIAL_APP_RX_LOC, /* USART Rx pin location number */ \
|
||||||
|
(USART_Stopbits_TypeDef)USART_FRAME_STOPBITS_ONE, /* Stop bits */ \
|
||||||
|
(USART_Parity_TypeDef)USART_FRAME_PARITY_NONE, /* Parity */ \
|
||||||
|
(USART_OVS_TypeDef)USART_CTRL_OVS_X16, /* Oversampling mode*/ \
|
||||||
|
false, /* Majority vote disable */ \
|
||||||
|
HAL_SERIAL_APP_FLOW_CONTROL, /* Flow control */ \
|
||||||
|
BSP_SERIAL_APP_CTS_PORT, /* CTS port number */ \
|
||||||
|
BSP_SERIAL_APP_CTS_PIN, /* CTS pin number */ \
|
||||||
|
BSP_SERIAL_APP_RTS_PORT, /* RTS port number */ \
|
||||||
|
BSP_SERIAL_APP_RTS_PIN, /* RTS pin number */ \
|
||||||
|
(UARTDRV_Buffer_FifoQueue_t *)&sUartRxQueue, /* RX operation queue */ \
|
||||||
|
(UARTDRV_Buffer_FifoQueue_t *)&sUartTxQueue, /* TX operation queue */ \
|
||||||
|
BSP_SERIAL_APP_CTS_LOC, /* CTS location */ \
|
||||||
|
BSP_SERIAL_APP_RTS_LOC /* RTS location */ \
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_RX_BUFS, sUartRxQueue);
|
||||||
|
DEFINE_BUF_QUEUE(EMDRV_UARTDRV_MAX_CONCURRENT_TX_BUFS, sUartTxQueue);
|
||||||
|
|
||||||
|
static UARTDRV_HandleData_t sUartHandleData;
|
||||||
|
static UARTDRV_Handle_t sUartHandle = &sUartHandleData;
|
||||||
|
static uint8_t sReceiveBuffer[2];
|
||||||
|
static const uint8_t * sTransmitBuffer = NULL;
|
||||||
|
static volatile uint16_t sTransmitLength = 0;
|
||||||
|
|
||||||
|
typedef struct ReceiveFifo_t
|
||||||
|
{
|
||||||
|
// The data buffer
|
||||||
|
uint8_t mBuffer[kReceiveFifoSize];
|
||||||
|
// The offset of the first item written to the list.
|
||||||
|
volatile uint16_t mHead;
|
||||||
|
// The offset of the next item to be written to the list.
|
||||||
|
volatile uint16_t mTail;
|
||||||
|
} ReceiveFifo_t;
|
||||||
|
|
||||||
|
static ReceiveFifo_t sReceiveFifo;
|
||||||
|
|
||||||
|
static void processReceive(void);
|
||||||
|
|
||||||
|
static void receiveDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
|
||||||
|
{
|
||||||
|
// We can only write if incrementing mTail doesn't equal mHead
|
||||||
|
if (sReceiveFifo.mHead != (sReceiveFifo.mTail + 1) % kReceiveFifoSize)
|
||||||
|
{
|
||||||
|
sReceiveFifo.mBuffer[sReceiveFifo.mTail] = aData[0];
|
||||||
|
sReceiveFifo.mTail = (sReceiveFifo.mTail + 1) % kReceiveFifoSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
UARTDRV_Receive(aHandle, aData, 1, receiveDone);
|
||||||
|
otSysEventSignalPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void transmitDone(UARTDRV_Handle_t aHandle, Ecode_t aStatus, uint8_t *aData, UARTDRV_Count_t aCount)
|
||||||
|
{
|
||||||
|
sTransmitLength = 0;
|
||||||
|
otSysEventSignalPending();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void processReceive(void)
|
||||||
|
{
|
||||||
|
// Copy tail to prevent multiple reads
|
||||||
|
uint16_t tail = sReceiveFifo.mTail;
|
||||||
|
|
||||||
|
// If the data wraps around, process the first part
|
||||||
|
if (sReceiveFifo.mHead > tail)
|
||||||
|
{
|
||||||
|
otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, kReceiveFifoSize - sReceiveFifo.mHead);
|
||||||
|
|
||||||
|
// Reset the buffer mHead back to zero.
|
||||||
|
sReceiveFifo.mHead = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For any data remaining, process it
|
||||||
|
if (sReceiveFifo.mHead != tail)
|
||||||
|
{
|
||||||
|
otPlatUartReceived(sReceiveFifo.mBuffer + sReceiveFifo.mHead, tail - sReceiveFifo.mHead);
|
||||||
|
|
||||||
|
// Set mHead to the local tail we have cached
|
||||||
|
sReceiveFifo.mHead = tail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
otError otPlatUartFlush(void)
|
||||||
|
{
|
||||||
|
return OT_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void processTransmit(void)
|
||||||
|
{
|
||||||
|
if (sTransmitBuffer != NULL && sTransmitLength == 0)
|
||||||
|
{
|
||||||
|
sTransmitBuffer = NULL;
|
||||||
|
otPlatUartSendDone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
otError otPlatUartEnable(void)
|
||||||
|
{
|
||||||
|
UARTDRV_Init_t uartInit = USART_INIT;
|
||||||
|
|
||||||
|
sReceiveFifo.mHead = 0;
|
||||||
|
sReceiveFifo.mTail = 0;
|
||||||
|
|
||||||
|
UARTDRV_Init(sUartHandle, &uartInit);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < sizeof(sReceiveBuffer); i++)
|
||||||
|
{
|
||||||
|
UARTDRV_Receive(sUartHandle, &sReceiveBuffer[i], sizeof(sReceiveBuffer[i]), receiveDone);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OT_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
otError otPlatUartDisable(void)
|
||||||
|
{
|
||||||
|
return OT_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
|
||||||
|
{
|
||||||
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
|
otEXPECT_ACTION(sTransmitBuffer == NULL, error = OT_ERROR_BUSY);
|
||||||
|
|
||||||
|
sTransmitBuffer = aBuf;
|
||||||
|
sTransmitLength = aBufLength;
|
||||||
|
|
||||||
|
UARTDRV_Transmit(sUartHandle, (uint8_t *)sTransmitBuffer, sTransmitLength, transmitDone);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
void efr32UartProcess(void)
|
||||||
|
{
|
||||||
|
processReceive();
|
||||||
|
processTransmit();
|
||||||
|
}
|
||||||
@@ -28,63 +28,65 @@
|
|||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
|
|
||||||
lib_LIBRARIES = libopenthread-efr32mg21.a
|
lib_LIBRARIES = libopenthread-efr32mg21.a
|
||||||
|
|
||||||
# Do not enable -Wconversion for rail
|
# Do not enable -Wconversion for rail
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -pedantic-errors for rail
|
# Do not enable -pedantic-errors for rail
|
||||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -Wundef for rail
|
# Do not enable -Wundef for rail
|
||||||
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
|
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
libopenthread_efr32mg21_a_CPPFLAGS = \
|
libopenthread_efr32mg21_a_CPPFLAGS = \
|
||||||
-DEFR32_SERIES2_CONFIG1_MICRO \
|
-DEFR32_SERIES2_CONFIG1_MICRO \
|
||||||
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-I$(top_srcdir)/include \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
|
-Wno-sign-compare \
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR) \
|
-I$(SDK_SRC_DIR) \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG21/Include \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/mpu/inc \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@@ -120,7 +122,7 @@ PRETTY_FILES =
|
|||||||
$(PLATFORM_SOURCES) \
|
$(PLATFORM_SOURCES) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
Dash = -
|
Dash = -
|
||||||
libopenthread_efr32mg21_a_LIBADD = \
|
libopenthread_efr32mg21_a_LIBADD = \
|
||||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o") \
|
$(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")
|
$(shell find $(top_builddir)/third_party/jlink/SEGGER_RTT_V640/RTT $(Dash)type f $(Dash)name "*.o")
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ file core_cm33.h:
|
|||||||
core_cm33.h can be found at:
|
core_cm33.h can be found at:
|
||||||
|
|
||||||
```
|
```
|
||||||
<path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite/v2.6/platform/CMSIS/Include
|
<path-to-Simplicity-Studio>/developer/sdks/gecko_sdk_suite/v2.7/platform/CMSIS/Include
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Build OpenThread Firmware (CLI example) on EFR32 platform.
|
4. Build OpenThread Firmware (CLI example) on EFR32 platform.
|
||||||
|
|||||||
@@ -29,130 +29,122 @@
|
|||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
|
$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
|
||||||
(cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
|
(cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-I$(top_srcdir)/include \
|
-DEFR32_SERIES2_CONFIG1_MICRO \
|
||||||
-I$(top_srcdir)/src/core \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-DCORTEXM3 \
|
|
||||||
-D__START=main \
|
|
||||||
-DPHY=EMBER_PHY_RAIL \
|
|
||||||
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
|
||||||
-DCORTEXM3_EFM32_MICRO \
|
|
||||||
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
|
||||||
-D__STARTUP_CLEAR_BSS \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG21/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread/stack \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDFLAGS_COMMON += \
|
LDFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBTOOLFLAGS_COMMON += \
|
LIBTOOLFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SOURCES_COMMON += \
|
SOURCES_COMMON += \
|
||||||
main.c \
|
main.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_EXECUTABLE
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
bin_PROGRAMS += \
|
bin_PROGRAMS += \
|
||||||
sleepy-demo-ftd \
|
sleepy-demo-ftd \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sleepy_demo_ftd_CPPFLAGS = \
|
sleepy_demo_ftd_CPPFLAGS = \
|
||||||
$(CPPFLAGS_COMMON) \
|
$(CPPFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LDADD = \
|
sleepy_demo_ftd_LDADD = \
|
||||||
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
$(top_builddir)/src/cli/libopenthread-cli-ftd.a \
|
||||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(top_builddir)/src/core/libopenthread-ftd.a \
|
$(top_builddir)/src/core/libopenthread-ftd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LDFLAGS = \
|
sleepy_demo_ftd_LDFLAGS = \
|
||||||
$(LDFLAGS_COMMON) \
|
$(LDFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_LIBTOOLFLAGS = \
|
sleepy_demo_ftd_LIBTOOLFLAGS = \
|
||||||
$(LIBTOOLFLAGS_COMMON) \
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_ftd_SOURCES = \
|
sleepy_demo_ftd_SOURCES = \
|
||||||
$(SOURCES_COMMON) \
|
$(SOURCES_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_LINKER_MAP
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
|
sleepy_demo_ftd_LDFLAGS += -Wl,-Map=sleepy-demo-ftd.map
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_BUILD_COVERAGE
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-DOPENTHREAD_ENABLE_COVERAGE \
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
endif # OPENTHREAD_BUILD_COVERAGE
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
|
|||||||
@@ -29,130 +29,122 @@
|
|||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
include $(top_srcdir)/examples/platforms/Makefile.platform.am
|
||||||
|
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
|
||||||
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
|
$(top_builddir)/examples/platforms/efr32mg21/libopenthread-efr32mg21.a:
|
||||||
(cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
|
(cd $(top_builddir)/examples/platforms/efr32mg21/ && $(MAKE) $(AM_MAKEFLAGS) libopenthread-efr32mg21.a )
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-I$(top_srcdir)/include \
|
-DEFR32_SERIES2_CONFIG1_MICRO \
|
||||||
-I$(top_srcdir)/src/core \
|
-DNVIC_CONFIG=\"platform/base/hal/micro/cortexm3/efm32/nvic-config.h\" \
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
||||||
-DPLATFORM_HEADER=\"platform/base/hal/micro/cortexm3/compiler/gcc.h\" \
|
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-DCORTEXM3 \
|
|
||||||
-D__START=main \
|
|
||||||
-DPHY=EMBER_PHY_RAIL \
|
|
||||||
-DMICRO=EMBER_MICRO_CORTEXM3_EFR32 \
|
|
||||||
-DCORTEXM3_EFM32_MICRO \
|
|
||||||
-DPLAT=EMBER_PLATFORM_CORTEXM3 \
|
|
||||||
-D__STARTUP_CLEAR_BSS \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/examples/platforms \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32/$(EFR32_BOARD_DIR) \
|
-I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/ \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG21/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/plugin \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread \
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal/micro/cortexm3/efm32 \
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/protocol/thread/stack \
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/base/hal \
|
|
||||||
-Wno-unused-parameter \
|
-Wno-unused-parameter \
|
||||||
-Wno-missing-field-initializers \
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LDFLAGS_COMMON += \
|
LDFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBTOOLFLAGS_COMMON += \
|
LIBTOOLFLAGS_COMMON += \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SOURCES_COMMON += \
|
SOURCES_COMMON += \
|
||||||
main.c \
|
main.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
LDADD_COMMON += \
|
LDADD_COMMON += \
|
||||||
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_EXECUTABLE
|
if OPENTHREAD_ENABLE_EXECUTABLE
|
||||||
bin_PROGRAMS += \
|
bin_PROGRAMS += \
|
||||||
sleepy-demo-mtd \
|
sleepy-demo-mtd \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sleepy_demo_mtd_CPPFLAGS = \
|
sleepy_demo_mtd_CPPFLAGS = \
|
||||||
$(CPPFLAGS_COMMON) \
|
$(CPPFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LDADD = \
|
sleepy_demo_mtd_LDADD = \
|
||||||
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
$(top_builddir)/src/cli/libopenthread-cli-mtd.a \
|
||||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(top_builddir)/src/core/libopenthread-mtd.a \
|
$(top_builddir)/src/core/libopenthread-mtd.a \
|
||||||
$(LDADD_COMMON) \
|
$(LDADD_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LDFLAGS = \
|
sleepy_demo_mtd_LDFLAGS = \
|
||||||
$(LDFLAGS_COMMON) \
|
$(LDFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_LIBTOOLFLAGS = \
|
sleepy_demo_mtd_LIBTOOLFLAGS = \
|
||||||
$(LIBTOOLFLAGS_COMMON) \
|
$(LIBTOOLFLAGS_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
sleepy_demo_mtd_SOURCES = \
|
sleepy_demo_mtd_SOURCES = \
|
||||||
$(SOURCES_COMMON) \
|
$(SOURCES_COMMON) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if OPENTHREAD_ENABLE_LINKER_MAP
|
if OPENTHREAD_ENABLE_LINKER_MAP
|
||||||
sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
|
sleepy_demo_mtd_LDFLAGS += -Wl,-Map=sleepy-demo-mtd.map
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_BUILD_COVERAGE
|
if OPENTHREAD_BUILD_COVERAGE
|
||||||
CPPFLAGS_COMMON += \
|
CPPFLAGS_COMMON += \
|
||||||
-DOPENTHREAD_ENABLE_COVERAGE \
|
-DOPENTHREAD_ENABLE_COVERAGE \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||||
endif # OPENTHREAD_BUILD_COVERAGE
|
endif # OPENTHREAD_BUILD_COVERAGE
|
||||||
|
|
||||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||||
|
|||||||
Vendored
+7
@@ -52,6 +52,13 @@ SUBDIRS += \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_EXAMPLES_EFR32MG13
|
||||||
|
SUBDIRS += \
|
||||||
|
silabs \
|
||||||
|
jlink \
|
||||||
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_EXAMPLES_EFR32MG21
|
if OPENTHREAD_EXAMPLES_EFR32MG21
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
silabs \
|
silabs \
|
||||||
|
|||||||
Vendored
+125
-91
@@ -29,120 +29,144 @@
|
|||||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||||
|
|
||||||
if OPENTHREAD_EXAMPLES_EFR32MG12
|
if OPENTHREAD_EXAMPLES_EFR32MG12
|
||||||
lib_LIBRARIES = \
|
lib_LIBRARIES = \
|
||||||
libsilabs-efr32mg12-sdk.a \
|
libsilabs-efr32mg12-sdk.a \
|
||||||
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if OPENTHREAD_EXAMPLES_EFR32MG13
|
||||||
|
lib_LIBRARIES = \
|
||||||
|
libsilabs-efr32mg13-sdk.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OPENTHREAD_EXAMPLES_EFR32MG21
|
if OPENTHREAD_EXAMPLES_EFR32MG21
|
||||||
lib_LIBRARIES = \
|
lib_LIBRARIES = \
|
||||||
libsilabs-efr32mg21-sdk.a \
|
libsilabs-efr32mg21-sdk.a \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Do not enable -Wconversion for Silicon Labs SDK sources
|
# Do not enable -Wconversion for Silicon Labs SDK sources
|
||||||
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wconversion,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wconversion,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -pedantic-errors for Silicon Labs SDK sources
|
# Do not enable -pedantic-errors for Silicon Labs SDK sources
|
||||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -Wshadow for Silicon Labs SDK sources
|
# Do not enable -Wshadow for Silicon Labs SDK sources
|
||||||
override CFLAGS := $(filter-out -Wshadow,$(CFLAGS))
|
override CFLAGS := $(filter-out -Wshadow,$(CFLAGS))
|
||||||
override CXXFLAGS := $(filter-out -Wshadow,$(CXXFLAGS))
|
override CXXFLAGS := $(filter-out -Wshadow,$(CXXFLAGS))
|
||||||
|
|
||||||
# Do not enable -Wundef for Silicon Labs SDK sources
|
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
||||||
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
|
||||||
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
|
||||||
|
|
||||||
EFR32_BOARD_DIR = $(shell echo $(BOARD) | tr A-Z a-z)
|
SDK_SRC_DIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
||||||
|
|
||||||
EFR32MG_SDK_SRCDIR = $(top_srcdir)/third_party/silabs/gecko_sdk_suite/v2.7
|
COMMONCPPFLAGS = \
|
||||||
|
-D__STARTUP_CLEAR_BSS \
|
||||||
COMMONCPPFLAGS = \
|
-I$(srcdir) \
|
||||||
-D__STARTUP_CLEAR_BSS \
|
-I$(top_srcdir)/include \
|
||||||
-I$(srcdir) \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(top_srcdir)/src/core \
|
-I$(top_srcdir)/examples/platforms \
|
||||||
-I$(top_srcdir)/third_party/silabs/rail_config \
|
-I$(top_srcdir)/include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR) \
|
-I$(top_srcdir)/src/core \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/common \
|
-I$(top_srcdir)/third_party/silabs/rail_config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32 \
|
-I$(SDK_SRC_DIR) \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/bsp \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
-I$(SDK_SRC_DIR)/hardware/kit/common/drivers \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/hal/efr32 \
|
-I$(SDK_SRC_DIR)/platform/base/hal/micro/cortexm3/efm32/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
-I$(SDK_SRC_DIR)/platform/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/common/bsp \
|
-I$(SDK_SRC_DIR)/platform/CMSIS/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/CMSIS/Include \
|
-I$(SDK_SRC_DIR)/platform/emdrv/common/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/common/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/gpiointerrupt/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/gpiointerrupt/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/uartdrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/uartdrv/config \
|
-I$(SDK_SRC_DIR)/platform/emdrv/ustimer/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/ustimer/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/inc \
|
-I$(SDK_SRC_DIR)/platform/emdrv/dmadrv/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emdrv/dmadrv/config \
|
-I$(SDK_SRC_DIR)/platform/emlib/inc \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/emlib/inc \
|
-I$(SDK_SRC_DIR)/platform/halconfig/inc/hal-config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/halconfig/inc/hal-config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/common/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/rf/common/cortex \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/mpu/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/common \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/inc \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/service/sleeptimer/config \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/hal/efr32 \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/util/plugin/plugin-common/fem-control \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/protocol/ieee802154 \
|
||||||
-Wno-unused-parameter \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/plugin/pa-conversions \
|
||||||
-Wno-missing-field-initializers \
|
-I$(SDK_SRC_DIR)/platform/service/mpu/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/config \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/service/sleeptimer/inc \
|
||||||
|
-I$(SDK_SRC_DIR)/util/plugin/plugin-common/fem-control \
|
||||||
|
-I$(SDK_SRC_DIR)/util/third_party/mbedtls/sl_crypto/include \
|
||||||
|
-Wno-unused-parameter \
|
||||||
|
-Wno-missing-field-initializers \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SILABS_EFR32MG12_CPPFLAGS = \
|
SILABS_EFR32MG12_CPPFLAGS = \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG12_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG12P/Include \
|
||||||
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SILABS_EFR32MG21_CPPFLAGS = \
|
SILABS_EFR32MG13_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG13_$(BOARD)/config \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG13P/Include \
|
||||||
-I$(EFR32MG_SDK_SRCDIR)/platform/Device/SiliconLabs/EFR32MG21P/Include \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg1x \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SILABS_COMMON_SOURCES = \
|
SILABS_EFR32MG21_CPPFLAGS = \
|
||||||
rail_config/rail_config.c \
|
-I$(SDK_SRC_DIR)/hardware/kit/EFR32MG21_$(BOARD)/config \
|
||||||
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_bcc.c \
|
-I$(SDK_SRC_DIR)/platform/Device/SiliconLabs/EFR32MG21P/Include \
|
||||||
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_init.c \
|
-I$(SDK_SRC_DIR)/platform/radio/rail_lib/chip/efr32/efr32xg2x \
|
||||||
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_stk.c \
|
|
||||||
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_stk_leds.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emdrv/dmadrv/src/dmadrv.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emdrv/gpiointerrupt/src/gpiointerrupt.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emdrv/uartdrv/src/uartdrv.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emdrv/ustimer/src/ustimer.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_adc.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_cmu.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_core.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_crypto.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_emu.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_gpio.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_ldma.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_leuart.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_msc.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_rmu.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_rtcc.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_system.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_timer.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/emlib/src/em_usart.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/radio/rail_lib/hal/efr32/hal_efr.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/radio/rail_lib/hal/hal_common.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/service/mpu/src/sl_mpu.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/service/sleeptimer/src/sl_sleeptimer.c \
|
|
||||||
gecko_sdk_suite/v2.7/platform/service/sleeptimer/src/sl_sleeptimer_hal_rtcc.c \
|
|
||||||
gecko_sdk_suite/v2.7/util/third_party/mbedtls/library/ecp.c \
|
|
||||||
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_aes.c \
|
|
||||||
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_ecp.c \
|
|
||||||
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_management.c \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SILABS_EFR32MG12_SOURCES = \
|
SILABS_COMMON_SOURCES = \
|
||||||
gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c \
|
rail_config/rail_config.c \
|
||||||
gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG12P/Source/GCC/startup_efr32mg12p.c \
|
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_bcc.c \
|
||||||
|
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_init.c \
|
||||||
|
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_stk.c \
|
||||||
|
gecko_sdk_suite/v2.7/hardware/kit/common/bsp/bsp_stk_leds.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emdrv/dmadrv/src/dmadrv.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emdrv/gpiointerrupt/src/gpiointerrupt.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emdrv/uartdrv/src/uartdrv.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emdrv/ustimer/src/ustimer.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_adc.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_cmu.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_core.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_crypto.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_emu.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_gpio.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_ldma.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_leuart.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_msc.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_rmu.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_rtcc.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_system.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_timer.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/emlib/src/em_usart.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/radio/rail_lib/hal/efr32/hal_efr.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/radio/rail_lib/hal/hal_common.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/service/mpu/src/sl_mpu.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/service/sleeptimer/src/sl_sleeptimer.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/service/sleeptimer/src/sl_sleeptimer_hal_rtcc.c \
|
||||||
|
gecko_sdk_suite/v2.7/util/third_party/mbedtls/library/ecp.c \
|
||||||
|
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_aes.c \
|
||||||
|
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_ecp.c \
|
||||||
|
gecko_sdk_suite/v2.7/util/third_party/mbedtls/sl_crypto/src/crypto_management.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
SILABS_EFR32MG12_SOURCES = \
|
||||||
|
gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG12P/Source/GCC/startup_efr32mg12p.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
SILABS_EFR32MG13_SOURCES = \
|
||||||
|
gecko_sdk_suite/v2.7/hardware/kit/common/drivers/mx25flash_spi.c \
|
||||||
|
gecko_sdk_suite/v2.7/hardware/kit/common/drivers/retargetserial.c \
|
||||||
|
gecko_sdk_suite/v2.7/platform/Device/SiliconLabs/EFR32MG13P/Source/system_efr32mg13p.c \
|
||||||
|
gecko_sdk_suite/v2.7//platform/Device/SiliconLabs/EFR32MG13P/Source/GCC/startup_efr32mg13p.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SILABS_EFR32MG21_SOURCES = \
|
SILABS_EFR32MG21_SOURCES = \
|
||||||
@@ -164,6 +188,16 @@ libsilabs_efr32mg12_sdk_a_SOURCES
|
|||||||
$(SILABS_EFR32MG12_SOURCES) \
|
$(SILABS_EFR32MG12_SOURCES) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
libsilabs_efr32mg13_sdk_a_CPPFLAGS = \
|
||||||
|
$(COMMONCPPFLAGS) \
|
||||||
|
$(SILABS_EFR32MG13_CPPFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
libsilabs_efr32mg13_sdk_a_SOURCES = \
|
||||||
|
$(SILABS_COMMON_SOURCES) \
|
||||||
|
$(SILABS_EFR32MG13_SOURCES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
libsilabs_efr32mg21_sdk_a_CPPFLAGS = \
|
libsilabs_efr32mg21_sdk_a_CPPFLAGS = \
|
||||||
$(COMMONCPPFLAGS) \
|
$(COMMONCPPFLAGS) \
|
||||||
$(SILABS_EFR32MG21_CPPFLAGS) \
|
$(SILABS_EFR32MG21_CPPFLAGS) \
|
||||||
|
|||||||
Reference in New Issue
Block a user