mirror of
https://github.com/espressif/openthread.git
synced 2026-09-08 18:20:06 +00:00
[examples] add k32w061 platform (#4930)
This commit is contained in:
+13
-11
@@ -43,7 +43,6 @@ BuildJobs ?= 10
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-cli \
|
||||
--enable-diag \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
@@ -61,14 +60,16 @@ JN5189_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||
JN5189_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"jn5189-mbedtls-config.h\"'
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/include/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/crypto
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/drivers/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/drivers/aes/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/drivers/sha/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/rom_apis/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189/dk6_jn5180/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/CMSIS/Include/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/middleware/mbedtls/port/ksdk/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/drivers/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/debug-console/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/str/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/drivers/components/serial_manager/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/drivers/components/uart/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/JN5189DK6/CMSIS/Include/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/
|
||||
JN5189_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls/
|
||||
@@ -77,8 +78,8 @@ TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-jn5189-config.h\"'
|
||||
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/jn5189/
|
||||
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/JN5189/ImageSigning/
|
||||
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/jn5189/
|
||||
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/JN5189DK6/tools/imagetool/
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
@@ -91,6 +92,7 @@ COMMONCFLAGS := \
|
||||
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
|
||||
-DSDK_DEBUGCONSOLE=0 \
|
||||
-D$(CONFIG_FILE) \
|
||||
-DUSE_RTOS=0 \
|
||||
-I$(CONFIG_FILE_PATH) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
Executable
+298
@@ -0,0 +1,298 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
AR = arm-none-eabi-ar
|
||||
CCAS = 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-diag \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
--with-ncp-bus=uart \
|
||||
--enable-radio-only \
|
||||
--enable-linker-map \
|
||||
--with-examples=k32w061 \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(DISABLE_BUILTIN_MBEDTLS), 1)
|
||||
configure_OPTIONS += MBEDTLS_CPPFLAGS="$(K32W061_MBEDTLS_CPPFLAGS)"
|
||||
endif
|
||||
|
||||
K32W061_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||
K32W061_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"k32w061-mbedtls-config.h\"'
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/include/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/drivers/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/debug-console/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/str/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/drivers/components/serial_manager/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/drivers/components/uart/
|
||||
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/nxp/K32W061DK6/CMSIS/Include/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/
|
||||
K32W061_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls/
|
||||
|
||||
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-k32w061-config.h\"'
|
||||
CONFIG_FILE_PATH = $(AbsTopSourceDir)/examples/platforms/k32w/k32w061/
|
||||
SIGN_IMAGE_PATH = $(AbsTopSourceDir)/third_party/nxp/K32W061DK6/tools/imagetool/
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
-g \
|
||||
-DCPU_K32W061HN \
|
||||
-DCPU_JN518X \
|
||||
-DCPU_JN518X_REV=2 \
|
||||
-DJENNIC_CHIP_FAMILY_JN518x \
|
||||
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
|
||||
-DSDK_DEBUGCONSOLE=0 \
|
||||
-D$(CONFIG_FILE) \
|
||||
-DUSE_RTOS=0 \
|
||||
-I$(CONFIG_FILE_PATH) \
|
||||
$(NULL)
|
||||
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-specs=nano.specs \
|
||||
-specs=nosys.specs \
|
||||
-Wl,--gc-sections \
|
||||
$(NULL)
|
||||
|
||||
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 = k32w061
|
||||
|
||||
ARCHS = cortex-m4
|
||||
|
||||
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
|
||||
TopTargetBinDir = $(TopResultDir)/$(TargetTuple)/bin
|
||||
|
||||
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 post-build-step
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(ECHO) " MKDIR $@"
|
||||
@$(MKDIR_P) "$@"
|
||||
|
||||
post-build-step:
|
||||
$(SIGN_IMAGE_PATH)/sign_images.sh $(TopTargetBinDir)
|
||||
|
||||
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) ""
|
||||
@@ -39,7 +39,7 @@ DIST_SUBDIRS = \
|
||||
efr32mg13 \
|
||||
efr32mg21 \
|
||||
gp712 \
|
||||
jn5189 \
|
||||
k32w \
|
||||
kw41z \
|
||||
nrf528xx \
|
||||
simulation \
|
||||
@@ -86,8 +86,8 @@ if OPENTHREAD_PLATFORM_GP712
|
||||
SUBDIRS += gp712
|
||||
endif
|
||||
|
||||
if OPENTHREAD_PLATFORM_JN5189
|
||||
SUBDIRS += jn5189
|
||||
if OPENTHREAD_PLATFORM_K32W
|
||||
SUBDIRS += k32w
|
||||
endif
|
||||
|
||||
if OPENTHREAD_PLATFORM_KW41Z
|
||||
|
||||
@@ -74,7 +74,11 @@ include $(top_srcdir)/examples/platforms/gp712/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_JN5189
|
||||
include $(top_srcdir)/examples/platforms/jn5189/Makefile.platform.am
|
||||
include $(top_srcdir)/examples/platforms/k32w/jn5189/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_K32W061
|
||||
include $(top_srcdir)/examples/platforms/k32w/k32w061/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_KW41Z
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-jn5189_plat.a \
|
||||
libopenthread-jn5189_sdk.a
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for jn5189 driver library
|
||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||
|
||||
# Do not enable -Wundef for jn5189 driver library
|
||||
override CFLAGS := $(filter-out -Wundef,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wundef,$(CXXFLAGS))
|
||||
|
||||
# Do not enable -Wcast-align for this platform
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
LIB_FLAGS = \
|
||||
-DCPU_JN518X \
|
||||
-DCPU_JN518X_REV=2 \
|
||||
-DJENNIC_CHIP_FAMILY_JN518x \
|
||||
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/nxp \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189 \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/crypto \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/drivers \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/rom_apis \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/dk6_jn5180 \
|
||||
-I$(top_srcdir)/third_party/nxp/CMSIS/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/uMac/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/Radio_JN5189/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/JennicCommon/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189/MicroSpecific/Include \
|
||||
-Wno-unknown-pragmas \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unused-function \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-empty-body \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_sdk_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_plat_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
diag.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
radio.c \
|
||||
entropy.c \
|
||||
system.c \
|
||||
uart.c \
|
||||
settings_jn5189.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_assert.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/crypto/aes_alt.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/crypto/ksdk_mbedtls.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_sdk_a_SOURCES = \
|
||||
@top_builddir@/third_party/nxp/JN5189/startup_JN5189.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/system_JN5189.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/dk6_jn5180/pin_mux.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/dk6_jn5180/clock_config.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_gpio.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_clock.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_ctimer.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_wtimer.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_flash.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_usart.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_rng.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_flexcomm.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_reset.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_power.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/fsl_debug_console.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/aes/fsl_aes.c \
|
||||
@top_builddir@/third_party/nxp/JN5189/drivers/sha/fsl_sha.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_plat_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_jn5189_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
libopenthread_jn5189_plat_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Use automake includes since we cannot use SUBDIRS feature due to cleanup
|
||||
# errors - few targets may use the same source file but dependency file is
|
||||
# created only once which leads to errors when auto-generated Makefile tries
|
||||
# to remove .Po files that were already removed
|
||||
|
||||
if OPENTHREAD_EXAMPLES_JN5189
|
||||
include jn5189/Makefile.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_K32W061
|
||||
include k32w061/Makefile.am
|
||||
endif
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
# OpenThread on K32W Example
|
||||
|
||||
This directory contains example platform drivers for [NXP Semiconductors K32W061 SoC][k32w061] and [NXP Semiconductors JN5189 SoC][jn5189].
|
||||
|
||||
[k32w061]: https://www.nxp.com/products/wireless/thread/k32w061-41-high-performance-secure-and-ultra-low-power-mcu-for-zigbeethread-and-bluetooth-le-5-0-with-built-in-nfc-option:K32W061_41
|
||||
[jn5189]: https://www.nxp.com/products/wireless/thread/jn5189-88-t-high-performance-and-ultra-low-power-mcus-for-zigbee-and-thread-with-built-in-nfc-option:JN5189_88_T
|
||||
|
||||
To learn more about building and running the examples please check:
|
||||
|
||||
- [OpenThread on K32W061 examples][k32w061-page]
|
||||
- [OpenThread on JN5189 examples][jn5189-page]
|
||||
|
||||
[k32w061-page]: ./k32w061/README.md
|
||||
[jn5189-page]: ./jn5189/README.md
|
||||
Executable
+140
@@ -0,0 +1,140 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
|
||||
lib_LIBRARIES = \
|
||||
libopenthread-jn5189_plat.a \
|
||||
libopenthread-jn5189_sdk.a
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for jn5189 driver library
|
||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||
|
||||
# Do not enable -Wcast-align for jn5189 driver library
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
LIB_FLAGS = \
|
||||
-DCPU_JN518X \
|
||||
-DCPU_JN518X_REV=2 \
|
||||
-DJENNIC_CHIP_FAMILY_JN518x \
|
||||
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
|
||||
-DUSE_RTOS=0 \
|
||||
-DgPWR_LDOMEM_0_9V_PD=0 \
|
||||
-DNO_SYSCORECLK_UPD=0 \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/nxp \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6 \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/devices/JN5189 \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/mbedtls/port/ksdk \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/components/serial_manager \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/components/uart \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/devices/JN5189/drivers \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/debug_console \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/devices/JN5189/utilities/str \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/boards/jn5189dk6/wireless_examples/openthread/enablement \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/CMSIS/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/ieee-802.15.4/uMac/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/DK6/Build/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/DK6 \
|
||||
-I$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/Common \
|
||||
-Wno-unknown-pragmas \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unused-function \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-empty-body \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_sdk_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_plat_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
src/alarm.c \
|
||||
src/diag.c \
|
||||
src/flash.c \
|
||||
src/logging.c \
|
||||
src/misc.c \
|
||||
src/radio.c \
|
||||
src/entropy.c \
|
||||
src/system.c \
|
||||
src/uart.c \
|
||||
src/settings_k32w.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/utilities/fsl_assert.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/middleware/mbedtls/port/ksdk/aes_alt.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/middleware/mbedtls/port/ksdk/ksdk_mbedtls.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_sdk_a_SOURCES = \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/mcuxpresso/startup_JN5189.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/system_JN5189.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/boards/jn5189dk6/wireless_examples/openthread/enablement/pin_mux.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/boards/jn5189dk6/wireless_examples/openthread/enablement/clock_config.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/components/serial_manager/serial_manager.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/components/serial_manager/serial_port_uart.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/components/uart/usart_adapter.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_gpio.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_clock.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_ctimer.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_wtimer.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_flash.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_usart.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_rng.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_flexcomm.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_reset.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_power.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_aes.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/drivers/fsl_sha.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/utilities/debug_console/fsl_debug_console.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/devices/JN5189/utilities/str/fsl_str.c \
|
||||
@top_builddir@/third_party/nxp/JN5189DK6/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_jn5189_plat_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_jn5189_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
libopenthread_jn5189_plat_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
+7
-8
@@ -30,14 +30,13 @@
|
||||
# JN5189 platform-specific Makefile
|
||||
#
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/jn5189/libopenthread-jn5189_plat.a \
|
||||
$(top_builddir)/examples/platforms/jn5189/libopenthread-jn5189_sdk.a \
|
||||
$(top_srcdir)/third_party/nxp/JN5189/libraries/libMiniMac.a \
|
||||
$(top_srcdir)/third_party/nxp/JN5189/libraries/libRadio.a \
|
||||
$(top_srcdir)/third_party/nxp/JN5189/libraries/libMicroSpecific_JN518x.a \
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/k32w/libopenthread-jn5189_plat.a \
|
||||
$(top_builddir)/examples/platforms/k32w/libopenthread-jn5189_sdk.a \
|
||||
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a \
|
||||
$(top_srcdir)/third_party/nxp/JN5189DK6/middleware/wireless/framework/XCVR/lib/libRadio.a \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/jn5189/jn5189.ld \
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/k32w/jn5189/jn5189.ld \
|
||||
$(NULL)
|
||||
@@ -1,6 +1,6 @@
|
||||
# OpenThread on NXP JN5189 Example
|
||||
|
||||
This directory contains example platform drivers for the [NXP JN5189][https://www.nxp.com/products/wireless/thread/jn5189-88-t-high-performance-and-ultra-low-power-mcus-for-zigbee-and-thread-with-built-in-nfc-option:jn5189_88_t] based on [JN5189-DK006][https://www.nxp.com/products/wireless/zigbee/advanced-development-kit-for-jn5189-88:jn5189-dk006] hardware platform.
|
||||
This directory contains example platform drivers for the [NXP JN5189][jn5189] based on [JN5189-DK006][jn5189-dk006] hardware platform.
|
||||
|
||||
The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.
|
||||
|
||||
@@ -19,7 +19,7 @@ $ ./script/bootstrap
|
||||
|
||||
If a network connection timeout is encountered, re-run the script.
|
||||
|
||||
Python-pip is also required for the build. User can install it by running "sudo apt-get install Python-pip" in bash. After installing Python-pip, execute "pip install PyCryptodome" in bash. This is needed for signing the built binary in order to load it on the board. Also, pycrypto "pip install pycrypto" is required for PKCS1.
|
||||
Python-pip is also required for the build. User can install it by running "sudo apt-get install Python-pip" in bash. After installing Python-pip, execute "pip install pycryptodome" in bash. This is needed for signing the built binary in order to load it on the board. Also, pycrypto "pip install pycrypto" is required for PKCS1.
|
||||
|
||||
Windows 10 offers the possibility of running bash by installing "Ubuntu on Windows" from Microsoft Store. This application allows the user to use Ubuntu Terminal and run Ubuntu command line utilities including bash, ssh, git, apt and many more. If this option is used, it is recommended to add instructions for the path mapping in MCUXpresso IDE. This can be done after adding the project to the workspace by going to Run->"Debug Configuration"->"C/C++(NXP Semiconductors) MCU Application"->Source->Add. Then the user should create a path mapping such that MCUXpresso IDE will find the mount point for the "Ubuntu in Windows" subsystem. For example, user can enter compilation path recognized by Ubuntu as /mnt/c/<path-to-openthread>, while equivalent "Local file system path" is C:/<path-to-openthread>. This example assumes that the openthread package is installed on the C drive.
|
||||
|
||||
@@ -39,13 +39,13 @@ Connect to the board by plugging a mini-USB cable to the connector marked with T
|
||||
|
||||
OpenThread example application compiled binaries can be found in `<path-to-openthread>/output/jn5189/bin` and include FTD (Full Thread Device) and MTD (Minimal Thread Device) variants of CLI and NCP applications. The compiled binaries can be flashed onto the JN5189 using MCUXpresso IDE. This requires the following steps:
|
||||
|
||||
1. Import the JN5189 SDK into MCUXpresso IDE. This can be done by dragging and dropping the SDK archive into MCUXpresso IDE's Installed SDKs tab. The archive for SDK_2.6.0_JN5189DK6 can be downloaded from https://mcuxpresso.nxp.com.
|
||||
1. Import the JN5189 SDK into MCUXpresso IDE. This can be done by dragging and dropping the SDK archive into MCUXpresso IDE's Installed SDKs tab. The archive for SDK_2.6.0_JN5189DK6 is available for download at https://mcuxpresso.nxp.com/en/welcome
|
||||
2. In MCUXpresso IDE, go to File->Import->C/C++->"Existing Code as Makefile Project" and click Next.
|
||||
3. Select the OpenThread folder as the "Existing Code Location". In the "Toolchain for Indexer Settings" list, be sure to keep the setting to "none". Click Finish.
|
||||
3. Select the OpenThread folder as the "Existing Code Location". In the "Toolchain for Indexer Settings" list, be sure to keep the setting to <none>. Click Finish.
|
||||
4. Right click on the newly created openthread project in the Workspace and go to Properties->"C/C++ Build"->"MCU Settings". Select the JN518x from the SDK MCUs list.
|
||||
5. Go to C/C++ Build->"Tool Chain Editor" and untick the "Display compatible toolchains only" checkbox. In the drop-down menu named "Current toolchain", select "NXP MCU Tools". Click "Apply and Close".
|
||||
6. Right click on the openthread project and select "Debug As"->"MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes"
|
||||
7. A window to select the binary will appear. Select "output/jn5189/bin/ot-<application>" and click Ok. Ignore the error message.
|
||||
7. A window to select the binary will appear. Select "output/jn5189/bin/ot-<application>" and click Ok.
|
||||
8. Under the menu bar, towards the center of the screen, there is a green bug icon with a drop-down arrow next to it. Click on the arrow and select "Debug Configurations".
|
||||
9. In the right side of the Debug Configurations window, go to "C/C++ (NXP Semiconductors) MCU Application"->"openthread LinkServer Default".
|
||||
10. Make sure that in the "C/C++ Application:" text box contains "output\jn5189\bin\ot-<application>" path.
|
||||
@@ -123,7 +123,3 @@ fe80:0:0:0:5c91:c61:b67c:271c
|
||||
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
|
||||
|
||||
## Known limitations
|
||||
|
||||
While running the build process in "Ubuntu on Windows" bash, user can encounter build errors from unknown reasons. The current workaround is to re-run the "make -f examples/Makefile-jn5189" command. NCP applications have not been tested.
|
||||
@@ -80,6 +80,7 @@ INT_STORAGE_SIZE = INT_STORAGE_END - INT_STORAGE_S
|
||||
|
||||
FREESCALE_PROD_DATA_BASE_ADDR = m_fsl_prodInfo_start;
|
||||
INT_STORAGE_SECTOR_SIZE = m_sector_size;
|
||||
m_app_size = 0x48000;
|
||||
|
||||
ENTRY(ResetISR)
|
||||
|
||||
+31
-11
@@ -115,9 +115,6 @@
|
||||
* Define to 1 if you want to use JN589 Flash implementation.
|
||||
*
|
||||
*/
|
||||
#ifdef OPENTHREAD_SETTINGS_RAM
|
||||
#undef OPENTHREAD_SETTINGS_RAM
|
||||
#endif
|
||||
#define OPENTHREAD_SETTINGS_RAM 1
|
||||
|
||||
/**
|
||||
@@ -128,6 +125,16 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 1024
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
|
||||
*
|
||||
* The size of heap buffer when DTLS is enabled.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
|
||||
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_COAP_API_ENABLE
|
||||
*
|
||||
@@ -136,14 +143,6 @@
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_COAP_API_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
|
||||
*
|
||||
* Define to 1 to enable the CoAP Secure API.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
*
|
||||
@@ -191,4 +190,25 @@
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the diag feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
#define OPENTHREAD_CONFIG_DIAG_ENABLE 0
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_JN5189_CONFIG_H_
|
||||
Executable
+142
@@ -0,0 +1,142 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# Copyright (c) 2019, NXP.
|
||||
# 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-k32w061_plat.a \
|
||||
libopenthread-k32w061_sdk.a
|
||||
$(NULL)
|
||||
|
||||
# Do not enable -pedantic-errors for k32w061 driver library
|
||||
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
|
||||
|
||||
# Do not enable -Wcast-align for k32w061 driver library
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
LIB_FLAGS = \
|
||||
-DCPU_K32W061HN \
|
||||
-DCPU_JN518X \
|
||||
-DCPU_JN518X_REV=2 \
|
||||
-DJENNIC_CHIP_FAMILY_JN518x \
|
||||
-DJENNIC_CHIP_FAMILY_NAME=_JN518x \
|
||||
-DUSE_RTOS=0 \
|
||||
-DgPWR_LDOMEM_0_9V_PD=0 \
|
||||
-DNO_SYSCORECLK_UPD=0 \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/third_party/nxp \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6 \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/devices/K32W061 \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/components/serial_manager \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/components/uart \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/devices/K32W061/drivers \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/debug_console \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/devices/K32W061/utilities/str \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/CMSIS/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/ieee-802.15.4/uMac/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/DK6/Build/Include \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/DK6 \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/Common/ \
|
||||
-I$(top_srcdir)/third_party/nxp/K32W061DK6/boards/k32w061dk6/wireless_examples/openthread/enablement \
|
||||
-Wno-unknown-pragmas \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unused-function \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-empty-body \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_k32w061_sdk_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_k32w061_plat_a_CPPFLAGS = \
|
||||
$(LIB_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
src/alarm.c \
|
||||
src/diag.c \
|
||||
src/flash.c \
|
||||
src/logging.c \
|
||||
src/misc.c \
|
||||
src/radio.c \
|
||||
src/entropy.c \
|
||||
src/system.c \
|
||||
src/uart.c \
|
||||
src/settings_k32w.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/utilities/fsl_assert.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk/aes_alt.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/middleware/mbedtls/port/ksdk/ksdk_mbedtls.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_k32w061_sdk_a_SOURCES = \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/mcuxpresso/startup_k32w061.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/system_K32W061.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/boards/k32w061dk6/wireless_examples/openthread/enablement/pin_mux.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/boards/k32w061dk6/wireless_examples/openthread/enablement/clock_config.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/components/serial_manager/serial_manager.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/components/serial_manager/serial_port_uart.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/components/uart/usart_adapter.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_gpio.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_clock.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_ctimer.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_wtimer.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_flash.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_usart.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_rng.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_flexcomm.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_reset.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_power.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_aes.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/drivers/fsl_sha.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/utilities/debug_console/fsl_debug_console.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/devices/K32W061/utilities/str/fsl_str.c \
|
||||
@top_builddir@/third_party/nxp/K32W061DK6/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_k32w061_plat_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
PRETTY_FILES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_k32w061_sdk_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
libopenthread_k32w061_plat_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# Copyright (c) 2019, NXP.
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
# K32W061 platform-specific Makefile
|
||||
#
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/k32w/libopenthread-k32w061_plat.a \
|
||||
$(top_builddir)/examples/platforms/k32w/libopenthread-k32w061_sdk.a \
|
||||
$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a \
|
||||
$(top_srcdir)/third_party/nxp/K32W061DK6/middleware/wireless/framework/XCVR/lib/libRadio.a \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/k32w/k32w061/k32w061.ld \
|
||||
$(NULL)
|
||||
Executable
+125
@@ -0,0 +1,125 @@
|
||||
# OpenThread on NXP K32W061 Example
|
||||
|
||||
This directory contains example platform drivers for the [NXP K32W061][k32w061] based on [K32W061-DK006][k32w061-dk006] hardware platform.
|
||||
|
||||
The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.
|
||||
|
||||
## Toolchain
|
||||
|
||||
OpenThread environment is suited to be run on a Linux-based OS. Recommended OS is Ubuntu 18.04.2 LTS. Download and install the [MCUXpresso IDE][mcuxpresso ide].
|
||||
|
||||
[mcuxpresso ide]: https://www.nxp.com/support/developer-resources/software-development-tools/mcuxpresso-software-and-tools/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE
|
||||
|
||||
In a Bash terminal (found, for example, in Ubuntu OS), follow these instructions to install the GNU toolchain and other dependencies.
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>
|
||||
$ ./script/bootstrap
|
||||
```
|
||||
|
||||
If a network connection timeout is encountered, re-run the script.
|
||||
|
||||
Python-pip is also required for the build. User can install it by running "sudo apt-get install python-pip" in bash. After installing Python-pip, execute "pip install pycryptodome" in bash. This is needed for signing the built binary in order to load it on the board. Also, pycrypto "pip install pycrypto" is required for PKCS1.
|
||||
|
||||
Windows 10 offers the possibility of running bash by installing "Ubuntu on Windows" from Microsoft Store. This application allows the user to use Ubuntu Terminal and run Ubuntu command line utilities including bash, ssh, git, apt and many more. If this option is used, it is recommended to add instructions for the path mapping in MCUXpresso IDE. This can be done after adding the project to the workspace by going to Run->"Debug Configuration"->"C/C++(NXP Semiconductors) MCU Application"->Source->Add. Then the user should create a path mapping such that MCUXpresso IDE will find the mount point for the "Ubuntu in Windows" subsystem. For example, user can enter compilation path recognized by Ubuntu as /mnt/c/<path-to-openthread>, while equivalent "Local file system path" is C:/<path-to-openthread>. This example assumes that the openthread package is installed on the C drive.
|
||||
|
||||
## Build Examples
|
||||
|
||||
```bash
|
||||
$ cd <path-to-openthread>
|
||||
$ ./bootstrap
|
||||
$ make -f examples/Makefile-k32w061
|
||||
```
|
||||
|
||||
After a successful build, the `elf` files are found in `<path-to-openthread>/output/k32w061/bin`.
|
||||
|
||||
## Flash Binaries
|
||||
|
||||
Connect to the board by plugging a mini-USB cable to the connector marked with TARGET on the DK6 board. This connector is situated on the same side with the power connector.
|
||||
|
||||
OpenThread example application compiled binaries can be found in `<path-to-openthread>/output/k32w061/bin` and include FTD (Full Thread Device) and MTD (Minimal Thread Device) variants of CLI and NCP applications. The compiled binaries can be flashed onto the K32W061 using MCUXpresso IDE. This requires the following steps:
|
||||
|
||||
1. Import the K32W061 SDK into MCUXpresso IDE. This can be done by dragging and dropping the SDK archive into MCUXpresso IDE's Installed SDKs tab. The archive for SDK_2.6.0_K32W061DK6 is available for download at https://mcuxpresso.nxp.com/en/welcome
|
||||
2. In MCUXpresso IDE, go to File->Import->C/C++->"Existing Code as Makefile Project" and click Next.
|
||||
3. Select the OpenThread folder as the "Existing Code Location". In the "Toolchain for Indexer Settings" list, be sure to keep the setting to <none>. Click Finish.
|
||||
4. Right click on the newly created openthread project in the Workspace and go to Properties->"C/C++ Build"->"MCU Settings". Select the JN518x from the SDK MCUs list.
|
||||
5. Go to C/C++ Build->"Tool Chain Editor" and untick the "Display compatible toolchains only" checkbox. In the drop-down menu named "Current toolchain", select "NXP MCU Tools". Click "Apply and Close".
|
||||
6. Right click on the openthread project and select "Debug As"->"MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes"
|
||||
7. A window to select the binary will appear. Select "output/k32w061/bin/ot-<application>" and click Ok.
|
||||
8. Under the menu bar, towards the center of the screen, there is a green bug icon with a drop-down arrow next to it. Click on the arrow and select "Debug Configurations".
|
||||
9. In the right side of the Debug Configurations window, go to "C/C++ (NXP Semiconductors) MCU Application"->"openthread LinkServer Default".
|
||||
10. Make sure that in the "C/C++ Application:" text box contains "output\k32w061\bin\ot-<application>" path.
|
||||
11. Go to "GUI Flash Tool" tab. In "Target Operations"->Program->Options, select "bin" as the "Format to use for programming". Make sure the "Base address" is 0x0.
|
||||
12. Click Debug.
|
||||
13. A pop-up window entitled "Errors in Workspace" will appear. Click Proceed.
|
||||
14. The board is now flashed.
|
||||
|
||||
[cmsis-dap]: https://os.mbed.com/handbook/CMSIS-DAP
|
||||
|
||||
## Running the example
|
||||
|
||||
1. Prepare two boards with the flashed `CLI Example` (as shown above). Make sure that the JN4 jumper is set to RX and the JN7 jumper is set to TX, connecting the LPC and JN UART0 pins.
|
||||
2. The CLI example uses UART connection. To view raw UART output, start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
|
||||
|
||||
- Baud rate: 115200
|
||||
- 8 data bits
|
||||
- 1 stop bit
|
||||
- No parity
|
||||
- No flow control
|
||||
|
||||
3. Open a terminal connection on the first board and start a new Thread network.
|
||||
|
||||
```bash
|
||||
> panid 0xabcd
|
||||
Done
|
||||
> ifconfig up
|
||||
Done
|
||||
> thread start
|
||||
Done
|
||||
```
|
||||
|
||||
4. After a couple of seconds the node will become a Leader of the network.
|
||||
|
||||
```bash
|
||||
> state
|
||||
Leader
|
||||
```
|
||||
|
||||
5. Open a terminal connection on the second board and attach a node to the network.
|
||||
|
||||
```bash
|
||||
> panid 0xabcd
|
||||
Done
|
||||
> ifconfig up
|
||||
Done
|
||||
> thread start
|
||||
Done
|
||||
```
|
||||
|
||||
6. After a couple of seconds the second node will attach and become a Child.
|
||||
|
||||
```bash
|
||||
> state
|
||||
Child
|
||||
```
|
||||
|
||||
7. List all IPv6 addresses of the first board.
|
||||
|
||||
```bash
|
||||
> ipaddr
|
||||
fdde:ad00:beef:0:0:ff:fe00:fc00
|
||||
fdde:ad00:beef:0:0:ff:fe00:9c00
|
||||
fdde:ad00:beef:0:4bcb:73a5:7c28:318e
|
||||
fe80:0:0:0:5c91:c61:b67c:271c
|
||||
```
|
||||
|
||||
8. Choose one of them and send an ICMPv6 ping from the second board.
|
||||
|
||||
```bash
|
||||
> ping fdde:ad00:beef:0:0:ff:fe00:fc00
|
||||
16 bytes from fdde:ad00:beef:0:0:ff:fe00:fc00: icmp_seq=1 hlim=64 time=8ms
|
||||
```
|
||||
|
||||
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
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef K32W061_MBEDTLS_CONFIG_H
|
||||
#define K32W061_MBEDTLS_CONFIG_H
|
||||
|
||||
#if defined(MBEDTLS_ECP_WINDOW_SIZE)
|
||||
#undef MBEDTLS_ECP_WINDOW_SIZE
|
||||
#define MBEDTLS_ECP_WINDOW_SIZE 4 /**< Maximum window size used */
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
|
||||
#undef MBEDTLS_ECP_FIXED_POINT_OPTIM
|
||||
#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_AES_ALT
|
||||
*
|
||||
* Enable hardware acceleration for the AES block cipher
|
||||
*
|
||||
* See MBEDTLS_AES_C for more information.
|
||||
*/
|
||||
#define MBEDTLS_AES_ALT
|
||||
|
||||
#if defined(MBEDTLS_AES_ALT)
|
||||
/**************************** KSDK ********************************************/
|
||||
#include "fsl_device_registers.h"
|
||||
|
||||
/* Enable LTC use in library if there is LTC on chip. */
|
||||
#if defined(FSL_FEATURE_SOC_LTC_COUNT) && (FSL_FEATURE_SOC_LTC_COUNT > 0)
|
||||
#include "fsl_ltc.h"
|
||||
|
||||
#define LTC_INSTANCE LTC0 /* LTC base register.*/
|
||||
|
||||
#if FSL_FEATURE_LTC_HAS_SHA
|
||||
#define MBEDTLS_FREESCALE_LTC_SHA1 /* Enable use of LTC SHA.*/
|
||||
#define MBEDTLS_FREESCALE_LTC_SHA256 /* Enable use of LTC SHA256.*/
|
||||
#endif
|
||||
#if defined(FSL_FEATURE_LTC_HAS_DES) && FSL_FEATURE_LTC_HAS_DES
|
||||
#define MBEDTLS_FREESCALE_LTC_DES /* Enable use of LTC DES.*/
|
||||
#endif
|
||||
#define MBEDTLS_FREESCALE_LTC_AES /* Enable use of LTC AES.*/
|
||||
#if defined(FSL_FEATURE_LTC_HAS_GCM) && FSL_FEATURE_LTC_HAS_GCM
|
||||
#define MBEDTLS_FREESCALE_LTC_AES_GCM /* Enable use of LTC AES GCM.*/
|
||||
#endif
|
||||
#if defined(FSL_FEATURE_LTC_HAS_PKHA) && FSL_FEATURE_LTC_HAS_PKHA
|
||||
#define MBEDTLS_FREESCALE_LTC_PKHA /* Enable use of LTC PKHA.*/
|
||||
#define FREESCALE_PKHA_INT_MAX_BYTES 256
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable MMCAU use in library if there is MMCAU on chip. */
|
||||
#if defined(FSL_FEATURE_SOC_MMCAU_COUNT) && (FSL_FEATURE_SOC_MMCAU_COUNT > 0)
|
||||
#include "fsl_mmcau.h"
|
||||
|
||||
#define MBEDTLS_FREESCALE_MMCAU_MD5 /* Enable use of MMCAU MD5.*/
|
||||
#define MBEDTLS_FREESCALE_MMCAU_SHA1 /* Enable use of MMCAU SHA1.*/
|
||||
#define MBEDTLS_FREESCALE_MMCAU_SHA256 /* Enable use of MMCAU SHA256.*/
|
||||
#define MBEDTLS_FREESCALE_MMCAU_DES /* Enable use of MMCAU DES, when LTC is disabled.*/
|
||||
#define MBEDTLS_FREESCALE_MMCAU_AES /* Enable use of MMCAU AES, when LTC is disabled.*/
|
||||
#endif
|
||||
|
||||
/* Enable CAU3 use in library if there is CAU3 on chip. */
|
||||
#if defined(FSL_FEATURE_SOC_CAU3_COUNT) && (FSL_FEATURE_SOC_CAU3_COUNT > 0)
|
||||
#include "cau3_pkha.h"
|
||||
#include "fsl_cau3.h"
|
||||
|
||||
#define MBEDTLS_CAU3_COMPLETION_SIGNAL CAU3_CC_CMD_EVT
|
||||
#define MBEDTLS_SHA256_ALT_NO_224
|
||||
|
||||
#define MBEDTLS_FREESCALE_CAU3_AES /* Enable use of CAU3 AES.*/
|
||||
#define MBEDTLS_FREESCALE_CAU3_SHA256 /* Enable use of CAU3 SHA256.*/
|
||||
#define MBEDTLS_FREESCALE_CAU3_PKHA /* Enable use of CAU3 PKHA.*/
|
||||
#define FREESCALE_PKHA_INT_MAX_BYTES 512
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_PKHA) || defined(MBEDTLS_FREESCALE_CAU3_PKHA)
|
||||
/*
|
||||
* This FREESCALE_PKHA_LONG_OPERANDS_ENABLE macro can be defined.
|
||||
* In such a case both software and hardware algorithm for TFM is linked in.
|
||||
* The decision for which algorithm is used is determined at runtime
|
||||
* from size of inputs. If inputs and result can fit into LTC (see FREESCALE_PKHA_INT_MAX_BYTES)
|
||||
* then we call hardware algorithm, otherwise we call software algorithm.
|
||||
*
|
||||
* Note that mbedTLS algorithms break modular operations unefficiently into two steps.
|
||||
* First is normal operation, for example non-modular multiply, which can produce number
|
||||
* with greater size than operands. Second is modular reduction.
|
||||
* The implication of this is that if for example FREESCALE_PKHA_INT_MAX_BYTES is 256 (2048 bits),
|
||||
* RSA-2048 still requires the FREESCALE_PKHA_LONG_OPERANDS_ENABLE macro to be defined,
|
||||
* otherwise it fails at runtime.
|
||||
*/
|
||||
//#define FREESCALE_PKHA_LONG_OPERANDS_ENABLE
|
||||
#endif
|
||||
|
||||
/* Enable AES use in library if there is AES on chip. */
|
||||
#if defined(FSL_FEATURE_SOC_AES_COUNT) && (FSL_FEATURE_SOC_AES_COUNT > 0)
|
||||
#include "fsl_aes.h"
|
||||
|
||||
#define AES_INSTANCE AES0 /* AES base register.*/
|
||||
#define MBEDTLS_FREESCALE_LPC_AES /* Enable use of LPC AES.*/
|
||||
#define MBEDTLS_FREESCALE_LPC_AES_GCM /* Enable use of LPC AES GCM.*/
|
||||
|
||||
#endif
|
||||
|
||||
/* Enable SHA use in library if there is SHA on chip. */
|
||||
#if defined(FSL_FEATURE_SOC_SHA_COUNT) && (FSL_FEATURE_SOC_SHA_COUNT > 0)
|
||||
#include "fsl_sha.h"
|
||||
|
||||
//#define SHA_INSTANCE SHA0 /* AES base register.*/
|
||||
#define MBEDTLS_FREESCALE_LPC_SHA1 /* Enable use of LPC SHA.*/
|
||||
//#define MBEDTLS_FREESCALE_LPC_SHA256 /* Enable use of LPC SHA256.*/
|
||||
|
||||
#endif
|
||||
|
||||
/* Define ALT MMCAU & LTC functions. Do not change it. */
|
||||
#if defined(MBEDTLS_FREESCALE_MMCAU_DES) || defined(MBEDTLS_FREESCALE_LTC_DES)
|
||||
#define MBEDTLS_DES_SETKEY_ENC_ALT
|
||||
#define MBEDTLS_DES_SETKEY_DEC_ALT
|
||||
#define MBEDTLS_DES_CRYPT_ECB_ALT
|
||||
#define MBEDTLS_DES3_CRYPT_ECB_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_DES)
|
||||
#define MBEDTLS_DES_CRYPT_CBC_ALT
|
||||
#define MBEDTLS_DES3_CRYPT_CBC_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_AES) || defined(MBEDTLS_FREESCALE_MMCAU_AES) || \
|
||||
defined(MBEDTLS_FREESCALE_LPC_AES) || defined(MBEDTLS_FREESCALE_CAU3_AES)
|
||||
#define MBEDTLS_AES_SETKEY_ENC_ALT
|
||||
#define MBEDTLS_AES_SETKEY_DEC_ALT
|
||||
#define MBEDTLS_AES_ENCRYPT_ALT
|
||||
#define MBEDTLS_AES_DECRYPT_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_AES)
|
||||
#define MBEDTLS_AES_CRYPT_CBC_ALT
|
||||
#define MBEDTLS_AES_CRYPT_CTR_ALT
|
||||
#define MBEDTLS_CCM_CRYPT_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_AES_GCM) || defined(MBEDTLS_FREESCALE_LPC_AES_GCM)
|
||||
#define MBEDTLS_GCM_CRYPT_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_PKHA) || defined(MBEDTLS_FREESCALE_CAU3_PKHA)
|
||||
#define MBEDTLS_MPI_ADD_ABS_ALT
|
||||
#define MBEDTLS_MPI_SUB_ABS_ALT
|
||||
#define MBEDTLS_MPI_MUL_MPI_ALT
|
||||
#define MBEDTLS_MPI_MOD_MPI_ALT
|
||||
#define MBEDTLS_MPI_EXP_MOD_ALT
|
||||
#define MBEDTLS_MPI_GCD_ALT
|
||||
#define MBEDTLS_MPI_INV_MOD_ALT
|
||||
#define MBEDTLS_MPI_IS_PRIME_ALT
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_PKHA)
|
||||
#define MBEDTLS_ECP_MUL_COMB_ALT
|
||||
#define MBEDTLS_ECP_ADD_ALT
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_SHA1) || defined(MBEDTLS_FREESCALE_LPC_SHA1)
|
||||
#define MBEDTLS_SHA1_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_SHA256) || defined(MBEDTLS_FREESCALE_LPC_SHA256)
|
||||
//#define MBEDTLS_SHA256_ALT
|
||||
/*
|
||||
* LPC SHA module does not support SHA-224.
|
||||
*
|
||||
* Since mbed TLS does not provide separate APIs for SHA-224 and SHA-256
|
||||
* and SHA-224 is not widely used, this implementation provides HW accelerated SHA-256 only
|
||||
* and SHA-224 is not available at all (calls will fail).
|
||||
*
|
||||
* To use SHA-224 on LPC, do not define MBEDTLS_SHA256_ALT and both SHA-224 and SHA-256 will use
|
||||
* original mbed TLS software implementation.
|
||||
*/
|
||||
#if defined(MBEDTLS_FREESCALE_LPC_SHA256)
|
||||
#define MBEDTLS_SHA256_ALT_NO_224
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_MMCAU_MD5)
|
||||
#define MBEDTLS_MD5_PROCESS_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_MMCAU_SHA1)
|
||||
#define MBEDTLS_SHA1_PROCESS_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_MMCAU_SHA256)
|
||||
#define MBEDTLS_SHA256_PROCESS_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_CAU3_SHA256)
|
||||
#define MBEDTLS_SHA256_PROCESS_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_CAU3_AES)
|
||||
#define MBEDTLS_AES_ALT_NO_192
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LTC_AES)
|
||||
#if !defined(FSL_FEATURE_LTC_HAS_AES192) || !FSL_FEATURE_LTC_HAS_AES192
|
||||
#define MBEDTLS_AES_ALT_NO_192
|
||||
#endif
|
||||
#if !defined(FSL_FEATURE_LTC_HAS_AES256) || !FSL_FEATURE_LTC_HAS_AES256
|
||||
#define MBEDTLS_AES_ALT_NO_256
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LPC_AES)
|
||||
#define MBEDTLS_AES_CRYPT_CBC_ALT
|
||||
#define MBEDTLS_AES_CRYPT_CFB_ALT
|
||||
#define MBEDTLS_AES_CRYPT_CTR_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LPC_SHA1)
|
||||
#define MBEDTLS_SHA1_PROCESS_ALT
|
||||
#endif
|
||||
#if defined(MBEDTLS_FREESCALE_LPC_SHA256)
|
||||
#define MBEDTLS_SHA256_PROCESS_ALT
|
||||
#endif
|
||||
|
||||
#if USE_RTOS && defined(FSL_RTOS_FREE_RTOS)
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
void *pvPortCalloc(size_t num, size_t size); /*Calloc for HEAP3.*/
|
||||
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC pvPortCalloc
|
||||
#define MBEDTLS_PLATFORM_STD_FREE vPortFree
|
||||
|
||||
#endif /* USE_RTOS*/
|
||||
/**************************** KSDK end ****************************************/
|
||||
#endif /* MBEDTLS_AES_ALT || MBEDTLS_SHA256_ALT */
|
||||
|
||||
#endif // K32W061_MBEDTLS_CONFIG_H
|
||||
Executable
+304
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* GCC linker script for K32W061.
|
||||
*/
|
||||
|
||||
/*
|
||||
* stack size for the boot rom during warm boot and application
|
||||
* 256 is sufficient (pwrm_test) but keep it large to 1024
|
||||
*/
|
||||
BOOT_RESUME_STACK_SIZE = 1024;
|
||||
|
||||
/* Set Stack size to 4K minus 32Bytes reserved for ROM code at end of BANK7 so
|
||||
the stack fits in BANK7. In practice the active stack size at the time of
|
||||
going to sleep is more important than the total available stack size */
|
||||
STACK_SIZE = (4096 - 32);
|
||||
|
||||
MEM_RAM0_BASE = 0x4000400;
|
||||
MEM_RAM0_SIZE = 0x0015c00;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* Define each memory region. RAM0 definition leaves the first 1kB for the
|
||||
boot code */
|
||||
Flash640 (rx) : ORIGIN = 0, LENGTH = 0x00a0000 /* 640K bytes (alias Flash) */
|
||||
RAM0 (rwx) : ORIGIN = 0x4000400, LENGTH = 0x0015c00 /* 87K bytes (alias RAM) */
|
||||
RAM1 (rwx) : ORIGIN = 0x4020000, LENGTH = 0x10000 /* 64K bytes (alias RAM2) */
|
||||
}
|
||||
|
||||
/* Define a symbol for the top of each memory region */
|
||||
__top_RAM0 = MEM_RAM0_BASE + MEM_RAM0_SIZE; /* 87K bytes */
|
||||
|
||||
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x2F4;
|
||||
|
||||
/*** flash memory characteristics definitions required for OTA ***/
|
||||
m_flash_start = 0x00000000;
|
||||
m_flash_end = 0x0009FFFF;
|
||||
m_flash_size = 0x000A0000;
|
||||
m_sector_size = 512;
|
||||
m_fsl_prodInfo_size = m_sector_size;
|
||||
|
||||
m_fsl_prodInfo_end = m_flash_size - 17 * m_sector_size - 1;
|
||||
m_fsl_prodInfo_start = m_fsl_prodInfo_end - m_fsl_prodInfo_size + 1;
|
||||
|
||||
NV_STORAGE_MAX_SECTORS = 64;
|
||||
NV_STORAGE_SIZE = NV_STORAGE_MAX_SECTORS * m_sector_size;
|
||||
NV_STORAGE_END_ADDRESS = m_fsl_prodInfo_start - 1;
|
||||
NV_STORAGE_START_ADDRESS = NV_STORAGE_END_ADDRESS - NV_STORAGE_SIZE + 1;
|
||||
|
||||
INT_STORAGE_END = NV_STORAGE_START_ADDRESS - 1;
|
||||
INT_STORAGE_START = 0x48000;
|
||||
INT_STORAGE_SIZE = INT_STORAGE_END - INT_STORAGE_START;
|
||||
|
||||
FREESCALE_PROD_DATA_BASE_ADDR = m_fsl_prodInfo_start;
|
||||
INT_STORAGE_SECTOR_SIZE = m_sector_size;
|
||||
m_app_size = 0x48000;
|
||||
|
||||
ENTRY(ResetISR)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* MAIN TEXT SECTION */
|
||||
.header : ALIGN(4)
|
||||
{
|
||||
_flash_start = ABSOLUTE(.);
|
||||
_flash_beg = ABSOLUTE(.);
|
||||
|
||||
FILL(0xff)
|
||||
__vectors_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.isr_vector))
|
||||
/* Global Section Table */
|
||||
. = ALIGN(4) ;
|
||||
__section_table_start = .;
|
||||
__data_section_table = .;
|
||||
LONG(LOADADDR(.data));
|
||||
LONG( ADDR(.data));
|
||||
LONG( SIZEOF(.data));
|
||||
LONG(LOADADDR(.data_RAM2));
|
||||
LONG( ADDR(.data_RAM2));
|
||||
LONG( SIZEOF(.data_RAM2));
|
||||
__data_section_table_end = .;
|
||||
__bss_section_table = .;
|
||||
LONG( ADDR(.bss));
|
||||
LONG( SIZEOF(.bss));
|
||||
LONG( ADDR(.bss_RAM2));
|
||||
LONG( SIZEOF(.bss_RAM2));
|
||||
__bss_section_table_end = .;
|
||||
__section_table_end = . ;
|
||||
/* End of Global Section Table */
|
||||
|
||||
FILL(0xff)
|
||||
. = ALIGN (0x10);
|
||||
} >Flash640
|
||||
|
||||
.ro_nonce : ALIGN(0x10)
|
||||
{
|
||||
_FlsNonceStart = ABSOLUTE(.);
|
||||
*(.ro_nonce) /* nonce value is 16 bytes.*/
|
||||
FILL(0xff)
|
||||
. = ALIGN (0x10);
|
||||
} > Flash640
|
||||
|
||||
.ro_ota_header : ALIGN(0x10)
|
||||
{
|
||||
_enc_start = ABSOLUTE(.);
|
||||
_enc_offset = (_enc_start & 0x0000000F);
|
||||
_FlsOtaHeader = ABSOLUTE(.);
|
||||
*(.ro_ota_header) /* Ota Header 69 bytes*/
|
||||
FILL(0xff)
|
||||
. = ALIGN (0x10);
|
||||
} > Flash640
|
||||
|
||||
.ro_se_lnkKey (ALIGN((. - _enc_offset), 16) + _enc_offset):
|
||||
{
|
||||
_FlsLinkKey = ABSOLUTE(.);
|
||||
*(.ro_se_lnkKey) /* Link Key 16 bytes*/
|
||||
FILL(0xff)
|
||||
. = ALIGN (0x10);
|
||||
} > Flash640
|
||||
|
||||
.filler :
|
||||
{
|
||||
BYTE(0xff)
|
||||
FILL(0xff);
|
||||
. = ALIGN(0x40);
|
||||
} > Flash640
|
||||
|
||||
.text : ALIGN(0x40)
|
||||
{
|
||||
FILL(0xff)
|
||||
|
||||
*(.after_vectors*)
|
||||
*(.text*)
|
||||
*(.rodata .rodata.* .constdata .constdata.*)
|
||||
. = ALIGN(4);
|
||||
} > Flash640
|
||||
/*
|
||||
* for exception handling/unwind - some Newlib functions (in common
|
||||
* with C++ and STDC++) use this.
|
||||
*/
|
||||
.ARM.extab : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > Flash640
|
||||
__exidx_start = .;
|
||||
|
||||
.ARM.exidx : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > Flash640
|
||||
__exidx_end = .;
|
||||
|
||||
_etext = .;
|
||||
|
||||
/* RAM1/RAM2 (different names for same thing) SECTION */
|
||||
/* RAM1 contents are specified before RAM0 as they have specific input
|
||||
sections and we do not want the RAM0 wildcards to catch them */
|
||||
/* DATA section for RAM1 */
|
||||
.data_RAM2 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM2 = .) ;
|
||||
*(.ramfunc.$RAM2)
|
||||
*(.ramfunc.$RAM1)
|
||||
*(.data.$RAM2*)
|
||||
*(.data.$RAM1*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM2 = .) ;
|
||||
} > RAM1 AT>Flash640
|
||||
|
||||
/* MAIN DATA SECTION */
|
||||
.uninit_RESERVED : ALIGN(4)
|
||||
{
|
||||
KEEP(*(.bss.$RESERVED*))
|
||||
. = ALIGN(4) ;
|
||||
_end_uninit_RESERVED = .;
|
||||
} > RAM0
|
||||
|
||||
/* Main DATA section (RAM0) */
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
_data = . ;
|
||||
*(vtable)
|
||||
*(.ramfunc*)
|
||||
*(.data*)
|
||||
. = ALIGN(4) ;
|
||||
_edata = . ;
|
||||
} > RAM0 AT>Flash640
|
||||
|
||||
|
||||
/* BSS section for RAM1 */
|
||||
.bss_RAM2 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM2 = .) ;
|
||||
*(.bss.$RAM2*)
|
||||
*(.bss.$RAM1*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM2 = .) ;
|
||||
} > RAM1
|
||||
|
||||
/* MAIN BSS SECTION */
|
||||
.bss (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
*(g_u32NwkFrameCounter)
|
||||
. = ALIGN(4) ;
|
||||
_ebss = .;
|
||||
|
||||
PROVIDE(end = .);
|
||||
} > RAM0
|
||||
|
||||
/* BSS section for MAC buffers */
|
||||
.bss_MAC (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
/* MAC buffer section: must be within 128kB block. __mac_buffer_base is
|
||||
defined further down to be on 128kB alignment */
|
||||
__mac_buffer_start = .;
|
||||
*(.mac_buffer)
|
||||
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
} > RAM0
|
||||
|
||||
/* HEAP */
|
||||
.heap (NOLOAD): ALIGN(4)
|
||||
{
|
||||
_heap = .;
|
||||
. += HEAP_SIZE;
|
||||
. = ALIGN(4) ;
|
||||
_end_heap = .;
|
||||
} > RAM0
|
||||
|
||||
/* NOINIT section for RAM1 */
|
||||
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
*(.noinit.$RAM2*)
|
||||
*(.noinit.$RAM1*)
|
||||
. = ALIGN(4) ;
|
||||
} > RAM1
|
||||
|
||||
/* DEFAULT NOINIT SECTION */
|
||||
.noinit (NOLOAD): ALIGN(4)
|
||||
{
|
||||
_noinit = .;
|
||||
*(.noinit*)
|
||||
. = ALIGN(4) ;
|
||||
_end_noinit = .;
|
||||
} > RAM0
|
||||
|
||||
/* stack for rom boot during warm resume */
|
||||
.boot_resume_stack (NOLOAD): ALIGN(4)
|
||||
{
|
||||
_boot_resume_stack = .;
|
||||
*(.boot_resume_stack*)
|
||||
. += BOOT_RESUME_STACK_SIZE;
|
||||
. = ALIGN(4) ;
|
||||
_end_boot_resume_stack = .;
|
||||
} > RAM0
|
||||
|
||||
__nv_storage_end_address = NV_STORAGE_END_ADDRESS;
|
||||
__nv_storage_start_address = NV_STORAGE_START_ADDRESS;
|
||||
|
||||
PROVIDE(_vStackTop = __top_RAM0 - 32);
|
||||
PROVIDE(__mac_buffer_base = (__mac_buffer_start & 0xfffe0000));
|
||||
PROVIDE(BOOT_GetStartPowerMode = 0x03000e9d);
|
||||
PROVIDE(ROM_GetFlash = 0x03000e0d);
|
||||
PROVIDE(pmc_reset_get_cause = 0x030046e9);
|
||||
PROVIDE(psector_ReadIeee802_15_4_MacId1 = 0x030053b1);
|
||||
PROVIDE(Chip_LOWPOWER_ChipSoftwareReset = 0x03003fa1);
|
||||
|
||||
__StackLimit = _vStackTop - STACK_SIZE;
|
||||
ASSERT(__StackLimit >= _end_boot_resume_stack, "Possible stack corruption with data/bss/boot_stack")
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_K32W061_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_K32W061_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform k32w061 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 k32w061 not configured to support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* OPENTHREAD_CORE_K32W061_CONFIG_CHECK_H_ */
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file includes k32w061 compile-time configuration constants
|
||||
* for OpenThread.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_K32W061_CONFIG_H_
|
||||
#define OPENTHREAD_CORE_K32W061_CONFIG_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LOG_OUTPUT
|
||||
*
|
||||
* The emsk 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_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "K32W061"
|
||||
|
||||
/**
|
||||
* @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 0x200
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_PAGE_NUM
|
||||
*
|
||||
* The page number of settings.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SETTINGS_CONFIG_PAGE_NUM 64
|
||||
|
||||
/**
|
||||
* @def RADIO_CONFIG_SRC_MATCH_ENTRY_NUM
|
||||
*
|
||||
* The number of source address table entries.
|
||||
*
|
||||
*/
|
||||
#define RADIO_CONFIG_SRC_MATCH_ENTRY_NUM 128
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT
|
||||
*
|
||||
* Define to 1 if you want to enable software retransmission logic.
|
||||
*
|
||||
*/
|
||||
/* TODO */
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_CSMA_BACKOFF
|
||||
*
|
||||
* Define to 1 if you want to enable software CSMA-CA backoff logic.
|
||||
*
|
||||
*/
|
||||
/* TODO */
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP UART support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_SETTINGS_RAM
|
||||
*
|
||||
* Define to 1 if you want to use K32W061 Flash implementation.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_SETTINGS_RAM 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE
|
||||
*
|
||||
* The size of NCP message buffer in bytes.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 1024
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
|
||||
*
|
||||
* The size of heap buffer when DTLS is enabled.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE
|
||||
#define OPENTHREAD_CONFIG_HEAP_INTERNAL_SIZE (2048 * sizeof(void *))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_COAP_API_ENABLE
|
||||
*
|
||||
* Define to 1 to enable the CoAP API.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_COAP_API_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_JOINER_ENABLE
|
||||
*
|
||||
* Define to 1 to enable Joiner support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_COMMISSIONER_ENABLE
|
||||
*
|
||||
* Define to 1 to enable Commissioner support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE
|
||||
*
|
||||
* Define to 1 to enable UDP forward support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
|
||||
*
|
||||
* Define to 1 to enable the Border Router service.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
|
||||
*
|
||||
* Define to 1 to enable the DHCP CLIENT service.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE
|
||||
*
|
||||
* Define to 1 to enable the DHCP SERVER service.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the time synchronization service feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
*
|
||||
* Define as 1 to enable the diag feature.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
#define OPENTHREAD_CONFIG_DIAG_ENABLE 0
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_K32W061_CONFIG_H_
|
||||
@@ -32,6 +32,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* Openthread configuration */
|
||||
#include OPENTHREAD_PROJECT_CORE_CONFIG_FILE
|
||||
|
||||
#include "fsl_clock.h"
|
||||
#include "fsl_ctimer.h"
|
||||
#include "fsl_device_registers.h"
|
||||
@@ -63,7 +66,7 @@ static ctimer_match_config_t sMatchConfig = {.enableCounterReset = false,
|
||||
static uint32_t sRemainingTicks;
|
||||
#endif
|
||||
|
||||
void JN5189AlarmInit(void)
|
||||
void K32WAlarmInit(void)
|
||||
{
|
||||
#if ALARM_USE_CTIMER
|
||||
ctimer_config_t config;
|
||||
@@ -99,7 +102,7 @@ void JN5189AlarmInit(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void JN5189AlarmClean(void)
|
||||
void K32WAlarmClean(void)
|
||||
{
|
||||
#if ALARM_USE_CTIMER
|
||||
CTIMER_StopTimer(CTIMER0);
|
||||
@@ -118,11 +121,11 @@ void JN5189AlarmClean(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void JN5189AlarmProcess(otInstance *aInstance)
|
||||
void K32WAlarmProcess(otInstance *aInstance)
|
||||
{
|
||||
if (sEventFired)
|
||||
{
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
if (otPlatDiagModeGet())
|
||||
{
|
||||
@@ -32,12 +32,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* Openthread configuration */
|
||||
#include OPENTHREAD_PROJECT_CORE_CONFIG_FILE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#if OPENTHREAD_ENABLE_DIAG
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
@@ -45,13 +48,13 @@
|
||||
*/
|
||||
static bool sDiagMode = false;
|
||||
|
||||
void otPlatDiagProcess(otInstance *aInstance, uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen)
|
||||
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
|
||||
// Add more platform specific diagnostics features here.
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", aArgs[0]);
|
||||
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
|
||||
}
|
||||
|
||||
void otPlatDiagModeSet(bool aMode)
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <utils/code_utils.h>
|
||||
|
||||
void JN5189RandomInit(void)
|
||||
void K32WRandomInit(void)
|
||||
{
|
||||
trng_config_t config;
|
||||
uint32_t seed;
|
||||
@@ -26,11 +26,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "openthread/platform/flash.h"
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_flash.h"
|
||||
#include "openthread-core-jn5189-config.h"
|
||||
#include "openthread-core-config.h"
|
||||
#include <utils/code_utils.h>
|
||||
#include <utils/flash.h>
|
||||
#include "openthread/platform/alarm-milli.h"
|
||||
|
||||
#define USE_MEM_COPY_FOR_READ 0
|
||||
@@ -50,8 +50,10 @@ static bool mapToNvFlashAddress(uint32_t *aAddress);
|
||||
static void copyFromFlash(uint8_t *pDst, uint8_t *pSrc, uint32_t cBytes);
|
||||
static uint32_t blankCheckAndErase(uint8_t *pageAddr);
|
||||
|
||||
otError utilsFlashInit(void)
|
||||
void otPlatFlashInit(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
extern uint32_t __nv_storage_start_address;
|
||||
extern uint32_t __nv_storage_end_address;
|
||||
|
||||
@@ -59,13 +61,6 @@ otError utilsFlashInit(void)
|
||||
|
||||
sNvFlashStartAddr = (uint32_t)&__nv_storage_start_address;
|
||||
sNvFlashEndAddr = (uint32_t)&__nv_storage_end_address;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
uint32_t utilsFlashGetSize(void)
|
||||
{
|
||||
return sNvFlashEndAddr - sNvFlashStartAddr;
|
||||
}
|
||||
|
||||
otError utilsFlashErasePage(uint32_t aAddress)
|
||||
@@ -91,31 +86,17 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError utilsFlashStatusWait(uint32_t aTimeout)
|
||||
{
|
||||
otError error = OT_ERROR_BUSY;
|
||||
uint32_t start = otPlatAlarmMilliGetNow();
|
||||
|
||||
do
|
||||
{
|
||||
if (FLASH->INT_STATUS & FLASH_DONE)
|
||||
{
|
||||
error = OT_ERROR_NONE;
|
||||
break;
|
||||
}
|
||||
} while (aTimeout && ((otPlatAlarmMilliGetNow() - start) < aTimeout));
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
uint32_t utilsFlashWrite(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||
void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
status_t status;
|
||||
uint32_t address = aAddress;
|
||||
uint32_t address = aOffset;
|
||||
uint32_t alignAddr;
|
||||
uint32_t bytes;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aSwapIndex);
|
||||
|
||||
/* Map address to NV Flash space and check boundaries */
|
||||
if (mapToNvFlashAddress(&address))
|
||||
{
|
||||
@@ -182,13 +163,21 @@ uint32_t utilsFlashWrite(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||
}
|
||||
|
||||
exit:
|
||||
return result;
|
||||
/* There are times when the result != 0.
|
||||
* Use this workaround until we replace the flash code with the Packet Data Manager.
|
||||
*/
|
||||
if (result)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t utilsFlashRead(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||
void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
|
||||
{
|
||||
uint32_t address = aAddress;
|
||||
uint32_t result = 0;
|
||||
uint32_t address = aOffset;
|
||||
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aSwapIndex);
|
||||
|
||||
/* Map address to NV Flash space and check boundaries */
|
||||
if (mapToNvFlashAddress(&address))
|
||||
@@ -197,11 +186,8 @@ uint32_t utilsFlashRead(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
|
||||
if ((address + aSize) <= sNvFlashEndAddr)
|
||||
{
|
||||
copyFromFlash(aData, (uint8_t *)address, aSize);
|
||||
result = aSize;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool mapToNvFlashAddress(uint32_t *aAddress)
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "platform-jn5189.h"
|
||||
#include "platform-k32w.h"
|
||||
#include <openthread-core-config.h>
|
||||
#include <utils/code_utils.h>
|
||||
#include <openthread/config.h>
|
||||
@@ -52,7 +52,7 @@
|
||||
#define EOL_CHARS_LEN 2 /* Length of EOL */
|
||||
|
||||
/* static functions */
|
||||
static void JN5189LogOutput(const char *aFormat, va_list ap);
|
||||
static void K32WLogOutput(const char *aFormat, va_list ap);
|
||||
|
||||
/* static variables */
|
||||
static char sTxBuffer[TX_BUFFER_SIZE + 1]; /* Transmit Buffer */
|
||||
@@ -64,7 +64,7 @@ OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, aFormat);
|
||||
JN5189LogOutput(aFormat, ap);
|
||||
K32WLogOutput(aFormat, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const
|
||||
* @param[in] ap Variable List Argument
|
||||
*
|
||||
*/
|
||||
static void JN5189LogOutput(const char *aFormat, va_list ap)
|
||||
static void K32WLogOutput(const char *aFormat, va_list ap)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -83,7 +83,7 @@ static void JN5189LogOutput(const char *aFormat, va_list ap)
|
||||
otEXPECT(len >= 0);
|
||||
memcpy(sTxBuffer + len, EOL_CHARS, EOL_CHARS_LEN);
|
||||
len += EOL_CHARS_LEN;
|
||||
JN5189WriteBlocking((const uint8_t *)sTxBuffer, len);
|
||||
K32WWriteBlocking((const uint8_t *)sTxBuffer, len);
|
||||
|
||||
exit:
|
||||
return;
|
||||
+10
-10
@@ -32,8 +32,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_KWJN5189_H_
|
||||
#define PLATFORM_KWJN5189_H_
|
||||
#ifndef PLATFORM_K32W_H_
|
||||
#define PLATFORM_K32W_H_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread/config.h>
|
||||
@@ -46,7 +46,7 @@
|
||||
* This function initializes the alarm service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void JN5189AlarmInit(void);
|
||||
void K32WAlarmInit(void);
|
||||
|
||||
/**
|
||||
* This function performs alarm driver processing.
|
||||
@@ -54,13 +54,13 @@ void JN5189AlarmInit(void);
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void JN5189AlarmProcess(otInstance *aInstance);
|
||||
void K32WAlarmProcess(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function initializes the radio service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void JN5189RadioInit(void);
|
||||
void K32WRadioInit(void);
|
||||
|
||||
/**
|
||||
* This function performs radio driver processing.
|
||||
@@ -68,19 +68,19 @@ void JN5189RadioInit(void);
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void JN5189RadioProcess(otInstance *aInstance);
|
||||
void K32WRadioProcess(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function initializes the random number service used by OpenThread.
|
||||
*
|
||||
*/
|
||||
void JN5189RandomInit(void);
|
||||
void K32WRandomInit(void);
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void JN5189UartProcess(void);
|
||||
void K32WUartProcess(void);
|
||||
|
||||
/**
|
||||
* This function performs UART Blocking Send
|
||||
@@ -89,5 +89,5 @@ void JN5189UartProcess(void);
|
||||
* @param[in] len Length of the above buffer
|
||||
*
|
||||
*/
|
||||
void JN5189WriteBlocking(const uint8_t *aBuf, uint32_t len);
|
||||
#endif // PLATFORM_JN5189_H_
|
||||
void K32WWriteBlocking(const uint8_t *aBuf, uint32_t len);
|
||||
#endif // PLATFORM_K32W_H_
|
||||
@@ -33,16 +33,15 @@
|
||||
*/
|
||||
|
||||
/* Openthread configuration */
|
||||
#include "openthread-core-jn5189-config.h"
|
||||
#include OPENTHREAD_PROJECT_CORE_CONFIG_FILE
|
||||
|
||||
/* memcpy */
|
||||
#include "string.h"
|
||||
|
||||
/* uMac, MMAC, Radio */
|
||||
#include "BbcAndPhyRegs.h"
|
||||
#include "MMAC.h"
|
||||
#include "MicroSpecific_arm_sdk2.h"
|
||||
#include "radio_jn518x.h"
|
||||
#include "radio.h"
|
||||
|
||||
/* Openthread general */
|
||||
#include <utils/code_utils.h>
|
||||
@@ -59,17 +58,17 @@ extern void BOARD_LedDongleToggle(void);
|
||||
|
||||
#define ALL_FFs_BYTE (0xFF)
|
||||
|
||||
#define JN5189_RADIO_MIN_TX_POWER_DBM (-30)
|
||||
#define JN5189_RADIO_MAX_TX_POWER_DBM (15)
|
||||
#define JN5189_RADIO_RX_SENSITIVITY_DBM (-100)
|
||||
#define JN5189_RADIO_DEFAULT_CHANNEL (11)
|
||||
#define K32W_RADIO_MIN_TX_POWER_DBM (-30)
|
||||
#define K32W_RADIO_MAX_TX_POWER_DBM (15)
|
||||
#define K32W_RADIO_RX_SENSITIVITY_DBM (-100)
|
||||
#define K32W_RADIO_DEFAULT_CHANNEL (11)
|
||||
|
||||
#define US_PER_SYMBOL (16) /* Duration of a single symbol in [us] */
|
||||
#define SYMBOLS_TO_US(symbols) ((symbols)*US_PER_SYMBOL)
|
||||
#define US_TO_MILI_DIVIDER (1000)
|
||||
|
||||
#define MAX_FP_ADDRS (10) /* max number of frame pending children */
|
||||
#define JN5189_RX_BUFFERS (8) /* max number of RX buffers */
|
||||
#define MAX_FP_ADDRS (10) /* max number of frame pending children */
|
||||
#define K32W_RX_BUFFERS (8) /* max number of RX buffers */
|
||||
|
||||
/* check IEEE Std. 802.15.4 - 2015: Table 8-81 - MAC sublayer constants */
|
||||
#define MAC_TX_ATTEMPTS (4)
|
||||
@@ -98,7 +97,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tsRxFrameFormat *buffer[JN5189_RX_BUFFERS];
|
||||
tsRxFrameFormat *buffer[K32W_RX_BUFFERS];
|
||||
uint8_t head;
|
||||
uint8_t tail;
|
||||
bool isFull;
|
||||
@@ -155,23 +154,23 @@ typedef enum
|
||||
} frameConversionType;
|
||||
|
||||
/* Private functions declaration */
|
||||
static void JN5189ISR(uint32_t u32IntBitmap);
|
||||
static void JN5189ProcessMacHeader(tsRxFrameFormat *aRxFrame);
|
||||
static void JN5189ProcessRxFrames(otInstance *aInstance);
|
||||
static void JN5189ProcessTxFrame(otInstance *aInstance);
|
||||
static bool JN5189CheckIfFpRequired(tsRxFrameFormat *aRxFrame);
|
||||
static bool_t JN5189IsDataReq(tsRxFrameFormat *aRxFrame);
|
||||
static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
otRadioFrame * aOtFrame,
|
||||
frameConversionType convType);
|
||||
static void JN5189Copy(uint8_t *aFieldValue, uint8_t **aPsdu, uint8_t copySize, frameConversionType convType);
|
||||
static void JN5189ResetRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, tsRxFrameFormat *aRxFrame);
|
||||
static tsRxFrameFormat *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static tsRxFrameFormat *JN5189GetFrame(tsRxFrameFormat *aRxFrame, uint8_t *aRxFrameIndex);
|
||||
static void JN5189EnableReceive(bool_t isNewFrameNeeded);
|
||||
static void JN5189RestartRx();
|
||||
static void K32WISR(uint32_t u32IntBitmap);
|
||||
static void K32WProcessMacHeader(tsRxFrameFormat *aRxFrame);
|
||||
static void K32WProcessRxFrames(otInstance *aInstance);
|
||||
static void K32WProcessTxFrame(otInstance *aInstance);
|
||||
static bool K32WCheckIfFpRequired(tsRxFrameFormat *aRxFrame);
|
||||
static bool_t K32WIsDataReq(tsRxFrameFormat *aRxFrame);
|
||||
static otError K32WFrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
otRadioFrame * aOtFrame,
|
||||
frameConversionType convType);
|
||||
static void K32WCopy(uint8_t *aFieldValue, uint8_t **aPsdu, uint8_t copySize, frameConversionType convType);
|
||||
static void K32WResetRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static void K32WPushRxRingBuffer(rxRingBuffer *aRxRing, tsRxFrameFormat *aRxFrame);
|
||||
static tsRxFrameFormat *K32WPopRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static bool K32WIsEmptyRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static tsRxFrameFormat *K32WGetFrame(tsRxFrameFormat *aRxFrame, uint8_t *aRxFrameIndex);
|
||||
static void K32WEnableReceive(bool_t isNewFrameNeeded);
|
||||
static void K32WRestartRx(void);
|
||||
|
||||
/* Private variables declaration */
|
||||
static otRadioState sState = OT_RADIO_STATE_DISABLED;
|
||||
@@ -192,7 +191,7 @@ static fpNeighExtAddr sFpExtAddr[MAX_FP_ADDRS]; /* Frame Pending extended addres
|
||||
static uint16_t sFpExtAddrMask; /* Mask - sFpExtAddr is valid */
|
||||
|
||||
static rxRingBuffer sRxRing; /* Receive Ring Buffer */
|
||||
static tsRxFrameFormat sRxFrame[JN5189_RX_BUFFERS]; /* RX Buffers */
|
||||
static tsRxFrameFormat sRxFrame[K32W_RX_BUFFERS]; /* RX Buffers */
|
||||
static tsRxFrameFormat *sRxFrameInProcess; /* RX Frame currently in processing */
|
||||
static bool_t sIsRxDisabled; /* TRUE if RX was disabled due to no RX bufs */
|
||||
static uint8_t sRxFrameIndex; /* Index tracking the sRxFrame array */
|
||||
@@ -247,10 +246,10 @@ void App_SetCustomEui64(uint8_t *aIeeeEui64)
|
||||
memcpy((uint8_t *)&sCustomExtAddr, aIeeeEui64, sizeof(sCustomExtAddr));
|
||||
}
|
||||
|
||||
void JN5189RadioInit(void)
|
||||
void K32WRadioInit(void)
|
||||
{
|
||||
/* RX initialization */
|
||||
memset(sRxFrame, 0, sizeof(tsRxFrameFormat) * JN5189_RX_BUFFERS);
|
||||
memset(sRxFrame, 0, sizeof(tsRxFrameFormat) * K32W_RX_BUFFERS);
|
||||
sRxFrameIndex = 0;
|
||||
|
||||
/* TX initialization */
|
||||
@@ -258,10 +257,10 @@ void JN5189RadioInit(void)
|
||||
sRxOtFrame.mPsdu = sRxData;
|
||||
}
|
||||
|
||||
void JN5189RadioProcess(otInstance *aInstance)
|
||||
void K32WRadioProcess(otInstance *aInstance)
|
||||
{
|
||||
JN5189ProcessRxFrames(aInstance);
|
||||
JN5189ProcessTxFrame(aInstance);
|
||||
K32WProcessRxFrames(aInstance);
|
||||
K32WProcessTxFrame(aInstance);
|
||||
}
|
||||
|
||||
otRadioState otPlatRadioGetState(otInstance *aInstance)
|
||||
@@ -321,10 +320,10 @@ otError otPlatRadioEnable(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
JN5189ResetRxRingBuffer(&sRxRing);
|
||||
K32WResetRxRingBuffer(&sRxRing);
|
||||
sRxFrameIndex = 0;
|
||||
vMMAC_Enable();
|
||||
vMMAC_EnableInterrupts(JN5189ISR);
|
||||
vMMAC_EnableInterrupts(K32WISR);
|
||||
vMMAC_ConfigureInterruptSources(E_MMAC_INT_TX_COMPLETE | E_MMAC_INT_RX_HEADER | E_MMAC_INT_RX_COMPLETE);
|
||||
vMMAC_ConfigureRadio();
|
||||
vMMAC_SetTxParameters(MAC_TX_ATTEMPTS, MAC_TX_CSMA_MIN_BE, MAC_TX_CSMA_MAX_BE, MAC_TX_CSMA_MAX_BACKOFFS);
|
||||
@@ -353,7 +352,7 @@ otError otPlatRadioDisable(otInstance *aInstance)
|
||||
|
||||
otEXPECT(otPlatRadioIsEnabled(aInstance));
|
||||
|
||||
JN5189ResetRxRingBuffer(&sRxRing);
|
||||
K32WResetRxRingBuffer(&sRxRing);
|
||||
sRxFrameIndex = 0;
|
||||
vMMAC_Disable();
|
||||
sState = OT_RADIO_STATE_DISABLED;
|
||||
@@ -425,7 +424,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
* in the middle of a receive operation */
|
||||
isNewFrameNeeded = FALSE;
|
||||
}
|
||||
JN5189EnableReceive(isNewFrameNeeded);
|
||||
K32WEnableReceive(isNewFrameNeeded);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -438,7 +437,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
||||
sIsFpEnabled = aEnable;
|
||||
}
|
||||
|
||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -483,7 +482,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -567,13 +566,13 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
|
||||
eOptions |= E_MMAC_TX_USE_CCA;
|
||||
}
|
||||
|
||||
JN5189FrameConversion(&sTxMacFrame, aFrame, otToMacFrame);
|
||||
K32WFrameConversion(&sTxMacFrame, aFrame, otToMacFrame);
|
||||
|
||||
/* stop rx is handled by uMac tx function */
|
||||
vMMAC_StartMacTransmit(&sTxMacFrame.sFrameBody, eOptions);
|
||||
|
||||
/* Set RX buffer pointer for ACK */
|
||||
vREG_BbcWrite(REG_BBC_RXBUFAD, (uint32)&sRxAckFrame.sFrameBody);
|
||||
vMMAC_SetRxFrame(&sRxAckFrame);
|
||||
|
||||
otPlatRadioTxStarted(aInstance, aFrame);
|
||||
|
||||
@@ -592,7 +591,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
|
||||
/* in RCP designs, the RSSI function is called while the radio is in
|
||||
* OT_RADIO_STATE_RECEIVE. Turn off the radio before reading RSSI,
|
||||
* otherwise we may end up waiting until a packet is received
|
||||
* (in i16Radio_JN518x_GetRSSI, while loop)
|
||||
* (in i16Radio_GetRSSI, while loop)
|
||||
*/
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
@@ -602,15 +601,15 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
|
||||
stateChanged = TRUE;
|
||||
}
|
||||
|
||||
rssiValSigned = i16Radio_Jn518x_GetRSSI(0, FALSE, NULL);
|
||||
rssiValSigned = i16Radio_GetRSSI(0, FALSE, NULL);
|
||||
|
||||
if (stateChanged)
|
||||
{
|
||||
sState = OT_RADIO_STATE_RECEIVE;
|
||||
JN5189EnableReceive(TRUE);
|
||||
K32WEnableReceive(TRUE);
|
||||
}
|
||||
|
||||
rssiValSigned = i16Radio_Jn518x_BoundRssiValue(rssiValSigned);
|
||||
rssiValSigned = i16Radio_BoundRssiValue(rssiValSigned);
|
||||
|
||||
/* RSSI reported by radio is in 1/4 dBm step,
|
||||
* meaning values are 4 times larger than real dBm value.
|
||||
@@ -681,13 +680,13 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
sState = OT_RADIO_STATE_SLEEP;
|
||||
|
||||
/* trim the values to the radio capabilities */
|
||||
if (aPower < JN5189_RADIO_MIN_TX_POWER_DBM)
|
||||
if (aPower < K32W_RADIO_MIN_TX_POWER_DBM)
|
||||
{
|
||||
aPower = JN5189_RADIO_MIN_TX_POWER_DBM;
|
||||
aPower = K32W_RADIO_MIN_TX_POWER_DBM;
|
||||
}
|
||||
else if (aPower > JN5189_RADIO_MAX_TX_POWER_DBM)
|
||||
else if (aPower > K32W_RADIO_MAX_TX_POWER_DBM)
|
||||
{
|
||||
aPower = JN5189_RADIO_MAX_TX_POWER_DBM;
|
||||
aPower = K32W_RADIO_MAX_TX_POWER_DBM;
|
||||
}
|
||||
|
||||
/* save for later use */
|
||||
@@ -701,8 +700,8 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the channel has not yet been initialized use JN5189_RADIO_DEFAULT_CHANNEL as default */
|
||||
vMMAC_SetChannelAndPower(JN5189_RADIO_DEFAULT_CHANNEL, aPower);
|
||||
/* if the channel has not yet been initialized use K32W_RADIO_DEFAULT_CHANNEL as default */
|
||||
vMMAC_SetChannelAndPower(K32W_RADIO_DEFAULT_CHANNEL, aPower);
|
||||
}
|
||||
sState = tempState;
|
||||
|
||||
@@ -729,7 +728,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return JN5189_RADIO_RX_SENSITIVITY_DBM;
|
||||
return K32W_RADIO_RX_SENSITIVITY_DBM;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -738,7 +737,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
* @param[in] u32IntBitmap Bitmap telling which interrupt fired
|
||||
*
|
||||
*/
|
||||
static void JN5189ISR(uint32_t u32IntBitmap)
|
||||
static void K32WISR(uint32_t u32IntBitmap)
|
||||
{
|
||||
tsRxFrameFormat *pRxFrame = NULL;
|
||||
|
||||
@@ -752,28 +751,28 @@ static void JN5189ISR(uint32_t u32IntBitmap)
|
||||
if (u32IntBitmap & E_MMAC_INT_RX_HEADER)
|
||||
{
|
||||
/* go back one index from current frame index */
|
||||
pRxFrame = &sRxFrame[(sRxFrameIndex + JN5189_RX_BUFFERS - 1) % JN5189_RX_BUFFERS];
|
||||
pRxFrame = &sRxFrame[(sRxFrameIndex + K32W_RX_BUFFERS - 1) % K32W_RX_BUFFERS];
|
||||
|
||||
/* FP processing first */
|
||||
JN5189ProcessMacHeader(pRxFrame);
|
||||
K32WProcessMacHeader(pRxFrame);
|
||||
|
||||
/* RX interrupt fired so it's safe to consume the frame */
|
||||
JN5189PushRxRingBuffer(&sRxRing, pRxFrame);
|
||||
K32WPushRxRingBuffer(&sRxRing, pRxFrame);
|
||||
|
||||
if (0 == (pRxFrame->sFrameBody.u16FCF & kFcfAckRequest))
|
||||
{
|
||||
JN5189EnableReceive(TRUE);
|
||||
K32WEnableReceive(TRUE);
|
||||
}
|
||||
}
|
||||
else if (u32IntBitmap & E_MMAC_INT_RX_COMPLETE)
|
||||
{
|
||||
JN5189EnableReceive(TRUE);
|
||||
K32WEnableReceive(TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* restart RX and keep same buffer as data received contains errors */
|
||||
JN5189EnableReceive(FALSE);
|
||||
K32WEnableReceive(FALSE);
|
||||
}
|
||||
|
||||
BOARD_LedDongleToggle();
|
||||
@@ -785,21 +784,21 @@ static void JN5189ISR(uint32_t u32IntBitmap)
|
||||
uint32_t txErrors = u32MMAC_GetTxErrors();
|
||||
sTxDone = TRUE;
|
||||
|
||||
if (txErrors & REG_BBC_TXSTAT_CCAE_MASK)
|
||||
if (txErrors & E_MMAC_TXSTAT_CCA_BUSY)
|
||||
{
|
||||
sTxStatus = OT_ERROR_CHANNEL_ACCESS_FAILURE;
|
||||
}
|
||||
else if (txErrors & REG_BBC_TXSTAT_ACKE_MASK)
|
||||
else if (txErrors & E_MMAC_TXSTAT_NO_ACK)
|
||||
{
|
||||
sTxStatus = OT_ERROR_NO_ACK;
|
||||
}
|
||||
else if (txErrors & REG_BBC_TXSTAT_OOTE_MASK)
|
||||
else if (txErrors & E_MMAC_TXSTAT_ABORTED)
|
||||
{
|
||||
sTxStatus = OT_ERROR_ABORT;
|
||||
}
|
||||
else if ((txErrors & REG_BBC_TXSTAT_TXPCTO_MASK) || (txErrors & REG_BBC_TXSTAT_TXTO_MASK))
|
||||
else if ((txErrors & E_MMAC_TXSTAT_TXPCTO) || (txErrors & E_MMAC_TXSTAT_TXTO))
|
||||
{
|
||||
/* The JN518x has a TXTO timeout that we are using to catch and cope with the curious
|
||||
/* The JN518x/K32W0x1 has a TXTO timeout that we are using to catch and cope with the curious
|
||||
hang-up issue */
|
||||
vMMAC_AbortRadio();
|
||||
|
||||
@@ -815,7 +814,7 @@ static void JN5189ISR(uint32_t u32IntBitmap)
|
||||
|
||||
BOARD_LedDongleToggle();
|
||||
sState = OT_RADIO_STATE_RECEIVE;
|
||||
JN5189EnableReceive(TRUE);
|
||||
K32WEnableReceive(TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -831,7 +830,7 @@ static void JN5189ISR(uint32_t u32IntBitmap)
|
||||
* @param[in] aRxFrame Pointer to the latest received MAC packet
|
||||
*
|
||||
*/
|
||||
static void JN5189ProcessMacHeader(tsRxFrameFormat *aRxFrame)
|
||||
static void K32WProcessMacHeader(tsRxFrameFormat *aRxFrame)
|
||||
{
|
||||
/* check if frame pending processing is required */
|
||||
if (aRxFrame && sIsFpEnabled)
|
||||
@@ -844,9 +843,9 @@ static void JN5189ProcessMacHeader(tsRxFrameFormat *aRxFrame)
|
||||
aRxFrame->sFrameBody.u16SrcPAN = aRxFrame->sFrameBody.u16DestPAN;
|
||||
}
|
||||
|
||||
if (JN5189IsDataReq(aRxFrame))
|
||||
if (K32WIsDataReq(aRxFrame))
|
||||
{
|
||||
vREG_BbcWrite(REG_BBC_TXPEND, JN5189CheckIfFpRequired(aRxFrame));
|
||||
vMMAC_SetTxPend(K32WCheckIfFpRequired(aRxFrame));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -864,7 +863,7 @@ static void JN5189ProcessMacHeader(tsRxFrameFormat *aRxFrame)
|
||||
* @return TRUE aRxFrame is a MAC Data Request Frame
|
||||
* @return FALSE aRxFrame is not a MAC Data Request Frame
|
||||
*/
|
||||
static bool_t JN5189IsDataReq(tsRxFrameFormat *aRxFrame)
|
||||
static bool_t K32WIsDataReq(tsRxFrameFormat *aRxFrame)
|
||||
{
|
||||
bool_t isDataReq = FALSE;
|
||||
uint8_t offset = 0;
|
||||
@@ -921,7 +920,7 @@ static bool_t JN5189IsDataReq(tsRxFrameFormat *aRxFrame)
|
||||
* @return FALSE Frame Pending bit shouldn't be set in the reply
|
||||
*
|
||||
*/
|
||||
static bool JN5189CheckIfFpRequired(tsRxFrameFormat *aRxFrame)
|
||||
static bool K32WCheckIfFpRequired(tsRxFrameFormat *aRxFrame)
|
||||
{
|
||||
bool isFpRequired = FALSE;
|
||||
uint16_t panId = aRxFrame->sFrameBody.u16SrcPAN;
|
||||
@@ -966,14 +965,14 @@ static bool JN5189CheckIfFpRequired(tsRxFrameFormat *aRxFrame)
|
||||
*
|
||||
* @param[in] aInstance Pointer to OT instance
|
||||
*/
|
||||
static void JN5189ProcessRxFrames(otInstance *aInstance)
|
||||
static void K32WProcessRxFrames(otInstance *aInstance)
|
||||
{
|
||||
tsRxFrameFormat *pRxMacFormatFrame = NULL;
|
||||
uint32_t savedInterrupts;
|
||||
|
||||
while ((pRxMacFormatFrame = JN5189PopRxRingBuffer(&sRxRing)) != NULL)
|
||||
while ((pRxMacFormatFrame = K32WPopRxRingBuffer(&sRxRing)) != NULL)
|
||||
{
|
||||
if (OT_ERROR_NONE == JN5189FrameConversion(pRxMacFormatFrame, &sRxOtFrame, macToOtFrame))
|
||||
if (OT_ERROR_NONE == K32WFrameConversion(pRxMacFormatFrame, &sRxOtFrame, macToOtFrame))
|
||||
{
|
||||
otPlatRadioReceiveDone(aInstance, &sRxOtFrame, OT_ERROR_NONE);
|
||||
}
|
||||
@@ -987,7 +986,7 @@ static void JN5189ProcessRxFrames(otInstance *aInstance)
|
||||
sRxFrameInProcess = NULL;
|
||||
if (sIsRxDisabled)
|
||||
{
|
||||
JN5189EnableReceive(TRUE);
|
||||
K32WEnableReceive(TRUE);
|
||||
}
|
||||
MICRO_RESTORE_INTERRUPTS(savedInterrupts);
|
||||
}
|
||||
@@ -998,14 +997,14 @@ static void JN5189ProcessRxFrames(otInstance *aInstance)
|
||||
*
|
||||
* @param[in] aInstance Pointer to OT instance
|
||||
*/
|
||||
static void JN5189ProcessTxFrame(otInstance *aInstance)
|
||||
static void K32WProcessTxFrame(otInstance *aInstance)
|
||||
{
|
||||
if (sTxDone)
|
||||
{
|
||||
sTxDone = FALSE;
|
||||
if ((sTxOtFrame.mPsdu[kMacFcfLowOffset] & kFcfAckRequest) && (OT_ERROR_NONE == sTxStatus))
|
||||
{
|
||||
JN5189FrameConversion(&sRxAckFrame, &sRxOtFrame, macToOtFrame);
|
||||
K32WFrameConversion(&sRxAckFrame, &sRxOtFrame, macToOtFrame);
|
||||
otPlatRadioTxDone(aInstance, &sTxOtFrame, &sRxOtFrame, sTxStatus);
|
||||
}
|
||||
else
|
||||
@@ -1025,9 +1024,9 @@ static void JN5189ProcessTxFrame(otInstance *aInstance)
|
||||
* @return OT_ERROR_NONE No conversion error
|
||||
* @return OT_ERROR_PARSE Conversion failed due to parsing error
|
||||
*/
|
||||
static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
otRadioFrame * aOtFrame,
|
||||
frameConversionType convType)
|
||||
static otError K32WFrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
otRadioFrame * aOtFrame,
|
||||
frameConversionType convType)
|
||||
{
|
||||
tsMacFrame *pMacFrame = &aMacFormatFrame->sFrameBody;
|
||||
uint8_t * pSavedStartRxPSDU = aOtFrame->mPsdu;
|
||||
@@ -1036,13 +1035,13 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
/* frame control field */
|
||||
JN5189Copy((uint8_t *)&pMacFrame->u16FCF, &pPsdu, kFcfSize, convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->u16FCF, &pPsdu, kFcfSize, convType);
|
||||
aFcf = pMacFrame->u16FCF;
|
||||
|
||||
/* sequence number */
|
||||
if (0 == (aFcf & kFcfSeqNbSuppresssion))
|
||||
{
|
||||
JN5189Copy(&pMacFrame->u8SequenceNum, &pPsdu, kDsnSize, convType);
|
||||
K32WCopy(&pMacFrame->u8SequenceNum, &pPsdu, kDsnSize, convType);
|
||||
}
|
||||
|
||||
/* destination Pan Id + address */
|
||||
@@ -1052,14 +1051,14 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
break;
|
||||
|
||||
case kFcfDstAddrShort:
|
||||
JN5189Copy((uint8_t *)&pMacFrame->u16DestPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uDestAddr.u16Short, &pPsdu, sizeof(otShortAddress), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->u16DestPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uDestAddr.u16Short, &pPsdu, sizeof(otShortAddress), convType);
|
||||
break;
|
||||
|
||||
case kFcfDstAddrExt:
|
||||
JN5189Copy((uint8_t *)&pMacFrame->u16DestPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uDestAddr.sExt.u32L, &pPsdu, sizeof(uint32_t), convType);
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uDestAddr.sExt.u32H, &pPsdu, sizeof(uint32_t), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->u16DestPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uDestAddr.sExt.u32L, &pPsdu, sizeof(uint32_t), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uDestAddr.sExt.u32H, &pPsdu, sizeof(uint32_t), convType);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1070,7 +1069,7 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
/* Source Pan Id */
|
||||
if ((aFcf & kFcfSrcAddrMask) != kFcfSrcAddrNone && (aFcf & kFcfPanidCompression) == 0)
|
||||
{
|
||||
JN5189Copy((uint8_t *)&pMacFrame->u16SrcPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->u16SrcPAN, &pPsdu, sizeof(otPanId), convType);
|
||||
}
|
||||
|
||||
/* Source Address */
|
||||
@@ -1080,12 +1079,12 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
break;
|
||||
|
||||
case kFcfSrcAddrShort:
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uSrcAddr.u16Short, &pPsdu, sizeof(otShortAddress), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uSrcAddr.u16Short, &pPsdu, sizeof(otShortAddress), convType);
|
||||
break;
|
||||
|
||||
case kFcfSrcAddrExt:
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uSrcAddr.sExt.u32L, &pPsdu, sizeof(uint32_t), convType);
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uSrcAddr.sExt.u32H, &pPsdu, sizeof(uint32_t), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uSrcAddr.sExt.u32L, &pPsdu, sizeof(uint32_t), convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uSrcAddr.sExt.u32H, &pPsdu, sizeof(uint32_t), convType);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1101,7 +1100,7 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
{
|
||||
aOtFrame->mInfo.mRxInfo.mAckedWithFramePending = (bool)aMacFormatFrame->sFrameBody.u16Unused;
|
||||
aOtFrame->mInfo.mRxInfo.mLqi = aMacFormatFrame->u8LinkQuality;
|
||||
aOtFrame->mInfo.mRxInfo.mRssi = i8Radio_Jn518x_GetLastPacketRSSI();
|
||||
aOtFrame->mInfo.mRxInfo.mRssi = i8Radio_GetLastPacketRSSI();
|
||||
aOtFrame->mChannel = sChannel;
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error Time sync requires the timestamp of SFD rather than that of rx done!
|
||||
@@ -1114,7 +1113,7 @@ static otError JN5189FrameConversion(tsRxFrameFormat * aMacFormatFrame,
|
||||
|
||||
aOtFrame->mLength = pPsdu + (pMacFrame->u8PayloadLength) - pSavedStartRxPSDU + sizeof(pMacFrame->u16FCS);
|
||||
}
|
||||
JN5189Copy((uint8_t *)&pMacFrame->uPayload, &pPsdu, pMacFrame->u8PayloadLength, convType);
|
||||
K32WCopy((uint8_t *)&pMacFrame->uPayload, &pPsdu, pMacFrame->u8PayloadLength, convType);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -1132,7 +1131,7 @@ exit:
|
||||
* @return OT_ERROR_NONE No conversion error
|
||||
* @return OT_ERROR_PARSE Conversion failed due to parsing error
|
||||
*/
|
||||
static void JN5189Copy(uint8_t *aFieldValue, uint8_t **aPsdu, uint8_t copySize, frameConversionType convType)
|
||||
static void K32WCopy(uint8_t *aFieldValue, uint8_t **aPsdu, uint8_t copySize, frameConversionType convType)
|
||||
{
|
||||
if (convType == macToOtFrame)
|
||||
{
|
||||
@@ -1151,7 +1150,7 @@ static void JN5189Copy(uint8_t *aFieldValue, uint8_t **aPsdu, uint8_t copySize,
|
||||
*
|
||||
* @param[in] aRxRing Pointer to an RX Ring Buffer
|
||||
*/
|
||||
static void JN5189ResetRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static void K32WResetRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
aRxRing->head = 0;
|
||||
aRxRing->tail = 0;
|
||||
@@ -1165,15 +1164,15 @@ static void JN5189ResetRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
* @param[in] aRxRing Pointer to the RX Ring Buffer
|
||||
* @param[in] rxFrame The address for a received frame
|
||||
*/
|
||||
static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, tsRxFrameFormat *aRxFrame)
|
||||
static void K32WPushRxRingBuffer(rxRingBuffer *aRxRing, tsRxFrameFormat *aRxFrame)
|
||||
{
|
||||
aRxRing->buffer[aRxRing->head] = aRxFrame;
|
||||
if (aRxRing->isFull)
|
||||
{
|
||||
aRxRing->tail = (aRxRing->tail + 1) % JN5189_RX_BUFFERS;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % K32W_RX_BUFFERS;
|
||||
}
|
||||
|
||||
aRxRing->head = (aRxRing->head + 1) % JN5189_RX_BUFFERS;
|
||||
aRxRing->head = (aRxRing->head + 1) % K32W_RX_BUFFERS;
|
||||
aRxRing->isFull = (aRxRing->head == aRxRing->tail);
|
||||
}
|
||||
|
||||
@@ -1188,17 +1187,17 @@ static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, tsRxFrameFormat *aRxFr
|
||||
* @return tsRxFrameFormat Pointer to a received frame
|
||||
* @return NULL In case the RX Ring buffer is empty
|
||||
*/
|
||||
static tsRxFrameFormat *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static tsRxFrameFormat *K32WPopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
tsRxFrameFormat *rxFrame = NULL;
|
||||
uint32_t savedInterrupts;
|
||||
|
||||
MICRO_DISABLE_AND_SAVE_INTERRUPTS(savedInterrupts);
|
||||
if (!JN5189IsEmptyRxRingBuffer(aRxRing))
|
||||
if (!K32WIsEmptyRxRingBuffer(aRxRing))
|
||||
{
|
||||
rxFrame = aRxRing->buffer[aRxRing->tail];
|
||||
aRxRing->isFull = FALSE;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % JN5189_RX_BUFFERS;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % K32W_RX_BUFFERS;
|
||||
}
|
||||
MICRO_RESTORE_INTERRUPTS(savedInterrupts);
|
||||
|
||||
@@ -1213,7 +1212,7 @@ static tsRxFrameFormat *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
* @return TRUE RX Ring Buffer is not empty
|
||||
* @return FALSE RX Ring Buffer is empty
|
||||
*/
|
||||
static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static bool K32WIsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
return (!aRxRing->isFull && (aRxRing->head == aRxRing->tail));
|
||||
}
|
||||
@@ -1230,14 +1229,14 @@ static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
*
|
||||
* @return tsRxFrameFormat Pointer to a tsRxFrameFormat
|
||||
*/
|
||||
static tsRxFrameFormat *JN5189GetFrame(tsRxFrameFormat *aRxFrame, uint8_t *aRxFrameIndex)
|
||||
static tsRxFrameFormat *K32WGetFrame(tsRxFrameFormat *aRxFrame, uint8_t *aRxFrameIndex)
|
||||
{
|
||||
tsRxFrameFormat *frame = NULL;
|
||||
|
||||
frame = &aRxFrame[*aRxFrameIndex];
|
||||
if (frame != sRxFrameInProcess)
|
||||
{
|
||||
*aRxFrameIndex = (*aRxFrameIndex + 1) % JN5189_RX_BUFFERS;
|
||||
*aRxFrameIndex = (*aRxFrameIndex + 1) % K32W_RX_BUFFERS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1262,21 +1261,21 @@ static tsRxFrameFormat *JN5189GetFrame(tsRxFrameFormat *aRxFrame, uint8_t *aRxFr
|
||||
* used for a new RX operation.
|
||||
*
|
||||
*/
|
||||
static void JN5189EnableReceive(bool_t isNewFrameNeeded)
|
||||
static void K32WEnableReceive(bool_t isNewFrameNeeded)
|
||||
{
|
||||
tsRxFrameFormat *pRxFrame = NULL;
|
||||
|
||||
if (isNewFrameNeeded)
|
||||
{
|
||||
if ((pRxFrame = JN5189GetFrame(sRxFrame, &sRxFrameIndex)) != NULL)
|
||||
if ((pRxFrame = K32WGetFrame(sRxFrame, &sRxFrameIndex)) != NULL)
|
||||
{
|
||||
vREG_BbcWrite(REG_BBC_RXBUFAD, (uint32)(&pRxFrame->sFrameBody));
|
||||
JN5189RestartRx();
|
||||
vMMAC_SetRxFrame(pRxFrame);
|
||||
K32WRestartRx();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JN5189RestartRx();
|
||||
K32WRestartRx();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1284,8 +1283,8 @@ static void JN5189EnableReceive(bool_t isNewFrameNeeded)
|
||||
* Function used for MMAC-RX Restart
|
||||
*
|
||||
*/
|
||||
static void JN5189RestartRx()
|
||||
static void K32WRestartRx(void)
|
||||
{
|
||||
vREG_BbcWrite(REG_BBC_RXPROM, ((uint32)sRxOpt >> 8) & ALL_FFs_BYTE);
|
||||
vMMAC_SetRxProm(((uint32)sRxOpt >> 8) & ALL_FFs_BYTE);
|
||||
vMMAC_RxCtlUpdate(((uint32)sRxOpt) & ALL_FFs_BYTE);
|
||||
}
|
||||
+21
-19
@@ -29,8 +29,8 @@
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread platform abstraction for non-volatile storage of
|
||||
* settings on JN5189 platform. It has been modified and optimized from the original
|
||||
* Open Thread settings implementation to work with JN5189's flash particularities.
|
||||
* settings on K32W platform. It has been modified and optimized from the original
|
||||
* Open Thread settings implementation to work with K32W's flash particularities.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "utils/code_utils.h"
|
||||
#include "utils/wrap_string.h"
|
||||
|
||||
#include "utils/flash.h"
|
||||
#include "openthread/platform/flash.h"
|
||||
|
||||
#define OT_FLASH_BLOCK_ADD_BEGIN_FLAG (1 << 0)
|
||||
#define OT_FLASH_BLOCK_ADD_COMPLETE_FLAG (1 << 1)
|
||||
@@ -60,7 +60,7 @@
|
||||
#define OT_SETTINGS_FLAG_SIZE 16
|
||||
#define OT_SETTINGS_BLOCK_DATA_SIZE 256
|
||||
|
||||
/* JN5189 erases the flash to value 0x00 */
|
||||
/* K32W erases the flash to value 0x00 */
|
||||
#define FLASH_ERASE_VALUE 0x00
|
||||
#define FLASH_ALIGN_SIZE 16
|
||||
#define FLASH_BLOCK_PAD1_SIZE 10
|
||||
@@ -68,6 +68,8 @@
|
||||
|
||||
#define OT_SETTINGS_IN_USE 0xbe5cc5ee
|
||||
|
||||
extern otError utilsFlashErasePage(uint32_t aAddress);
|
||||
|
||||
/* Added padding to make settings block structure align to minimum flash write size of 16 bytes.
|
||||
* The delFlag field has an offset of 16 bytes from the beginning of the structure to allow a new
|
||||
* write on the field. */
|
||||
@@ -179,7 +181,7 @@ static uint16_t getAlignLength(uint16_t currentPos, uint8_t blockFlag, uint16_t
|
||||
|
||||
static void setSettingsFlag(uint32_t aBase, uint32_t aFlag)
|
||||
{
|
||||
utilsFlashWrite(aBase, (uint8_t *)&aFlag, sizeof(aFlag));
|
||||
otPlatFlashWrite(0, 0, aBase, (uint8_t *)&aFlag, sizeof(aFlag));
|
||||
}
|
||||
|
||||
static void eraseSettings(uint32_t aBase)
|
||||
@@ -235,7 +237,7 @@ static uint32_t swapSettingsBlock(otInstance *aInstance)
|
||||
} OT_TOOL_PACKED_END addBlock;
|
||||
bool valid = true;
|
||||
|
||||
utilsFlashRead(swapAddress, (uint8_t *)(&addBlock.block), sizeof(struct settingsBlock));
|
||||
otPlatFlashRead(aInstance, 0, swapAddress, (uint8_t *)(&addBlock.block), sizeof(struct settingsBlock));
|
||||
swapAddress += sizeof(struct settingsBlock);
|
||||
tempFlag = addBlock.block.flag;
|
||||
|
||||
@@ -250,7 +252,7 @@ static uint32_t swapSettingsBlock(otInstance *aInstance)
|
||||
{
|
||||
struct settingsBlock block;
|
||||
|
||||
utilsFlashRead(address, (uint8_t *)(&block), sizeof(block));
|
||||
otPlatFlashRead(aInstance, 0, address, (uint8_t *)(&block), sizeof(block));
|
||||
|
||||
if ((FLASH_BLOCK_FLAG_IS_SET(block.flag, OT_FLASH_BLOCK_ADD_COMPLETE_FLAG)) &&
|
||||
(0 == FLASH_BLOCK_FLAG_IS_SET(block.delFlag, OT_FLASH_BLOCK_DELETE_FLAG)) &&
|
||||
@@ -281,7 +283,7 @@ static uint32_t swapSettingsBlock(otInstance *aInstance)
|
||||
/* current pos parameter doesn't count in this case */
|
||||
writeSize += getAlignLength(0, OT_FLASH_BLOCK_COMPACT_FLAG, addBlock.block.length);
|
||||
|
||||
utilsFlashRead(swapAddress, addBlock.data, addBlock.block.length);
|
||||
otPlatFlashRead(aInstance, 0, swapAddress, addBlock.data, addBlock.block.length);
|
||||
/* contents fits in current page - we can copy it to page buffer until there is
|
||||
* enough data to program a page */
|
||||
if ((sSettingsUsedSize % SETTINGS_CONFIG_PAGE_SIZE) + writeSize <= SETTINGS_CONFIG_PAGE_SIZE)
|
||||
@@ -302,7 +304,7 @@ static uint32_t swapSettingsBlock(otInstance *aInstance)
|
||||
/* calculate page address that we are going to write */
|
||||
uint32_t alignAddress = sSettingsBaseAddress + sSettingsUsedSize;
|
||||
alignAddress = alignAddress - (alignAddress % SETTINGS_CONFIG_PAGE_SIZE);
|
||||
utilsFlashWrite(alignAddress, pageBuffer, SETTINGS_CONFIG_PAGE_SIZE);
|
||||
otPlatFlashWrite(aInstance, 0, alignAddress, pageBuffer, SETTINGS_CONFIG_PAGE_SIZE);
|
||||
|
||||
/* After the page buffer is erased copy what dind't fit the previous page */
|
||||
memset(pageBuffer, FLASH_ERASE_VALUE, SETTINGS_CONFIG_PAGE_SIZE);
|
||||
@@ -324,7 +326,7 @@ static uint32_t swapSettingsBlock(otInstance *aInstance)
|
||||
/* If the page buffer has been used and it's not full write to flash at the end */
|
||||
uint32_t alignAddr = sSettingsBaseAddress + sSettingsUsedSize;
|
||||
alignAddr = alignAddr - (alignAddr % SETTINGS_CONFIG_PAGE_SIZE);
|
||||
utilsFlashWrite(alignAddr, pageBuffer, SETTINGS_CONFIG_PAGE_SIZE);
|
||||
otPlatFlashWrite(aInstance, 0, alignAddr, pageBuffer, SETTINGS_CONFIG_PAGE_SIZE);
|
||||
}
|
||||
/* Clear the old settings zone */
|
||||
eraseSettings(oldBase);
|
||||
@@ -375,8 +377,8 @@ static otError addSetting(otInstance * aInstance,
|
||||
memcpy(addBlock.data, aValue, addBlock.block.length);
|
||||
|
||||
SET_FLASH_BLOCK_FLAG(addBlock.block.flag, OT_FLASH_BLOCK_ADD_COMPLETE_FLAG);
|
||||
utilsFlashWrite(sSettingsBaseAddress + sSettingsUsedSize, (uint8_t *)(&addBlock.block),
|
||||
sizeof(struct settingsBlock) + addBlock.block.length);
|
||||
otPlatFlashWrite(aInstance, 0, sSettingsBaseAddress + sSettingsUsedSize, (uint8_t *)(&addBlock.block),
|
||||
sizeof(struct settingsBlock) + addBlock.block.length);
|
||||
/* The next settings block will be written to the next flash page to optimize the number of
|
||||
* writes made to a page */
|
||||
sSettingsUsedSize +=
|
||||
@@ -400,14 +402,14 @@ void otPlatSettingsInit(otInstance *aInstance)
|
||||
|
||||
sSettingsBaseAddress = SETTINGS_CONFIG_BASE_ADDRESS;
|
||||
|
||||
utilsFlashInit();
|
||||
otPlatFlashInit(aInstance);
|
||||
|
||||
for (index = 0; index < 2; index++)
|
||||
{
|
||||
uint32_t blockFlag;
|
||||
|
||||
sSettingsBaseAddress += settingsSize * index;
|
||||
utilsFlashRead(sSettingsBaseAddress, (uint8_t *)(&blockFlag), sizeof(blockFlag));
|
||||
otPlatFlashRead(aInstance, 0, sSettingsBaseAddress, (uint8_t *)(&blockFlag), sizeof(blockFlag));
|
||||
|
||||
if (blockFlag == OT_SETTINGS_IN_USE)
|
||||
{
|
||||
@@ -424,7 +426,7 @@ void otPlatSettingsInit(otInstance *aInstance)
|
||||
|
||||
while (sSettingsUsedSize < settingsSize)
|
||||
{
|
||||
utilsFlashRead(sSettingsBaseAddress + sSettingsUsedSize, (uint8_t *)(&block), sizeof(block));
|
||||
otPlatFlashRead(aInstance, 0, sSettingsBaseAddress + sSettingsUsedSize, (uint8_t *)(&block), sizeof(block));
|
||||
|
||||
if (FLASH_BLOCK_FLAG_IS_SET(block.flag, OT_FLASH_BLOCK_ADD_BEGIN_FLAG))
|
||||
{
|
||||
@@ -477,7 +479,7 @@ otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint
|
||||
{
|
||||
struct settingsBlock block;
|
||||
|
||||
utilsFlashRead(address, (uint8_t *)(&block), sizeof(block));
|
||||
otPlatFlashRead(aInstance, 0, address, (uint8_t *)(&block), sizeof(block));
|
||||
|
||||
if (block.key == aKey)
|
||||
{
|
||||
@@ -502,7 +504,7 @@ otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint
|
||||
readLength = *aValueLength;
|
||||
}
|
||||
|
||||
utilsFlashRead(address + sizeof(struct settingsBlock), aValue, readLength);
|
||||
otPlatFlashRead(aInstance, 0, address + sizeof(struct settingsBlock), aValue, readLength);
|
||||
}
|
||||
|
||||
valueLength = block.length;
|
||||
@@ -550,7 +552,7 @@ otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
|
||||
{
|
||||
struct settingsBlock block;
|
||||
|
||||
utilsFlashRead(address, (uint8_t *)(&block), sizeof(block));
|
||||
otPlatFlashRead(aInstance, 0, address, (uint8_t *)(&block), sizeof(block));
|
||||
|
||||
if (block.key == aKey)
|
||||
{
|
||||
@@ -579,7 +581,7 @@ otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
|
||||
|
||||
if (flashWrite)
|
||||
{
|
||||
utilsFlashWrite(address, (uint8_t *)(&block), sizeof(block));
|
||||
otPlatFlashWrite(aInstance, 0, address, (uint8_t *)(&block), sizeof(block));
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -33,7 +33,7 @@
|
||||
*/
|
||||
#include "board.h"
|
||||
#include "pin_mux.h"
|
||||
#include "platform-jn5189.h"
|
||||
#include "platform-k32w.h"
|
||||
#include "openthread/platform/uart.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -59,9 +59,9 @@ void otSysInit(int argc, char *argv[])
|
||||
BOARD_InitPins();
|
||||
}
|
||||
|
||||
JN5189AlarmInit();
|
||||
JN5189RandomInit();
|
||||
JN5189RadioInit();
|
||||
K32WAlarmInit();
|
||||
K32WRandomInit();
|
||||
K32WRadioInit();
|
||||
}
|
||||
|
||||
bool otSysPseudoResetWasRequested(void)
|
||||
@@ -77,9 +77,9 @@ void otSysDeinit(void)
|
||||
|
||||
void otSysProcessDrivers(otInstance *aInstance)
|
||||
{
|
||||
JN5189RadioProcess(aInstance);
|
||||
JN5189UartProcess();
|
||||
JN5189AlarmProcess(aInstance);
|
||||
K32WRadioProcess(aInstance);
|
||||
K32WUartProcess();
|
||||
K32WAlarmProcess(aInstance);
|
||||
}
|
||||
|
||||
void otSysEventSignalPending(void)
|
||||
@@ -43,13 +43,13 @@
|
||||
#include "openthread/platform/uart.h"
|
||||
|
||||
/* Defines */
|
||||
#define JN5189_UART_RX_BUFFERS 256
|
||||
#define JN5189_UART_BAUD_RATE 115200
|
||||
#define K32W_UART_RX_BUFFERS 256
|
||||
#define K32W_UART_BAUD_RATE 115200
|
||||
|
||||
/* Structures */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t buffer[JN5189_UART_RX_BUFFERS];
|
||||
uint8_t buffer[K32W_UART_RX_BUFFERS];
|
||||
uint8_t head;
|
||||
uint8_t tail;
|
||||
bool isFull;
|
||||
@@ -60,15 +60,15 @@ typedef enum
|
||||
{
|
||||
UART_IDLE, /* TX idle. */
|
||||
UART_BUSY, /* TX busy. */
|
||||
} jn5189UartStates;
|
||||
} K32WUartStates;
|
||||
|
||||
/* Private functions declaration */
|
||||
static void JN5189ResetRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static uint8_t *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, uint8_t aCharacter);
|
||||
static void JN5189ProcessReceive();
|
||||
static void JN5189ProcessTransmit();
|
||||
static void K32WResetRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static uint8_t *K32WPopRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static bool K32WIsEmptyRxRingBuffer(rxRingBuffer *aRxRing);
|
||||
static void K32WPushRxRingBuffer(rxRingBuffer *aRxRing, uint8_t aCharacter);
|
||||
static void K32WProcessReceive(void);
|
||||
static void K32WProcessTransmit(void);
|
||||
static void USART0_IRQHandler(USART_Type *base, usart_handle_t *handle);
|
||||
|
||||
/* Private variables declaration */
|
||||
@@ -77,12 +77,12 @@ static bool sIsTransmitDone; /* Transmit done for the latest user-d
|
||||
static usart_handle_t sUartHandle; /* Handle to the UART module */
|
||||
static rxRingBuffer sUartRxRing; /* Receive Ring Buffer */
|
||||
|
||||
void JN5189UartProcess(void)
|
||||
void K32WUartProcess(void)
|
||||
{
|
||||
if (sIsUartInitialized)
|
||||
{
|
||||
JN5189ProcessTransmit();
|
||||
JN5189ProcessReceive();
|
||||
K32WProcessTransmit();
|
||||
K32WProcessReceive();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ otError otPlatUartEnable(void)
|
||||
sUartHandle.txState = UART_IDLE;
|
||||
|
||||
USART_GetDefaultConfig(&config);
|
||||
config.baudRate_Bps = JN5189_UART_BAUD_RATE;
|
||||
config.baudRate_Bps = K32W_UART_BAUD_RATE;
|
||||
config.enableTx = true;
|
||||
config.enableRx = true;
|
||||
config.rxWatermark = kUSART_RxFifo1;
|
||||
@@ -112,7 +112,7 @@ otError otPlatUartEnable(void)
|
||||
uartStatus = USART_Init(USART0, &config, kPlatformClock);
|
||||
otEXPECT_ACTION(uartStatus == kStatus_Success, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
JN5189ResetRxRingBuffer(&sUartRxRing);
|
||||
K32WResetRxRingBuffer(&sUartRxRing);
|
||||
|
||||
FLEXCOMM_SetIRQHandler(USART0, (flexcomm_irq_handler_t)USART0_IRQHandler, &sUartHandle);
|
||||
|
||||
@@ -163,7 +163,7 @@ otError otPlatUartFlush(void)
|
||||
* @param[in] aBuf Pointer to the character buffer
|
||||
* @param[in] len Length of the character buffer
|
||||
*/
|
||||
void JN5189WriteBlocking(const uint8_t *aBuf, uint32_t len)
|
||||
void K32WWriteBlocking(const uint8_t *aBuf, uint32_t len)
|
||||
{
|
||||
otEXPECT(sIsUartInitialized && sUartHandle.txState != UART_BUSY);
|
||||
|
||||
@@ -178,7 +178,7 @@ exit:
|
||||
/**
|
||||
* Process TX characters in process context and call the upper layer call-backs.
|
||||
*/
|
||||
static void JN5189ProcessTransmit(void)
|
||||
static void K32WProcessTransmit(void)
|
||||
{
|
||||
if (sIsTransmitDone)
|
||||
{
|
||||
@@ -190,13 +190,13 @@ static void JN5189ProcessTransmit(void)
|
||||
/**
|
||||
* Process RX characters in process context and call the upper layer call-backs.
|
||||
*/
|
||||
static void JN5189ProcessReceive(void)
|
||||
static void K32WProcessReceive(void)
|
||||
{
|
||||
uint8_t rx[JN5189_UART_RX_BUFFERS];
|
||||
uint8_t rx[K32W_UART_RX_BUFFERS];
|
||||
uint16_t rxIndex = 0;
|
||||
uint8_t *pCharacter;
|
||||
|
||||
while ((pCharacter = JN5189PopRxRingBuffer(&sUartRxRing)) != NULL)
|
||||
while ((pCharacter = K32WPopRxRingBuffer(&sUartRxRing)) != NULL)
|
||||
{
|
||||
rx[rxIndex] = *pCharacter;
|
||||
rxIndex++;
|
||||
@@ -229,7 +229,7 @@ static void USART0_IRQHandler(USART_Type *base, usart_handle_t *handle)
|
||||
volatile uint8_t rx_data = USART_ReadByte(USART0);
|
||||
|
||||
{
|
||||
JN5189PushRxRingBuffer(&sUartRxRing, rx_data);
|
||||
K32WPushRxRingBuffer(&sUartRxRing, rx_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,16 +267,16 @@ static void USART0_IRQHandler(USART_Type *base, usart_handle_t *handle)
|
||||
* @param[in] aRxRing Pointer to the RX Ring Buffer
|
||||
* @param[in] aCharacter The received character
|
||||
*/
|
||||
static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, uint8_t aCharacter)
|
||||
static void K32WPushRxRingBuffer(rxRingBuffer *aRxRing, uint8_t aCharacter)
|
||||
{
|
||||
aRxRing->buffer[aRxRing->head] = aCharacter;
|
||||
|
||||
if (aRxRing->isFull)
|
||||
{
|
||||
aRxRing->tail = (aRxRing->tail + 1) % JN5189_UART_RX_BUFFERS;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % K32W_UART_RX_BUFFERS;
|
||||
}
|
||||
|
||||
aRxRing->head = (aRxRing->head + 1) % JN5189_UART_RX_BUFFERS;
|
||||
aRxRing->head = (aRxRing->head + 1) % K32W_UART_RX_BUFFERS;
|
||||
aRxRing->isFull = (aRxRing->head == aRxRing->tail);
|
||||
}
|
||||
|
||||
@@ -291,16 +291,16 @@ static void JN5189PushRxRingBuffer(rxRingBuffer *aRxRing, uint8_t aCharacter)
|
||||
* @return tsRxFrameFormat Pointer to a received character
|
||||
* @return NULL In case the RX Ring buffer is empty
|
||||
*/
|
||||
static uint8_t *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static uint8_t *K32WPopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
uint8_t *pCharacter = NULL;
|
||||
|
||||
DisableIRQ(USART0_IRQn);
|
||||
if (!JN5189IsEmptyRxRingBuffer(aRxRing))
|
||||
if (!K32WIsEmptyRxRingBuffer(aRxRing))
|
||||
{
|
||||
pCharacter = &(aRxRing->buffer[aRxRing->tail]);
|
||||
aRxRing->isFull = false;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % JN5189_UART_RX_BUFFERS;
|
||||
aRxRing->tail = (aRxRing->tail + 1) % K32W_UART_RX_BUFFERS;
|
||||
}
|
||||
EnableIRQ(USART0_IRQn);
|
||||
|
||||
@@ -315,7 +315,7 @@ static uint8_t *JN5189PopRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
* @return TRUE RX Ring Buffer is not empty
|
||||
* @return FALSE RX Ring Buffer is empty
|
||||
*/
|
||||
static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static bool K32WIsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
return (!aRxRing->isFull && (aRxRing->head == aRxRing->tail));
|
||||
}
|
||||
@@ -325,9 +325,23 @@ static bool JN5189IsEmptyRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
*
|
||||
* @param[in] aRxRing Pointer to an RX Ring Buffer
|
||||
*/
|
||||
static void JN5189ResetRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
static void K32WResetRxRingBuffer(rxRingBuffer *aRxRing)
|
||||
{
|
||||
aRxRing->head = 0;
|
||||
aRxRing->tail = 0;
|
||||
aRxRing->isFull = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The UART driver weak functions definition.
|
||||
*
|
||||
*/
|
||||
OT_TOOL_WEAK void otPlatUartSendDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aBuf);
|
||||
OT_UNUSED_VARIABLE(aBufLength);
|
||||
}
|
||||
Reference in New Issue
Block a user