mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[examples] update Qorvo qpg6095 and gp712, add qpg6100 and qpg7015m (#5903)
This commit is contained in:
@@ -44,6 +44,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -58,6 +60,8 @@ jobs:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo pip3 install --system -U cmake==3.10.3
|
||||
@@ -84,6 +88,8 @@ jobs:
|
||||
CXX: ${{ matrix.compiler_cpp }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -96,6 +102,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -127,6 +135,8 @@ jobs:
|
||||
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
cd /tmp
|
||||
@@ -155,6 +165,8 @@ jobs:
|
||||
CXX: g++-${{ matrix.gcc_ver }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -175,6 +187,8 @@ jobs:
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -198,6 +212,8 @@ jobs:
|
||||
LDFLAGS: -m32
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
@@ -213,6 +229,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -233,6 +251,8 @@ jobs:
|
||||
CXX: clang++
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
brew install automake ninja llvm
|
||||
@@ -248,6 +268,8 @@ jobs:
|
||||
CXX: g++
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
brew install automake ninja
|
||||
@@ -260,6 +282,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
run: |
|
||||
docker run --rm -v $PWD:/build/openthread openthread/android-trusty /build/openthread/script/check-android-build
|
||||
|
||||
@@ -52,6 +52,8 @@ jobs:
|
||||
VIRTUAL_TIME_UART: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -90,6 +92,8 @@ jobs:
|
||||
VIRTUAL_TIME_UART: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -123,6 +127,8 @@ jobs:
|
||||
COVERAGE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -148,6 +154,8 @@ jobs:
|
||||
COVERAGE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -182,6 +190,8 @@ jobs:
|
||||
DAEMON: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -219,6 +229,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
@@ -59,6 +59,8 @@ jobs:
|
||||
arch: ["m32", "m64"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -103,6 +105,8 @@ jobs:
|
||||
INTER_OP: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -159,6 +163,8 @@ jobs:
|
||||
THREAD_VERSION: 1.2
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -199,6 +205,8 @@ jobs:
|
||||
VIRTUAL_TIME: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
|
||||
@@ -243,6 +251,8 @@ jobs:
|
||||
VERBOSE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build OTBR Docker
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -294,6 +304,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
@@ -49,6 +49,8 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -75,6 +77,8 @@ jobs:
|
||||
MAX_NETWORK_SIZE: 999
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: '1.14'
|
||||
@@ -121,6 +125,8 @@ jobs:
|
||||
PACKET_VERIFICATION: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -164,6 +170,8 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -205,6 +213,8 @@ jobs:
|
||||
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -242,6 +252,8 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -274,6 +286,8 @@ jobs:
|
||||
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
|
||||
@@ -356,6 +370,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -400,6 +416,8 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel lcov
|
||||
@@ -437,6 +455,8 @@ jobs:
|
||||
VIRTUAL_TIME: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -475,6 +495,8 @@ jobs:
|
||||
CXX: clang++
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
@@ -516,6 +538,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
@@ -44,6 +44,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
if: "github.event_name == 'push'"
|
||||
run: |
|
||||
|
||||
@@ -47,6 +47,8 @@ jobs:
|
||||
TORANJ_RADIO : 15.4
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -85,6 +87,8 @@ jobs:
|
||||
TORANJ_RADIO : 15.4
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -223,6 +227,8 @@ jobs:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get --no-install-recommends install -y lcov
|
||||
|
||||
@@ -43,6 +43,8 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Check
|
||||
run: |
|
||||
script/check-api-version
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "third_party/Qorvo/repo"]
|
||||
path = third_party/Qorvo/repo
|
||||
url = https://github.com/Qorvo/qpg-openthread.git
|
||||
+10
-4
@@ -781,14 +781,14 @@ AC_MSG_CHECKING([whether to build examples])
|
||||
AC_ARG_WITH(examples,
|
||||
[AS_HELP_STRING([--with-examples=TARGET],
|
||||
[Build example applications for one of: simulation, cc1352, cc2538, cc2650, cc2652, efr32mg1, efr32mg12, efr32mg13, efr32mg21,
|
||||
gp712, jn5189, k32w061, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, samr21 @<:@default=no@:>@.
|
||||
gp712, jn5189, k32w061, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, qpg6100, qpg7015m, samr21 @<:@default=no@:>@.
|
||||
Note that building example applications also builds the associated OpenThread platform libraries
|
||||
and any third_party libraries needed to support the examples.])],
|
||||
[
|
||||
case "${with_examples}" in
|
||||
no)
|
||||
;;
|
||||
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|k32w061|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|samr21)
|
||||
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|k32w061|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|qpg6100|qpg7015m|samr21)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ERROR)
|
||||
@@ -817,6 +817,8 @@ AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52811], [test "${with_examples}" = "nrf5
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52833], [test "${with_examples}" = "nrf52833"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf52840"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6095], [test "${with_examples}" = "qpg6095"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6100], [test "${with_examples}" = "qpg6100"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG7015M], [test "${with_examples}" = "qpg7015m"])
|
||||
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${with_examples}" = "samr21"])
|
||||
|
||||
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
|
||||
@@ -842,11 +844,11 @@ AC_MSG_CHECKING([whether to build platform libraries])
|
||||
AC_ARG_WITH(platform,
|
||||
[AS_HELP_STRING([--with-platform=TARGET],
|
||||
[Build OpenThread platform libraries for one of: cc1352, cc2538, cc2650, cc2652,
|
||||
efr32mg1, efr32mg12, efr32mg13, efr32mg21, gp712, jn5189, kw41z, nrf52811, nrf52833, nrf52840, posix, qpg6095, samr21, simulation @<:@default=simulation@:>@.])],
|
||||
efr32mg1, efr32mg12, efr32mg13, efr32mg21, gp712, jn5189, kw41z, nrf52811, nrf52833, nrf52840, posix, qpg6095, qpg6100, qpg7015m, samr21, simulation @<:@default=simulation@:>@.])],
|
||||
[
|
||||
# Make sure the given target is valid.
|
||||
case "${with_platform}" in
|
||||
no|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|kw41z|nrf52811|nrf52833|nrf52840|posix|qpg6095|samr21|simulation)
|
||||
no|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|kw41z|nrf52811|nrf52833|nrf52840|posix|qpg6095|qpg6100|qpg7015m|samr21|simulation)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(ERROR)
|
||||
@@ -893,6 +895,8 @@ AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52833], [test "${with_platform}" = "nrf5
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52840], [test "${with_platform}" = "nrf52840"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG6095], [test "${with_platform}" = "qpg6095"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG6100], [test "${with_platform}" = "qpg6100"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG7015M], [test "${with_platform}" = "qpg7015m"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SAMR21], [test "${with_platform}" = "samr21"])
|
||||
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
|
||||
|
||||
@@ -1050,6 +1054,8 @@ examples/platforms/k32w/Makefile
|
||||
examples/platforms/kw41z/Makefile
|
||||
examples/platforms/nrf528xx/Makefile
|
||||
examples/platforms/qpg6095/Makefile
|
||||
examples/platforms/qpg6100/Makefile
|
||||
examples/platforms/qpg7015m/Makefile
|
||||
examples/platforms/samr21/Makefile
|
||||
examples/platforms/simulation/Makefile
|
||||
examples/platforms/utils/Makefile
|
||||
|
||||
+47
-48
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2017, The OpenThread Authors.
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
TARGET ?= arm-bcm2708hardfp-linux-gnueabi
|
||||
PPREFIX = gp712
|
||||
TARGET ?= arm-linux-gnueabihf
|
||||
NAME = GP712
|
||||
PREFIX_UC = $(NAME)
|
||||
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
|
||||
CROSS_COMPILE ?= $(TARGET)-
|
||||
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
@@ -45,63 +47,62 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
BuildJobs ?= 9
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PPREFIX) \
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
$(NULL)
|
||||
|
||||
DEFAULT_LOGGING ?= 1
|
||||
|
||||
ifeq ($(CLI_LOGGING),1)
|
||||
configure_OPTIONS += --enable-cli-logging
|
||||
endif
|
||||
|
||||
GP712_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-gp712-config.h\"'
|
||||
GP712_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-gp712-config-check.h\"'
|
||||
GP712_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/gp712/
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
-g \
|
||||
$(GP712_CONFIG_FILE_CPPFLAGS) \
|
||||
-W \
|
||||
-Wall \
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
|
||||
-Wextra \
|
||||
-Wall \
|
||||
-Wno-psabi \
|
||||
$(NULL)
|
||||
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
-D_BSD_SOURCE=1 \
|
||||
-D_DEFAULT_SOURCE=1 \
|
||||
$(target_CFLAGS) \
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
-D_BSD_SOURCE=1 \
|
||||
-D_DEFAULT_SOURCE=1 \
|
||||
$(target_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-Wl,--gc-sections \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map=$(PREFIX_LC).map \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ECHO := @echo
|
||||
MAKE := make
|
||||
MKDIR_P := mkdir -p
|
||||
@@ -122,15 +123,13 @@ ResultPath = output
|
||||
TopResultDir = $(ResultPath)
|
||||
AbsTopResultDir = $(PWD)/$(TopResultDir)
|
||||
|
||||
TargetTuple = $(PPREFIX)
|
||||
TargetTuple = $(PREFIX_LC)
|
||||
|
||||
ifndef BuildJobs
|
||||
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
|
||||
endif
|
||||
JOBSFLAG := -j$(BuildJobs)
|
||||
|
||||
PREFIX = $(PPREFIX)
|
||||
|
||||
#
|
||||
# configure-arch <arch>
|
||||
#
|
||||
@@ -139,15 +138,15 @@ PREFIX = $(PPREFIX)
|
||||
# arch - The architecture to configure.
|
||||
#
|
||||
define configure-arch
|
||||
$(ECHO) " CONFIG $(1)..."
|
||||
$(ECHO) " CONFIG $(1)"
|
||||
(cd $(BuildPath)/$(1) && $(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)" \
|
||||
--prefix=/$(PREFIX) \
|
||||
--prefix=/$(TargetTuple) \
|
||||
--host=$(TARGET) \
|
||||
--target=$(TARGET) \
|
||||
--exec-prefix=/$(PREFIX) \
|
||||
--program-prefix=$(PREFIX)- \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
--program-prefix=$(TargetTuple)- \
|
||||
$(configure_OPTIONS))
|
||||
endef # configure-arch
|
||||
|
||||
|
||||
+54
-50
@@ -27,12 +27,15 @@
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
NAME = QPG6095
|
||||
PREFIX_UC = $(NAME)
|
||||
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
|
||||
|
||||
AR = arm-none-eabi-ar
|
||||
CCAS = $(CCPREFIX) arm-none-eabi-gcc
|
||||
CCAS = arm-none-eabi-gcc
|
||||
CPP = arm-none-eabi-cpp
|
||||
CC = $(CCPREFIX) arm-none-eabi-gcc
|
||||
CXX = $(CCPREFIX) arm-none-eabi-g++
|
||||
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
|
||||
@@ -42,63 +45,64 @@ OBJCOPY = arm-none-eabi-objcopy
|
||||
BuildJobs ?= 10
|
||||
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
|
||||
|
||||
configure_OPTIONS = \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--enable-ncp \
|
||||
--enable-radio-only \
|
||||
--enable-linker-map \
|
||||
--with-examples=qpg6095 \
|
||||
MBEDTLS_CPPFLAGS="$(QPG6095_MBEDTLS_CPPFLAGS)" \
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
MBEDTLS_CPPFLAGS="$($(PREFIX_UC)_MBEDTLS_CPPFLAGS)" \
|
||||
$(NULL)
|
||||
|
||||
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
QPG6095_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-qpg6095-config.h\"'
|
||||
QPG6095_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-qpg6095-config-check.h\"'
|
||||
QPG6095_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/qpg6095/
|
||||
QPG6095_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||
QPG6095_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"qpg6095-mbedtls-config.h\"'
|
||||
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/qpg6095/crypto
|
||||
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
|
||||
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
|
||||
QPG6095_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"$(PREFIX_LC)-mbedtls-config.h\"'
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/crypto
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
-g \
|
||||
$(QPG6095_CONFIG_FILE_CPPFLAGS) \
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
$(NULL)
|
||||
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CFLAGS) \
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-specs=nano.specs \
|
||||
-specs=nosys.specs \
|
||||
-Wl,--gc-sections \
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-specs=nano.specs \
|
||||
-specs=nosys.specs \
|
||||
-Wl,--gc-sections \
|
||||
-nostdlib \
|
||||
-Wl,-Map=$(PREFIX_LC).map,--cref \
|
||||
$(NULL)
|
||||
|
||||
ECHO := @echo
|
||||
@@ -118,7 +122,7 @@ ResultPath = output
|
||||
TopResultDir = $(ResultPath)
|
||||
AbsTopResultDir = $(PWD)/$(TopResultDir)
|
||||
|
||||
TargetTuple = qpg6095
|
||||
TargetTuple = $(PREFIX_LC)
|
||||
|
||||
ARCHS = cortex-m4
|
||||
|
||||
@@ -137,13 +141,13 @@ JOBSFLAG := -j$(BuildJobs)
|
||||
# arch - The architecture to configure.
|
||||
#
|
||||
define configure-arch
|
||||
$(ECHO) " CONFIG $(TargetTuple)..."
|
||||
$(ECHO) " CONFIG $(TargetTuple)"
|
||||
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--prefix=/ \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
--prefix=/$(TargetTuple) \
|
||||
--program-prefix=$(TargetTuple)- \
|
||||
$(configure_OPTIONS))
|
||||
endef # configure-arch
|
||||
|
||||
@@ -179,8 +183,8 @@ endef # stage-arch
|
||||
# @FIXME: get the filenames of the targets of OBJCOPY (now they are hardcoded)
|
||||
define hex-arch
|
||||
$(ECHO) " HEX $(TargetTuple)"
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-mtd.hex
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/ot-cli-ftd.hex
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd.hex
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd.hex
|
||||
endef # hex-arch
|
||||
|
||||
#
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
#
|
||||
# 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:
|
||||
NAME = QPG6100
|
||||
PREFIX_UC = $(NAME)
|
||||
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
|
||||
|
||||
AR = arm-none-eabi-ar
|
||||
CCAS = arm-none-eabi-gcc
|
||||
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
|
||||
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
|
||||
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
MBEDTLS_CPPFLAGS="$($(PREFIX_UC)_MBEDTLS_CPPFLAGS)" \
|
||||
$(NULL)
|
||||
|
||||
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"$(PREFIX_LC)-mbedtls-config.h\"'
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/crypto
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DQORVO_CRYPTO_ENGINE
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
|
||||
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
$(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 \
|
||||
-nostdlib \
|
||||
-Wl,-Map=$(PREFIX_LC).map,--cref \
|
||||
$(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 = $(PREFIX_LC)
|
||||
|
||||
ARCHS = cortex-m4
|
||||
|
||||
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
|
||||
|
||||
ifndef BuildJobs
|
||||
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
|
||||
endif
|
||||
JOBSFLAG := -j$(BuildJobs)
|
||||
|
||||
#
|
||||
# configure-arch <arch>
|
||||
#
|
||||
# Configure OpenThread for the specified architecture.
|
||||
#
|
||||
# arch - The architecture to configure.
|
||||
#
|
||||
define configure-arch
|
||||
$(ECHO) " CONFIG $(TargetTuple)"
|
||||
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
|
||||
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
|
||||
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
--host=arm-none-eabi \
|
||||
--prefix=/$(TargetTuple) \
|
||||
--program-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
|
||||
|
||||
# @FIXME: get the filenames of the targets of OBJCOPY (now they are hardcoded)
|
||||
define hex-arch
|
||||
$(ECHO) " HEX $(TargetTuple)"
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd.hex
|
||||
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd.hex
|
||||
endef # hex-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)
|
||||
HEX_TARGETS += hex-$(1)
|
||||
STAGE_TARGETS += stage-$(1)
|
||||
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
|
||||
DIRECTORIES += $(BuildPath)/$(TargetTuple)
|
||||
|
||||
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
|
||||
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
|
||||
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
|
||||
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
|
||||
configure-$(1): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
|
||||
|
||||
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
|
||||
|
||||
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
|
||||
$$(call configure-arch,$(1))
|
||||
|
||||
do-build-$(1): configure-$(1)
|
||||
|
||||
do-build-$(1):
|
||||
+$$(call build-arch,$(1))
|
||||
|
||||
hex-$(1): stage-$(1)
|
||||
|
||||
hex-$(1):
|
||||
$$(call hex-arch,$(1))
|
||||
|
||||
$(1): hex-$(1)
|
||||
|
||||
stage-$(1): do-build-$(1)
|
||||
|
||||
stage-$(1): | $(TopResultDir)
|
||||
$$(call stage-arch,$(1))
|
||||
endef # ARCH_template
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all: hex
|
||||
|
||||
#
|
||||
# cortex-m4
|
||||
#
|
||||
|
||||
cortex-m4_target_ABI = cortex-m4
|
||||
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
|
||||
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
|
||||
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
|
||||
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
|
||||
|
||||
# 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)
|
||||
|
||||
hex: $(HEX_TARGETS)
|
||||
|
||||
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
|
||||
|
||||
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
|
||||
|
||||
all: hex
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(ECHO) " MKDIR $@"
|
||||
@$(MKDIR_P) "$@"
|
||||
|
||||
clean:
|
||||
$(ECHO) " CLEAN"
|
||||
@$(RM_F) -r $(CLEAN_DIRS)
|
||||
|
||||
help:
|
||||
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
|
||||
$(ECHO) "architectures: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " $(ARCHS)"
|
||||
$(ECHO) ""
|
||||
$(ECHO) "To build only a particular architecture, specify: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
|
||||
$(ECHO) ""
|
||||
Executable
+272
@@ -0,0 +1,272 @@
|
||||
#
|
||||
# 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:
|
||||
|
||||
TARGET ?= arm-linux-gnueabihf
|
||||
NAME = QPG7015M
|
||||
PREFIX_UC = $(NAME)
|
||||
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
|
||||
CROSS_COMPILE ?= $(TARGET)-
|
||||
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
AS = $(CROSS_COMPILE)as
|
||||
CPP = $(CROSS_COMPILE)cpp
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
RANLIB = $(CROSS_COMPILE)ranlib
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
BuildJobs ?= 9
|
||||
|
||||
configure_OPTIONS += \
|
||||
--disable-tools \
|
||||
--enable-cli \
|
||||
--enable-ftd \
|
||||
--enable-mtd \
|
||||
--with-examples=$(PREFIX_LC) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(CLI_LOGGING),1)
|
||||
configure_OPTIONS += --enable-cli-logging
|
||||
endif
|
||||
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
|
||||
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
|
||||
|
||||
COMMONCFLAGS := \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-Os \
|
||||
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
|
||||
-Wextra \
|
||||
-Wall \
|
||||
-Wno-psabi \
|
||||
$(NULL)
|
||||
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
|
||||
|
||||
CPPFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CPPFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
-D_BSD_SOURCE=1 \
|
||||
-D_DEFAULT_SOURCE=1 \
|
||||
$(target_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CXXFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_CXXFLAGS) \
|
||||
-fno-exceptions \
|
||||
-fno-rtti \
|
||||
$(NULL)
|
||||
|
||||
LDFLAGS += \
|
||||
$(COMMONCFLAGS) \
|
||||
$(target_LDFLAGS) \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,-Map=$(PREFIX_LC).map \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
ECHO := @echo
|
||||
MAKE := make
|
||||
MKDIR_P := mkdir -p
|
||||
LN_S := ln -s
|
||||
RM_F := rm -f
|
||||
|
||||
INSTALL := /usr/bin/install
|
||||
INSTALLFLAGS := -p
|
||||
|
||||
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
|
||||
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
|
||||
|
||||
BuildPath = build
|
||||
TopBuildDir = $(BuildPath)
|
||||
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
|
||||
|
||||
ResultPath = output
|
||||
TopResultDir = $(ResultPath)
|
||||
AbsTopResultDir = $(PWD)/$(TopResultDir)
|
||||
|
||||
TargetTuple = $(PREFIX_LC)
|
||||
|
||||
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 $(1)"
|
||||
(cd $(BuildPath)/$(1) && $(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)" \
|
||||
--prefix=/$(TargetTuple) \
|
||||
--host=$(TARGET) \
|
||||
--target=$(TARGET) \
|
||||
--exec-prefix=/$(TargetTuple) \
|
||||
--program-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 $(1)"
|
||||
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
|
||||
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 $(1)"
|
||||
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
|
||||
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)/$(1)
|
||||
DIRECTORIES += $(BuildPath)/$(1)
|
||||
|
||||
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)/$(1)/config.status
|
||||
|
||||
$(BuildPath)/$(1)/config.status: | $(BuildPath)/$(1)
|
||||
$$(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
|
||||
|
||||
#
|
||||
# rpi_bcm2708
|
||||
#
|
||||
|
||||
rpi_bcm2708_target_ABI = rpi_bcm2708
|
||||
rpi_bcm2708_target_CPPFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
|
||||
rpi_bcm2708_target_CFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
|
||||
rpi_bcm2708_target_CXXFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
|
||||
rpi_bcm2708_target_LDFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
|
||||
|
||||
# Instantiate an architecture-specific build template for each target
|
||||
# architecture.
|
||||
|
||||
$(foreach arch,$(TargetTuple),$(eval $(call ARCH_template,$(arch))))
|
||||
|
||||
#
|
||||
# Common / Finalization
|
||||
#
|
||||
|
||||
configure: $(CONFIGURE_TARGETS)
|
||||
|
||||
build: $(BUILD_TARGETS)
|
||||
|
||||
stage: $(STAGE_TARGETS)
|
||||
|
||||
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
|
||||
|
||||
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
|
||||
|
||||
all: stage
|
||||
|
||||
$(DIRECTORIES):
|
||||
$(ECHO) " MKDIR $@"
|
||||
@$(MKDIR_P) "$@"
|
||||
|
||||
clean:
|
||||
$(ECHO) " CLEAN"
|
||||
@$(RM_F) -r $(CLEAN_DIRS)
|
||||
|
||||
help:
|
||||
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
|
||||
$(ECHO) "architectures: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " $(TargetTuple)"
|
||||
$(ECHO) ""
|
||||
$(ECHO) "To build only a particular architecture, specify: "
|
||||
$(ECHO) ""
|
||||
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
|
||||
$(ECHO) ""
|
||||
@@ -42,6 +42,8 @@ DIST_SUBDIRS = \
|
||||
nrf528xx \
|
||||
simulation \
|
||||
qpg6095 \
|
||||
qpg6100 \
|
||||
qpg7015m \
|
||||
samr21 \
|
||||
utils \
|
||||
$(NULL)
|
||||
@@ -96,7 +98,15 @@ if OPENTHREAD_PLATFORM_QPG6095
|
||||
SUBDIRS += qpg6095
|
||||
endif
|
||||
|
||||
if OPENTHREAD_PLATFORM_SAMR21
|
||||
if OPENTHREAD_PLATFORM_QPG6100
|
||||
SUBDIRS += qpg6100
|
||||
endif
|
||||
|
||||
if OPENTHREAD_PLATFORM_QPG7015M
|
||||
SUBDIRS += qpg7015m
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_SAMR21
|
||||
SUBDIRS += samr21
|
||||
endif
|
||||
|
||||
|
||||
@@ -93,6 +93,14 @@ if OPENTHREAD_EXAMPLES_QPG6095
|
||||
include $(top_srcdir)/examples/platforms/qpg6095/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_QPG6100
|
||||
include $(top_srcdir)/examples/platforms/qpg6100/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_QPG7015M
|
||||
include $(top_srcdir)/examples/platforms/qpg7015m/Makefile.platform.am
|
||||
endif
|
||||
|
||||
if OPENTHREAD_EXAMPLES_SAMR21
|
||||
include $(top_srcdir)/examples/platforms/samr21/Makefile.platform.am
|
||||
endif # OPENTHREAD_EXAMPLES_SAMR21
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -32,39 +32,36 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
lib_LIBRARIES = libopenthread-gp712.a
|
||||
lib_LIBRARIES = libopenthread-gp712.a
|
||||
|
||||
libopenthread_gp712_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
libopenthread_gp712_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/gp712 \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
openthread-core-gp712-config.h \
|
||||
openthread-core-gp712-config-check.h \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
system.c \
|
||||
uart-posix.c \
|
||||
uart_qorvo.h \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
openthread-core-gp712-config.h \
|
||||
openthread-core-gp712-config-check.h \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
system.c \
|
||||
uart-posix.c \
|
||||
uart_qorvo.h \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_gp712_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
libopenthread_gp712_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2017, The OpenThread Authors.
|
||||
# Copyright (c) 2019, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -32,5 +32,15 @@
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/gp712/libopenthread-gp712.a \
|
||||
$(top_srcdir)/third_party/Qorvo/gp712/libQorvoRPi.a \
|
||||
$(NULL)
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/gp712/libQorvoGP712_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/gp712/libQorvoGP712_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,10 +40,6 @@
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
|
||||
void qorvoAlarmInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t otPlatAlarmMilliGetNow(void)
|
||||
{
|
||||
return qorvoAlarmGetTimeMs();
|
||||
@@ -59,7 +55,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
|
||||
OT_UNUSED_VARIABLE(t0);
|
||||
|
||||
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
|
||||
qorvoAlarmScheduleEventArg(dt * 1000, qorvoAlarmFired, aInstance);
|
||||
qorvoAlarmScheduleEventArg(dt, qorvoAlarmFired, aInstance);
|
||||
}
|
||||
|
||||
void otPlatAlarmMilliStop(otInstance *aInstance)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2019, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -41,16 +41,11 @@
|
||||
#include <openthread/platform/logging.h>
|
||||
#include <openthread/platform/toolchain.h>
|
||||
|
||||
#include "uart_qorvo.h"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
// Macro to append content to end of the log string.
|
||||
|
||||
#define LOG_PRINTF(...) \
|
||||
charsWritten = snprintf(&logString[offset], sizeof(logString) - offset, __VA_ARGS__); \
|
||||
otEXPECT_ACTION(charsWritten >= 0, logString[offset] = 0); \
|
||||
offset += (unsigned int)charsWritten; \
|
||||
otEXPECT_ACTION(offset < sizeof(logString), logString[sizeof(logString) - 1] = 0)
|
||||
|
||||
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
|
||||
|
||||
int PlatOtLogLevelToSysLogLevel(otLogLevel aLogLevel)
|
||||
@@ -88,23 +83,10 @@ int PlatOtLogLevelToSysLogLevel(otLogLevel aLogLevel)
|
||||
|
||||
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aLogRegion);
|
||||
|
||||
char logString[512];
|
||||
unsigned int offset;
|
||||
int charsWritten;
|
||||
va_list args;
|
||||
|
||||
offset = 0;
|
||||
|
||||
va_list args;
|
||||
va_start(args, aFormat);
|
||||
charsWritten = vsnprintf(&logString[offset], sizeof(logString) - offset, aFormat, args);
|
||||
qorvoUartLog(aLogLevel, aLogRegion, aFormat, args);
|
||||
va_end(args);
|
||||
|
||||
otEXPECT_ACTION(charsWritten >= 0, logString[offset] = 0);
|
||||
|
||||
exit:
|
||||
syslog(PlatOtLogLevelToSysLogLevel(aLogLevel), "%s", logString);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -150,16 +150,13 @@ otError otPlatRadioSleep(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_INVALID_STATE;
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
{
|
||||
qorvoRadioSetRxOnWhenIdle(false);
|
||||
error = OT_ERROR_NONE;
|
||||
sState = OT_RADIO_STATE_SLEEP;
|
||||
}
|
||||
|
||||
return error;
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
@@ -226,10 +223,6 @@ void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
|
||||
sLastReceivedPower = aPacket->mInfo.mRxInfo.mRssi;
|
||||
}
|
||||
|
||||
// TODO Set this flag only when the packet is really acknowledged with frame pending set.
|
||||
// See https://github.com/openthread/openthread/pull/3785
|
||||
aPacket->mInfo.mRxInfo.mAckedWithFramePending = true;
|
||||
|
||||
otPlatRadioReceiveDone(pQorvoInstance, aPacket, aError);
|
||||
}
|
||||
|
||||
@@ -334,20 +327,24 @@ void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
|
||||
|
||||
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPower);
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
return qorvoRadioGetTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPower);
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
return qorvoRadioSetTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
@@ -372,3 +369,9 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
|
||||
return GP712_RECEIVE_SENSITIVITY;
|
||||
}
|
||||
|
||||
const char *otPlatRadioGetVersionString(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return "OPENTHREAD/Qorvo/0.0";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef RADIO_QORVO_H_
|
||||
#define RADIO_QORVO_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openthread/error.h>
|
||||
@@ -173,6 +174,22 @@ otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid
|
||||
*/
|
||||
otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
|
||||
|
||||
/**
|
||||
* This function gets the transmit power for current channel
|
||||
*
|
||||
* @param[out] aPower The transmit power
|
||||
*
|
||||
*/
|
||||
otError qorvoRadioGetTransmitPower(int8_t *aPower);
|
||||
|
||||
/**
|
||||
* This function sets the transmit power for current channel
|
||||
*
|
||||
* @param[in] aPower The transmit power
|
||||
*
|
||||
*/
|
||||
otError qorvoRadioSetTransmitPower(int8_t aPower);
|
||||
|
||||
/**
|
||||
* This callback is called when the energy scan is finished.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <openthread/tasklet.h>
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
#include "alarm_qorvo.h"
|
||||
#include "platform_qorvo.h"
|
||||
#include "radio_qorvo.h"
|
||||
#include "random_qorvo.h"
|
||||
#include "uart_qorvo.h"
|
||||
@@ -71,7 +73,7 @@ void otSysInit(int argc, char *argv[])
|
||||
|
||||
qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck);
|
||||
platformUartInit();
|
||||
// qorvoAlarmInit();
|
||||
qorvoAlarmInit();
|
||||
qorvoRandomInit();
|
||||
qorvoRadioInit();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -87,6 +87,11 @@ void platformUartRestore(void)
|
||||
restore_stdin_termios();
|
||||
restore_stdout_termios();
|
||||
dup2(s_out_fd, STDOUT_FILENO);
|
||||
|
||||
qorvoPlatUnRegisterPollFunction(s_in_fd);
|
||||
qorvoPlatUnRegisterPollFunction(s_out_fd);
|
||||
|
||||
otPlatUartDisable();
|
||||
}
|
||||
|
||||
void platformUartInit(void)
|
||||
@@ -95,8 +100,19 @@ void platformUartInit(void)
|
||||
s_out_fd = dup(STDOUT_FILENO);
|
||||
dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||
|
||||
int res = fcntl(s_in_fd, F_SETFD, fcntl(s_in_fd, F_GETFD) | FD_CLOEXEC);
|
||||
otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed"));
|
||||
|
||||
res = fcntl(s_out_fd, F_SETFD, fcntl(s_out_fd, F_GETFD) | FD_CLOEXEC);
|
||||
otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed"));
|
||||
|
||||
qorvoPlatRegisterPollFunction(s_in_fd, cbKeyPressed);
|
||||
qorvoPlatRegisterPollFunction(s_out_fd, cbKeyPressed);
|
||||
|
||||
return;
|
||||
|
||||
exit:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
otError otPlatUartEnable(void)
|
||||
@@ -278,3 +294,16 @@ void platformUartProcess(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The weak stubs functions definition.
|
||||
*/
|
||||
OT_TOOL_WEAK void otPlatUartSendDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
{
|
||||
(void)aBuf;
|
||||
(void)aBufLength;
|
||||
}
|
||||
|
||||
@@ -1,340 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file implements the OpenThread platform abstraction for cli over ip socket communication.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "alarm_qorvo.h"
|
||||
#include "platform_qorvo.h"
|
||||
#include "uart_qorvo.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
|
||||
#include <common/code_utils.hpp>
|
||||
#include <openthread/platform/uart.h>
|
||||
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
#define BUFFER_MAX_SIZE 255
|
||||
#define SOCKET_PORT 9190
|
||||
#define SOCKET_WRITE(socketInfo, buf, length) \
|
||||
sendto(socketInfo.socketId, (const char *)buf, length, 0, &socketInfo.addr, sizeof(socketInfo.addr))
|
||||
#define SOCKET_READ(socketId, buf, length) recv(socketId, buf, length, 0)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t socketId;
|
||||
bool isValid;
|
||||
struct sockaddr addr;
|
||||
pthread_t rfReadThread;
|
||||
} PlatSocket_t;
|
||||
|
||||
PlatSocket_t PlatSocketConnection;
|
||||
int PlatSocketPipeFd[2];
|
||||
int PlatServerSocketId;
|
||||
|
||||
void PlatSocketRxNewConn(uint8_t id);
|
||||
void PlatSocketInit(void);
|
||||
void PlatSocketDeInit(void);
|
||||
int PlatSocketTxData(uint16_t length, uint8_t *pData, uint32_t socketId);
|
||||
|
||||
#define PLAT_UART_MAX_CHAR 1024
|
||||
|
||||
uint32_t PlatSocketId = 0;
|
||||
|
||||
void PlatSocketSendInput(void *buffer)
|
||||
{
|
||||
uint8_t len = 0;
|
||||
uint8_t *buf = (uint8_t *)buffer;
|
||||
len = strlen((char *)buf);
|
||||
otPlatUartReceived((uint8_t *)buf, (uint16_t)len);
|
||||
free(buf);
|
||||
buf = 0;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
void PlatSocketRx(uint16_t length, const char *buffer, uint32_t socketId)
|
||||
{
|
||||
uint8_t *buf = 0;
|
||||
PlatSocketId = socketId;
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
buf = malloc(length + 2);
|
||||
memcpy(buf, buffer, length);
|
||||
buf[length] = '\n';
|
||||
buf[length + 1] = 0;
|
||||
qorvoAlarmScheduleEventArg(0, PlatSocketSendInput, (void *)buf);
|
||||
}
|
||||
}
|
||||
|
||||
void PlatSocketClose(uint32_t socketId)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(socketId);
|
||||
}
|
||||
|
||||
otError otPlatUartEnable(void)
|
||||
{
|
||||
PlatSocketInit();
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatUartDisable(void)
|
||||
{
|
||||
PlatSocketDeInit();
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
char localbuf[PLAT_UART_MAX_CHAR];
|
||||
|
||||
memcpy(localbuf, aBuf, aBufLength);
|
||||
localbuf[aBufLength] = 0;
|
||||
printf("%s", localbuf);
|
||||
|
||||
if (PlatSocketId)
|
||||
{
|
||||
PlatSocketTxData(aBufLength, (uint8_t *)aBuf, PlatSocketId);
|
||||
}
|
||||
|
||||
otPlatUartSendDone();
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatUartFlush(void)
|
||||
{
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void platformUartInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void platformUartProcess(void)
|
||||
{
|
||||
}
|
||||
|
||||
int PlatSocketListenForClients()
|
||||
{
|
||||
// Setup server side socket
|
||||
int sockfd;
|
||||
struct sockaddr_in serv_addr;
|
||||
uint32_t flag = 1;
|
||||
int ret;
|
||||
|
||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
otEXPECT_ACTION(sockfd >= 0, sockfd = -1);
|
||||
|
||||
// disable Nagle's algorithm to avoid long latency
|
||||
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
|
||||
// allow reuse of the same address
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&flag, sizeof(flag));
|
||||
memset(&serv_addr, 0, sizeof(serv_addr));
|
||||
|
||||
serv_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
serv_addr.sin_family = AF_INET;
|
||||
serv_addr.sin_port = htons(SOCKET_PORT);
|
||||
ret = bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
|
||||
otEXPECT_ACTION(ret >= 0, close(sockfd); sockfd = -1);
|
||||
ret = listen(sockfd, 10);
|
||||
otEXPECT_ACTION(ret != -1, exit(1));
|
||||
exit:
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
void PlatSocketRxSignaled(uint8_t id)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(id);
|
||||
|
||||
// Dummy callback function to flush pipe
|
||||
uint8_t readChar;
|
||||
// Remove trigger byte from pipe
|
||||
read(PlatSocketPipeFd[0], &readChar, 1);
|
||||
}
|
||||
|
||||
void *PlatSocketReadThread(void *pClientSocket)
|
||||
{
|
||||
char buffer[BUFFER_MAX_SIZE];
|
||||
PlatSocket_t *clientSocket = ((PlatSocket_t *)pClientSocket);
|
||||
|
||||
memset(buffer, 0, BUFFER_MAX_SIZE);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int readLen = SOCKET_READ(clientSocket->socketId, buffer, BUFFER_MAX_SIZE);
|
||||
|
||||
if (readLen < 0)
|
||||
{
|
||||
perror("Reading socket");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (readLen == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
uint8_t someByte = 0x12; // No functional use only using pipe to kick main thread
|
||||
|
||||
PlatSocketRx(readLen, buffer, clientSocket->socketId);
|
||||
|
||||
write(PlatSocketPipeFd[1], &someByte, 1); //[1] = write fd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clientSocket->isValid = 0;
|
||||
qorvoPlatUnRegisterPollFunction(clientSocket->socketId);
|
||||
close(clientSocket->socketId);
|
||||
|
||||
PlatSocketClose(clientSocket->socketId);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PlatSocketRxNewConn(uint8_t id)
|
||||
{
|
||||
// Find first non-valid client in list - add here
|
||||
if (PlatSocketConnection.isValid == 0)
|
||||
{
|
||||
// Add new client to client list
|
||||
socklen_t len;
|
||||
len = sizeof(PlatSocketConnection.addr);
|
||||
int retval = accept(id, (struct sockaddr *)&PlatSocketConnection.addr, (socklen_t *)&len);
|
||||
|
||||
if (retval >= 0)
|
||||
{
|
||||
int retErr;
|
||||
PlatSocketConnection.socketId = retval;
|
||||
retErr =
|
||||
pthread_create(&PlatSocketConnection.rfReadThread, NULL, PlatSocketReadThread, &PlatSocketConnection);
|
||||
|
||||
if (retErr)
|
||||
{
|
||||
close(PlatSocketConnection.socketId);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlatSocketConnection.isValid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int tempfd;
|
||||
tempfd = accept(id, (struct sockaddr *)NULL, NULL);
|
||||
|
||||
if (tempfd >= 0)
|
||||
{
|
||||
close(tempfd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Function Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
void PlatSocketInit(void)
|
||||
{
|
||||
memset(&PlatSocketConnection, 0, sizeof(PlatSocketConnection));
|
||||
|
||||
// in case we are a server, setup listening for client
|
||||
PlatServerSocketId = PlatSocketListenForClients();
|
||||
qorvoPlatRegisterPollFunction(PlatServerSocketId, PlatSocketRxNewConn);
|
||||
|
||||
// hack
|
||||
pipe(PlatSocketPipeFd);
|
||||
qorvoPlatRegisterPollFunction(PlatSocketPipeFd[0], PlatSocketRxSignaled);
|
||||
}
|
||||
|
||||
void platformUartRestore(void)
|
||||
{
|
||||
PlatSocketDeInit();
|
||||
}
|
||||
|
||||
void PlatSocketDeInit(void)
|
||||
{
|
||||
qorvoPlatUnRegisterPollFunction(PlatServerSocketId);
|
||||
close(PlatServerSocketId);
|
||||
qorvoPlatUnRegisterPollFunction(PlatSocketPipeFd[0]);
|
||||
close(PlatSocketPipeFd[0]);
|
||||
close(PlatSocketPipeFd[1]);
|
||||
close(PlatSocketConnection.socketId);
|
||||
}
|
||||
|
||||
int PlatSocketTxData(uint16_t length, uint8_t *pData, uint32_t socketId)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
// All sockets
|
||||
if (PlatSocketConnection.isValid)
|
||||
{
|
||||
if (PlatSocketConnection.socketId == socketId)
|
||||
{
|
||||
if (SOCKET_WRITE(PlatSocketConnection, (const char *)pData, length) < 0)
|
||||
{
|
||||
perror("TxSocket: Error Writing to client");
|
||||
close(PlatSocketConnection.socketId);
|
||||
PlatSocketConnection.isValid = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, The OpenThread Authors.
|
||||
* Copyright (c) 2019, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,18 +36,7 @@
|
||||
#define UART_QORVO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* This function initializes the UART driver.
|
||||
*
|
||||
*/
|
||||
void qorvoUartInit(void);
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void qorvoUartProcess(void);
|
||||
#include <openthread/platform/logging.h>
|
||||
|
||||
/**
|
||||
* This function enables the UART driver.
|
||||
@@ -85,4 +74,15 @@ void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength);
|
||||
*/
|
||||
void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength);
|
||||
|
||||
/**
|
||||
* Function which transmits logging via the qorvo platform.
|
||||
*
|
||||
* @param[in] aLogLevel The severity level of logging.
|
||||
* @param[in] aLogRegion The code region where the logging originated from.
|
||||
* @param[in] aFormat The format strings.
|
||||
* @param[in] varargs The arguments for the format string.
|
||||
*
|
||||
*/
|
||||
void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...);
|
||||
|
||||
#endif // UART_QORVO_H_
|
||||
|
||||
@@ -32,45 +32,49 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
lib_LIBRARIES = libopenthread-qpg6095.a
|
||||
lib_LIBRARIES = libopenthread-qpg6095.a
|
||||
|
||||
libopenthread_qpg6095_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/utils \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
libopenthread_qpg6095_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/utils \
|
||||
-I$(top_srcdir)/examples/platforms/qpg6095 \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
libopenthread_qpg6095_a_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
misc_qorvo.h \
|
||||
openthread-core-qpg6095-config.h \
|
||||
openthread-core-qpg6095-config-check.h \
|
||||
platform.c \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
settings.cpp \
|
||||
settings_qorvo.h \
|
||||
uart.c \
|
||||
uart_qorvo.h \
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
misc_qorvo.h \
|
||||
openthread-core-qpg6095-config.h \
|
||||
openthread-core-qpg6095-config-check.h \
|
||||
platform.c \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
settings.cpp \
|
||||
settings_qorvo.h \
|
||||
uart.c \
|
||||
uart_qorvo.h \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_qpg6095_a_LIBADD = \
|
||||
$(top_builddir)/examples/platforms/utils/libopenthread_platform_utils_a-settings_ram.o
|
||||
libopenthread_qpg6095_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_qpg6095_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES += $(wildcard *.gcda *.gcno)
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
endif # OPENTHREAD_BUILD_COVERAGE
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
|
||||
@@ -32,9 +32,17 @@
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/qpg6095/libopenthread-qpg6095.a \
|
||||
$(top_srcdir)/third_party/Qorvo/qpg6095/libQorvoQPG6095.a \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/libQorvoQPG6095_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/libQorvoQPG6095_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/qpg6095/qpg6095.ld \
|
||||
$(NULL)
|
||||
|
||||
@@ -25,3 +25,16 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef QGP6095_MBEDTLS_CONFIG_H
|
||||
#define QGP6095_MBEDTLS_CONFIG_H
|
||||
/* enable this to speed up crypto calculations by using a ram patch for bignum.c */
|
||||
#define MBEDTLS_BIGNUM_RAMPATCH 0
|
||||
|
||||
/* enable this in case the QPG6095 runs too slow for the crypto calculations */
|
||||
#define MBEDTLS_SLOW_CPU 1
|
||||
#define MBEDTLS_COMPUTATION_UNTILL_SEQ_NR 6
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif // QGP6095_MBEDTLS_CONFIG_H
|
||||
|
||||
@@ -26,16 +26,17 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "platform_qorvo.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <openthread/config.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#if OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
/**
|
||||
* Diagnostics mode variables.
|
||||
*
|
||||
@@ -73,3 +74,5 @@ void otPlatDiagAlarmCallback(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
@@ -39,26 +39,11 @@
|
||||
#include <common/code_utils.hpp>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#define GP_COMPONENT_ID GP_COMPONENT_ID_APP
|
||||
|
||||
// uint8_t pseudoRandom = 0x34;
|
||||
|
||||
void qorvoRandomInit(void)
|
||||
{
|
||||
// pseudoRandom += (uint8_t) (seed&0xFF);
|
||||
}
|
||||
|
||||
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
assert(aOutputLength < 256);
|
||||
// uint8_t i;
|
||||
|
||||
qorvoRandomGet((uint8_t *)aOutput, (uint8_t)aOutputLength);
|
||||
// for(i=0; i<aOutputLength; i++)
|
||||
// {
|
||||
// aOutput[i] = pseudoRandom;
|
||||
// pseudoRandom = (pseudoRandom * 97 + 1)%256;
|
||||
// }
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include "uart_qorvo.h"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
// Macro to append content to end of the log string.
|
||||
|
||||
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
|
||||
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||
{
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
|
||||
static otInstance *localInstance = NULL;
|
||||
|
||||
#ifdef QORVO_USE_ROM
|
||||
extern void flash_jump_gpJumpTables_GetRomVersion(void);
|
||||
#endif // QORVO_USE_ROM
|
||||
|
||||
bool qorvoPlatGotoSleepCheck(void)
|
||||
{
|
||||
if (localInstance)
|
||||
@@ -61,7 +65,11 @@ void otSysInit(int argc, char *argv[])
|
||||
{
|
||||
OT_UNUSED_VARIABLE(argc);
|
||||
OT_UNUSED_VARIABLE(argv);
|
||||
#ifdef QORVO_USE_ROM
|
||||
flash_jump_gpJumpTables_GetRomVersion();
|
||||
#endif // QORVO_USE_ROM
|
||||
qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck);
|
||||
qorvoUartInit();
|
||||
qorvoAlarmInit();
|
||||
qorvoRandomInit();
|
||||
qorvoRadioInit();
|
||||
|
||||
@@ -26,59 +26,88 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* (c) 2015, GreenPeak Technologies
|
||||
* Simple linker script.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Memory Spaces Definitions */
|
||||
MEMORY
|
||||
{
|
||||
SYSRAM (rxw) : ORIGIN = 0x20008000, LENGTH = 0x8000
|
||||
UCRAM (rxw) : ORIGIN = 0x20010000, LENGTH = 0x8000
|
||||
/* Ram origin start 0x1800 after real begin: this is (with some margin) the location of the windows.
|
||||
We can move this back, but this means we need to init the windows ourselves */
|
||||
SYSRAM (rxw) : ORIGIN = 0x20008000, LENGTH = 0xA000 /* reserve 1KB for bootloader */
|
||||
UCRAM (rxw) : ORIGIN = 0x20012000, LENGTH = 0x6000
|
||||
FLASH (rx) : ORIGIN = 0x04000000, LENGTH = 0x80000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
flash_end = 0x4000000 + 0x80000;
|
||||
.vpp 0x0400001C : { LONG(_ivt >> 8); } > FLASH
|
||||
.mw 0x04000020 : { LONG(0x693A5C81); } > FLASH
|
||||
rts_start_offset = 0x200;
|
||||
rts_start_address = ORIGIN(FLASH) + rts_start_offset;
|
||||
.rt rts_start_address : {. = ALIGN(4); *(.rt_flash); } > FLASH
|
||||
|
||||
/*
|
||||
* User license is first - only for FLASH programs.
|
||||
*/
|
||||
.vpp 0x4000000 + 28 : { LONG(_ivt >> 8); } > FLASH
|
||||
.mw 0x4000000 + 0x20 : { LONG(0x693A5C81); } > FLASH
|
||||
/* Reserve space for RT system in FLASH */
|
||||
rt_system_start_offset = 0x200;
|
||||
rt_system_start_address = ORIGIN(FLASH) + rt_system_start_offset;
|
||||
.rt_flash rt_system_start_address : {. = ALIGN(4); *(.rt_flash); } > FLASH
|
||||
ASSERT((rt_system_start_offset % 0x20 == 0), "RT system start should be aligned on 32 bytes")
|
||||
ASSERT((rt_system_start_address / 0x20000 == . / 0x20000 ), "RT system shall not cross 128kb boundary")
|
||||
|
||||
/* FIXME: temp offset to allow flash bootloader to reside in lower memory */
|
||||
.isr_vector : ALIGN(0x800) { _ivt = .; KEEP(*(.isr_vector)); } > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.text : { . = ALIGN(4); *(.text) *(.text.*); } > FLASH
|
||||
.rodata : { . = ALIGN(4); *(.rodata) *(.rodata.*); } > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
_slower_retain = ORIGIN(SYSRAM) ; /* Start retained memory in sleep */
|
||||
.text : { . = ALIGN(4); *(.text) *(.text.*); } > FLASH
|
||||
.rodata : { . = ALIGN(4); *(.rodata) *(.rodata.*);} > FLASH
|
||||
|
||||
/* Start retained memory in sleep */
|
||||
_slower_retain = 0x20008000;
|
||||
|
||||
/* Fixed sections */
|
||||
.mw_crc 0x20008000 : { . += 0x4; } > SYSRAM
|
||||
.crc 0x20008004 : { . += 0x4; } > SYSRAM
|
||||
.ret_hw 0x20008008 : { . += 0x138; } > SYSRAM
|
||||
.ret_sw 0x20008140 : { . += 0x80; } > SYSRAM
|
||||
.ret_hw 0x20008008 : { . += 0x1B4; } > SYSRAM
|
||||
.ret_sw 0x200081BC : { . += 0x7B; } > SYSRAM
|
||||
ASSERT(. >= 0x200081c0, "gpmicro areas must fall into retention areas")
|
||||
|
||||
/* .events and .pbm_options too big for this space */
|
||||
|
||||
/* MAC_filt and BLE_mgr RAM register map - fixed size: 0x140 */
|
||||
.ram_regmap 0x20008240 : ALIGN(4) { . += 0x140; } > SYSRAM
|
||||
/* .ram_regmap : { . += 0x140; } > SYSRAM /* don't waste the last bytes of the 512-byte window; */
|
||||
/* Windowed sections */
|
||||
.ram_regmap : { . += 0x140; } > SYSRAM
|
||||
.events : { . += 0x10 ; } > SYSRAM
|
||||
.pbm_options : { . += 0x400 ; } > SYSRAM
|
||||
.events : { . += 0x10; } > SYSRAM /* 1 events (16 bytes) */
|
||||
.pbm_options : { . += 0x400; } > SYSRAM /* 32 PBM options (32 bytes) */
|
||||
/* pbm data is taken from buffers in lower_ram_retain */
|
||||
|
||||
.lower_ram_retain_gpmicro_accessible (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain_gpmicro_accessible) *(.lower_ram_retain_gpmicro_accessible.*); } > SYSRAM
|
||||
.lower_ram_retain (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain) *(.lower_ram_retain.*); } > SYSRAM
|
||||
/* Data for first 16 KB region */
|
||||
.lower_ram_retain_gpmicro_accessible (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain_gpmicro_accessible) *(.lower_ram_retain_gpmicro_accessible.*); } > SYSRAM
|
||||
ASSERT (. < 0x2000c000, ".lower_ram_retain_gpmicro_accessible outside of gpMicro address range")
|
||||
.lower_ram_retain (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain) *(.lower_ram_retain.*); } > SYSRAM
|
||||
|
||||
.bss : { . = ALIGN(4); *(.bss) *(COMMON);} > SYSRAM
|
||||
.bss_uc : { . = ALIGN(4); *(.bss.*) *(.bss);} > SYSRAM
|
||||
|
||||
_elower_retain = . ; /* End memory to be retained */
|
||||
.lower_ram_noretain (NOLOAD) : { . = ALIGN(4); *(.lower_ram_noretain) *(.lower_ram_noretain.*); } > SYSRAM
|
||||
.lower_ram_noretain (NOLOAD) : { . = ALIGN(4); *(.lower_ram_noretain) *(.lower_ram_noretain.*); } > SYSRAM
|
||||
_elower_ram = . ;
|
||||
|
||||
/* make sure this goes into ucram */
|
||||
. = ORIGIN(UCRAM);
|
||||
|
||||
PROVIDE(_shigher_retain = .);
|
||||
.higher_ram_retain (NOLOAD) : { . = ALIGN(4); *(.higher_ram_retain) *(.higher_ram_retain.*); } > UCRAM
|
||||
.higher_ram_retain (NOLOAD) : { . = ALIGN(4); *(.higher_ram_retain) *(.higher_ram_retain.*); } > UCRAM
|
||||
.bss : { . = ALIGN(4); *(COMMON);} > UCRAM
|
||||
.data : { . = ALIGN(4); *(.data) *(.data.*); } > UCRAM AT > FLASH
|
||||
PROVIDE(_ehigher_retain = .);
|
||||
.higher_ram_noretain (NOLOAD) : { . = ALIGN(4); *(.higher_ram_noretain) *(.higher_ram_noretain.*); } > UCRAM
|
||||
.data : { . = ALIGN(4); *(.data) *(.data.*); } > UCRAM AT > FLASH
|
||||
.bss_uc : { . = ALIGN(4); *(.bss.*) ;} > UCRAM
|
||||
_ehigher_ram = . ;
|
||||
|
||||
/* remove the debugging information from the standard libraries */
|
||||
@@ -88,10 +117,10 @@ SECTIONS
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.gpNvm flash_end - 0x4000:
|
||||
.gpNvm flash_end - 0x1800:
|
||||
{
|
||||
gpNvm_Start = . ;
|
||||
. = 0x4000 ;
|
||||
. = 0x1800 ;
|
||||
gpNvm_End = . ;
|
||||
} > FLASH
|
||||
|
||||
@@ -103,30 +132,40 @@ SECTIONS
|
||||
_sbss = ADDR(.bss);
|
||||
_ebss = ADDR(.bss) + ALIGN(SIZEOF(.bss), 4);
|
||||
_lbss = _ebss - _sbss;
|
||||
/* use UCRAM for stack */
|
||||
_sstack = _ehigher_ram;
|
||||
_estack = ORIGIN(UCRAM) + LENGTH(UCRAM);
|
||||
_sbss_uc = ADDR(.bss_uc);
|
||||
_ebss_uc = ADDR(.bss_uc) + ALIGN(SIZEOF(.bss_uc), 4);
|
||||
_lbss_uc = _ebss_uc - _sbss_uc;
|
||||
|
||||
__configured_stack_size = 0x1200;
|
||||
__stack_size = _estack - _sstack;
|
||||
ASSERT(__stack_size >= __configured_stack_size, "STACK too small")
|
||||
/* using remaining UCRAM for stack */
|
||||
_sstack = _ehigher_ram;
|
||||
_estack = ORIGIN(UCRAM) + LENGTH(UCRAM);
|
||||
|
||||
_elower_ram = ADDR(.lower_ram_retain) + ALIGN(SIZEOF(.lower_ram_retain), 4);
|
||||
/* check minimum stack size is still available */
|
||||
min_stack_size = 0x2000;
|
||||
stack_size = _estack - _sstack;
|
||||
ASSERT(stack_size >= min_stack_size, "STACK too small")
|
||||
|
||||
/* fixme: needs to be calculated basedl on size of event block */
|
||||
/* total_nr_of_events_as_an_address = SIZEOF(.events) / 16;*/
|
||||
total_nr_of_events_as_an_address = 16;
|
||||
|
||||
/* needed for ram retention configuration */
|
||||
__lowerram_retain_size = _elower_retain - _slower_retain;
|
||||
|
||||
__higherram_retain_size = SIZEOF(.higher_ram_retain);
|
||||
|
||||
sw_retention_begin = ADDR(.ret_sw);
|
||||
sw_retention_end = ADDR(.ret_sw) + SIZEOF(.ret_sw);
|
||||
sw_retention_size = SIZEOF(.ret_sw);
|
||||
|
||||
/* needed for .windowed regions configuration */
|
||||
ram_regmap_begin = ADDR(.ram_regmap);
|
||||
events_begin = ADDR(.events);
|
||||
pbm_options_begin = ADDR(.pbm_options);
|
||||
|
||||
total_nr_of_events_as_an_address = SIZEOF(.events) / 16;
|
||||
/* check .windowed regions' offset from RAM start is divisible by 4 */
|
||||
ASSERT( ((ram_regmap_begin - 0x20008000) % 4) == 0, ".ram_regmap offset not divisible by 4")
|
||||
ASSERT( ((events_begin - 0x20008000) % 4) == 0, ".events offset not divisible by 4")
|
||||
ASSERT( ((pbm_options_begin - 0x20008000) % 4) == 0, ".pbm_options offset not divisible by 4")
|
||||
}
|
||||
|
||||
ENTRY(reset_handler)
|
||||
|
||||
|
||||
@@ -32,14 +32,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "radio_qorvo.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <common/logging.hpp>
|
||||
#include <openthread/platform/diag.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
#include "radio_qorvo.h"
|
||||
|
||||
enum
|
||||
{
|
||||
QPG6095_RECEIVE_SENSITIVITY = -100, // dBm
|
||||
@@ -67,42 +68,29 @@ enum
|
||||
extern otRadioFrame sTransmitFrame;
|
||||
|
||||
static otRadioState sState;
|
||||
// static bool sIsReceiverEnabled = false;
|
||||
static otInstance *pQorvoInstance;
|
||||
static otInstance * pQorvoInstance;
|
||||
|
||||
typedef struct otCachedSettings_s
|
||||
{
|
||||
uint16_t panid;
|
||||
} otCachedSettings_t;
|
||||
|
||||
static otCachedSettings_t otCachedSettings;
|
||||
|
||||
static uint8_t scanstate = 0;
|
||||
|
||||
/*****************************************************************************
|
||||
* Static Function Prototypes
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Static Data Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Static Function Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Function Definitions
|
||||
*****************************************************************************/
|
||||
static uint8_t sScanstate = 0;
|
||||
static int8_t sLastReceivedPower = 127;
|
||||
|
||||
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
qorvoRadioGetIeeeEui64(aIeeeEui64);
|
||||
}
|
||||
|
||||
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
qorvoRadioSetPanId(panid);
|
||||
otCachedSettings.panid = panid;
|
||||
}
|
||||
@@ -110,19 +98,22 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
|
||||
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
qorvoRadioSetExtendedAddress(address->m8);
|
||||
}
|
||||
|
||||
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
qorvoRadioSetShortAddress(address);
|
||||
}
|
||||
|
||||
bool otPlatRadioIsEnabled(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return (sState != OT_RADIO_STATE_DISABLED) ? true : false;
|
||||
|
||||
return (sState != OT_RADIO_STATE_DISABLED);
|
||||
}
|
||||
|
||||
otError otPlatRadioEnable(otInstance *aInstance)
|
||||
@@ -141,21 +132,24 @@ otError otPlatRadioEnable(otInstance *aInstance)
|
||||
otError otPlatRadioDisable(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
if (otPlatRadioIsEnabled(aInstance))
|
||||
|
||||
otEXPECT(otPlatRadioIsEnabled(aInstance));
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
{
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
{
|
||||
qorvoRadioSetRxOnWhenIdle(false);
|
||||
}
|
||||
sState = OT_RADIO_STATE_DISABLED;
|
||||
qorvoRadioSetRxOnWhenIdle(false);
|
||||
}
|
||||
|
||||
sState = OT_RADIO_STATE_DISABLED;
|
||||
|
||||
exit:
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioSleep(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
if (sState == OT_RADIO_STATE_RECEIVE)
|
||||
{
|
||||
qorvoRadioSetRxOnWhenIdle(false);
|
||||
@@ -167,14 +161,16 @@ otError otPlatRadioSleep(otInstance *aInstance)
|
||||
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
{
|
||||
otError error = OT_ERROR_INVALID_STATE;
|
||||
otError error = OT_ERROR_INVALID_STATE;
|
||||
|
||||
pQorvoInstance = aInstance;
|
||||
|
||||
if ((sState != OT_RADIO_STATE_DISABLED) && (scanstate == 0))
|
||||
if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0))
|
||||
{
|
||||
qorvoRadioSetCurrentChannel(aChannel);
|
||||
error = OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
if (sState == OT_RADIO_STATE_SLEEP)
|
||||
{
|
||||
qorvoRadioSetRxOnWhenIdle(true);
|
||||
@@ -187,14 +183,16 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
|
||||
|
||||
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aPacket)
|
||||
{
|
||||
otError err = OT_ERROR_NONE;
|
||||
|
||||
pQorvoInstance = aInstance;
|
||||
|
||||
if (sState == OT_RADIO_STATE_DISABLED)
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE);
|
||||
|
||||
return qorvoRadioTransmit(aPacket);
|
||||
err = qorvoRadioTransmit(aPacket);
|
||||
|
||||
exit:
|
||||
return err;
|
||||
}
|
||||
|
||||
void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError)
|
||||
@@ -220,9 +218,10 @@ void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError
|
||||
|
||||
void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
|
||||
{
|
||||
// TODO Set this flag only when the packet is really acknowledged with frame pending set.
|
||||
// See https://github.com/openthread/openthread/pull/3785
|
||||
aPacket->mInfo.mRxInfo.mAckedWithFramePending = true;
|
||||
if (aError == OT_ERROR_NONE)
|
||||
{
|
||||
sLastReceivedPower = aPacket->mInfo.mRxInfo.mRssi;
|
||||
}
|
||||
|
||||
otPlatRadioReceiveDone(pQorvoInstance, aPacket, aError);
|
||||
}
|
||||
@@ -230,24 +229,28 @@ void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
|
||||
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return &sTransmitFrame;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetRssi(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return 0;
|
||||
|
||||
return sLastReceivedPower;
|
||||
}
|
||||
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
|
||||
}
|
||||
|
||||
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -260,36 +263,42 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
|
||||
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
qorvoRadioEnableSrcMatch(aEnable);
|
||||
}
|
||||
|
||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return qorvoRadioAddSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
|
||||
}
|
||||
|
||||
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
|
||||
}
|
||||
|
||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return qorvoRadioClearSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
|
||||
}
|
||||
|
||||
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
|
||||
}
|
||||
|
||||
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
/* clear both short and extended addresses here */
|
||||
qorvoRadioClearSrcMatchEntries();
|
||||
}
|
||||
@@ -297,6 +306,7 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
|
||||
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
/* not implemented */
|
||||
/* assumes clearing of short and extended entries is done simultaniously by the openthread stack */
|
||||
}
|
||||
@@ -304,36 +314,44 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
|
||||
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
scanstate = 1;
|
||||
|
||||
sScanstate = 1;
|
||||
return qorvoRadioEnergyScan(aScanChannel, aScanDuration);
|
||||
}
|
||||
|
||||
void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
|
||||
{
|
||||
scanstate = 0;
|
||||
sScanstate = 0;
|
||||
otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi);
|
||||
}
|
||||
|
||||
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPower);
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
return qorvoRadioGetTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aPower);
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
|
||||
{
|
||||
return OT_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
return qorvoRadioSetTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -341,11 +359,19 @@ otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aTh
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return QPG6095_RECEIVE_SENSITIVITY;
|
||||
}
|
||||
|
||||
const char *otPlatRadioGetVersionString(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return "OPENTHREAD/Qorvo/0.0";
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openthread/error.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
/**
|
||||
@@ -172,6 +174,22 @@ otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid
|
||||
*/
|
||||
otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
|
||||
|
||||
/**
|
||||
* This function gets the transmit power for current channel
|
||||
*
|
||||
* @param[out] aPower The transmit power
|
||||
*
|
||||
*/
|
||||
otError qorvoRadioGetTransmitPower(int8_t *aPower);
|
||||
|
||||
/**
|
||||
* This function sets the transmit power for current channel
|
||||
*
|
||||
* @param[in] aPower The transmit power
|
||||
*
|
||||
*/
|
||||
otError qorvoRadioSetTransmitPower(int8_t aPower);
|
||||
|
||||
/**
|
||||
* This callback is called when the energy scan is finished.
|
||||
*
|
||||
|
||||
@@ -78,3 +78,13 @@ void cbQorvoUartTxDone(void)
|
||||
{
|
||||
otPlatUartSendDone();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -39,12 +39,6 @@
|
||||
#include <stdint.h>
|
||||
#include <openthread/platform/logging.h>
|
||||
|
||||
/**
|
||||
* This function performs UART driver processing.
|
||||
*
|
||||
*/
|
||||
void qorvoUartProcess(void);
|
||||
|
||||
/**
|
||||
* This function enables the UART driver.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
# Do not enable -Wcast-align for this platform
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
lib_LIBRARIES = libopenthread-qpg6100.a
|
||||
|
||||
libopenthread_qpg6100_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/utils \
|
||||
-I$(top_srcdir)/examples/platforms/qpg6100 \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
misc_qorvo.h \
|
||||
openthread-core-qpg6100-config.h \
|
||||
openthread-core-qpg6100-config-check.h \
|
||||
platform.c \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
settings.cpp \
|
||||
settings_qorvo.h \
|
||||
uart.c \
|
||||
uart_qorvo.h \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_qpg6100_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
Dash = -
|
||||
libopenthread_qpg6100_a_LIBADD = \
|
||||
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
endif # OPENTHREAD_BUILD_COVERAGE
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
# qpg6100 platform-specific Makefile
|
||||
#
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/qpg6100/libopenthread-qpg6100.a \
|
||||
$(NULL)
|
||||
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/libmbedtls_alt.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/libQorvoQPG6100_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/libQorvoQPG6100_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
LDFLAGS_COMMON += \
|
||||
-T $(top_srcdir)/examples/platforms/qpg6100/qpg6100.ld \
|
||||
$(NULL)
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/alarm.c
|
||||
@@ -0,0 +1 @@
|
||||
../qpg6095/alarm_qorvo.h
|
||||
@@ -0,0 +1,230 @@
|
||||
/**
|
||||
* \file aes_alt.h
|
||||
*
|
||||
* \brief AES block cipher
|
||||
*
|
||||
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
#ifndef MBEDTLS_AES_ALT_H
|
||||
#define MBEDTLS_AES_ALT_H
|
||||
|
||||
#if defined(MBEDTLS_AES_ALT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief AES context structure
|
||||
*
|
||||
* \note buf is able to hold 32 extra bytes, which can be used:
|
||||
* - for alignment purposes if VIA padlock is used, and/or
|
||||
* - to simplify key expansion in the 256-bit case by
|
||||
* generating an extra round key
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t buf[68]; /*!< unaligned data */
|
||||
unsigned char key[32]; /*!< internal copy of the key */
|
||||
unsigned int keysize; /*!< size in bytes of the key */
|
||||
} mbedtls_aes_context;
|
||||
|
||||
/**
|
||||
* \brief Initialize AES context
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
*/
|
||||
void mbedtls_aes_init(mbedtls_aes_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief Clear AES context
|
||||
*
|
||||
* \param ctx AES context to be cleared
|
||||
*/
|
||||
void mbedtls_aes_free(mbedtls_aes_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (encryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key encryption key
|
||||
* \param keybits must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits);
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (decryption)
|
||||
*
|
||||
* \param ctx AES context to be initialized
|
||||
* \param key decryption key
|
||||
* \param keybits must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits);
|
||||
|
||||
/**
|
||||
* \brief AES-ECB block encryption/decryption
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||
* \param input 16-byte input block
|
||||
* \param output 16-byte output block
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16]);
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
/**
|
||||
* \brief AES-CBC buffer encryption/decryption
|
||||
* Length should be a multiple of the block
|
||||
* size (16 bytes)
|
||||
*
|
||||
* \note Upon exit, the content of the IV is updated so that you can
|
||||
* call the function same function again on the following
|
||||
* block(s) of data and get the same result as if it was
|
||||
* encrypted in one call. This allows a "streaming" usage.
|
||||
* If on the other hand you need to retain the contents of the
|
||||
* IV, you should either save it manually or use the cipher
|
||||
* module instead.
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
*/
|
||||
int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char * output);
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
/**
|
||||
* \brief AES-CFB128 buffer encryption/decryption.
|
||||
*
|
||||
* Note: Due to the nature of CFB you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||
*
|
||||
* \note Upon exit, the content of the IV is updated so that you can
|
||||
* call the function same function again on the following
|
||||
* block(s) of data and get the same result as if it was
|
||||
* encrypted in one call. This allows a "streaming" usage.
|
||||
* If on the other hand you need to retain the contents of the
|
||||
* IV, you should either save it manually or use the cipher
|
||||
* module instead.
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv_off offset in IV (updated after use)
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
size_t * iv_off,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char * output);
|
||||
|
||||
/**
|
||||
* \brief AES-CFB8 buffer encryption/decryption.
|
||||
*
|
||||
* Note: Due to the nature of CFB you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||
*
|
||||
* \note Upon exit, the content of the IV is updated so that you can
|
||||
* call the function same function again on the following
|
||||
* block(s) of data and get the same result as if it was
|
||||
* encrypted in one call. This allows a "streaming" usage.
|
||||
* If on the other hand you need to retain the contents of the
|
||||
* IV, you should either save it manually or use the cipher
|
||||
* module instead.
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
|
||||
* \param length length of the input data
|
||||
* \param iv initialization vector (updated after use)
|
||||
* \param input buffer holding the input data
|
||||
* \param output buffer holding the output data
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char * output);
|
||||
#endif /*MBEDTLS_CIPHER_MODE_CFB */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||
/**
|
||||
* \brief AES-CTR buffer encryption/decryption
|
||||
*
|
||||
* Warning: You have to keep the maximum use of your counter in mind!
|
||||
*
|
||||
* Note: Due to the nature of CTR you should use the same key schedule for
|
||||
* both encryption and decryption. So a context initialized with
|
||||
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
|
||||
*
|
||||
* \param ctx AES context
|
||||
* \param length The length of the data
|
||||
* \param nc_off The offset in the current stream_block (for resuming
|
||||
* within current cipher stream). The offset pointer to
|
||||
* should be 0 at the start of a stream.
|
||||
* \param nonce_counter The 128-bit nonce and counter.
|
||||
* \param stream_block The saved stream-block for resuming. Is overwritten
|
||||
* by the function.
|
||||
* \param input The input data stream
|
||||
* \param output The output data stream
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx,
|
||||
size_t length,
|
||||
size_t * nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
const unsigned char *input,
|
||||
unsigned char * output);
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_AES_ALT */
|
||||
|
||||
#endif /* aes_alt.h */
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* \file ccm_alt.h
|
||||
*
|
||||
* \brief CCM combines Counter mode encryption with CBC-MAC authentication
|
||||
* for 128-bit block ciphers.
|
||||
*
|
||||
* Input to CCM includes the following elements:
|
||||
* <ul><li>Payload - data that is both authenticated and encrypted.</li>
|
||||
* <li>Associated data (Adata) - data that is authenticated but not
|
||||
* encrypted, For example, a header.</li>
|
||||
* <li>Nonce - A unique value that is assigned to the payload and the
|
||||
* associated data.</li></ul>
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_CCM_ALT_H
|
||||
#define MBEDTLS_CCM_ALT_H
|
||||
|
||||
#if defined(MBEDTLS_CCM_ALT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef MBEDTLS_AES_MAX_KEY_SIZE
|
||||
#define MBEDTLS_AES_MAX_KEY_SIZE 32
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The CCM context-type definition. The CCM context is passed
|
||||
* to the APIs called.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t key[MBEDTLS_AES_MAX_KEY_SIZE];
|
||||
int keysize;
|
||||
} mbedtls_ccm_context;
|
||||
|
||||
/**
|
||||
* \brief This function initializes the specified CCM context,
|
||||
* to make references valid, and prepare the context
|
||||
* for mbedtls_ccm_setkey() or mbedtls_ccm_free().
|
||||
*
|
||||
* \param ctx The CCM context to initialize.
|
||||
*/
|
||||
void mbedtls_ccm_init(mbedtls_ccm_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief This function initializes the CCM context set in the
|
||||
* \p ctx parameter and sets the encryption key.
|
||||
*
|
||||
* \param ctx The CCM context to initialize.
|
||||
* \param cipher The 128-bit block cipher to use.
|
||||
* \param key The encryption key.
|
||||
* \param keybits The key size in bits. This must be acceptable by the cipher.
|
||||
*
|
||||
* \return \c 0 on success, or a cipher-specific error code.
|
||||
*/
|
||||
int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx,
|
||||
mbedtls_cipher_id_t cipher,
|
||||
const unsigned char *key,
|
||||
unsigned int keybits);
|
||||
|
||||
/**
|
||||
* \brief This function releases and clears the specified CCM context
|
||||
* and underlying cipher sub-context.
|
||||
*
|
||||
* \param ctx The CCM context to clear.
|
||||
*/
|
||||
void mbedtls_ccm_free(mbedtls_ccm_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief This function encrypts a buffer using CCM.
|
||||
*
|
||||
* \param ctx The CCM context to use for encryption.
|
||||
* \param length The length of the input data in Bytes.
|
||||
* \param iv Initialization vector (nonce).
|
||||
* \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
|
||||
* \param add The additional data field.
|
||||
* \param add_len The length of additional data in Bytes.
|
||||
* Must be less than 2^16 - 2^8.
|
||||
* \param input The buffer holding the input data.
|
||||
* \param output The buffer holding the output data.
|
||||
* Must be at least \p length Bytes wide.
|
||||
* \param tag The buffer holding the tag.
|
||||
* \param tag_len The length of the tag to generate in Bytes:
|
||||
* 4, 6, 8, 10, 14 or 16.
|
||||
*
|
||||
* \note The tag is written to a separate buffer. To concatenate
|
||||
* the \p tag with the \p output, as done in <em>RFC-3610:
|
||||
* Counter with CBC-MAC (CCM)</em>, use
|
||||
* \p tag = \p output + \p length, and make sure that the
|
||||
* output buffer is at least \p length + \p tag_len wide.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_ccm_encrypt_and_tag(mbedtls_ccm_context *ctx,
|
||||
size_t length,
|
||||
const unsigned char *iv,
|
||||
size_t iv_len,
|
||||
const unsigned char *add,
|
||||
size_t add_len,
|
||||
const unsigned char *input,
|
||||
unsigned char * output,
|
||||
unsigned char * tag,
|
||||
size_t tag_len);
|
||||
|
||||
/**
|
||||
* \brief This function performs a CCM authenticated decryption of a
|
||||
* buffer.
|
||||
*
|
||||
* \param ctx The CCM context to use for decryption.
|
||||
* \param length The length of the input data in Bytes.
|
||||
* \param iv Initialization vector.
|
||||
* \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
|
||||
* \param add The additional data field.
|
||||
* \param add_len The length of additional data in Bytes.
|
||||
* \param input The buffer holding the input data.
|
||||
* \param output The buffer holding the output data.
|
||||
* \param tag The buffer holding the tag.
|
||||
* \param tag_len The length of the tag in Bytes.
|
||||
*
|
||||
* \return 0 if successful and authenticated, or
|
||||
* #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
|
||||
*/
|
||||
int mbedtls_ccm_auth_decrypt(mbedtls_ccm_context *ctx,
|
||||
size_t length,
|
||||
const unsigned char *iv,
|
||||
size_t iv_len,
|
||||
const unsigned char *add,
|
||||
size_t add_len,
|
||||
const unsigned char *input,
|
||||
unsigned char * output,
|
||||
const unsigned char *tag,
|
||||
size_t tag_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_CCM_ALT */
|
||||
|
||||
#endif /* MBEDTLS_CCM_ALT_H */
|
||||
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* \file ecjpake_alt.h
|
||||
*
|
||||
* \brief Elliptic curve J-PAKE
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
#ifndef MBEDTLS_ECJPAKE_ALT_H
|
||||
#define MBEDTLS_ECJPAKE_ALT_H
|
||||
|
||||
#if defined(MBEDTLS_ECJPAKE_ALT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MBEDTLS_ECJPAKE_ALT // QORVO
|
||||
/**
|
||||
* Roles in the EC J-PAKE exchange
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
MBEDTLS_ECJPAKE_CLIENT = 0, /**< Client */
|
||||
MBEDTLS_ECJPAKE_SERVER, /**< Server */
|
||||
} mbedtls_ecjpake_role;
|
||||
#endif // MBEDTLS_ECJPAKE_ALT // QORVO
|
||||
|
||||
#ifndef MBEDTLS_ECJPAKE_MAX_BYTES
|
||||
|
||||
/** The maximum size in bytes for a ECJPAKE number or coordinate.
|
||||
*
|
||||
* Default size works for P256 as MbedTLS and the Thread standard officially
|
||||
* only support P256. To support larger curves, chose MBEDTLS_ECP_MAX_BYTES.
|
||||
*/
|
||||
#define MBEDTLS_ECJPAKE_MAX_BYTES (256 / 8)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* EC J-PAKE context structure.
|
||||
*
|
||||
* J-PAKE is a symmetric protocol, except for the identifiers used in
|
||||
* Zero-Knowledge Proofs, and the serialization of the second message
|
||||
* (KeyExchange) as defined by the Thread spec.
|
||||
*
|
||||
* In order to benefit from this symmetry, we choose a different naming
|
||||
* convetion from the Thread v1.0 spec. Correspondance is indicated in the
|
||||
* description as a pair C: client name, S: server name
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mbedtls_ecp_group grp; /**< Elliptic curve */
|
||||
mbedtls_ecjpake_role role; /**< Are we client or server? */
|
||||
int point_format; /**< Format for point export */
|
||||
|
||||
mbedtls_ecp_point Xm1; /**< My public key 1 C: X1, S: X3 */
|
||||
mbedtls_ecp_point Xm2; /**< My public key 2 C: X2, S: X4 */
|
||||
mbedtls_ecp_point Xp1; /**< Peer public key 1 C: X3, S: X1 */
|
||||
mbedtls_ecp_point Xp2; /**< Peer public key 2 C: X4, S: X2 */
|
||||
mbedtls_ecp_point Xp; /**< Peer public key C: Xs, S: Xc */
|
||||
|
||||
mbedtls_mpi xm1; /**< My private key 1 C: x1, S: x3 */
|
||||
mbedtls_mpi xm2; /**< My private key 2 C: x2, S: x4 */
|
||||
|
||||
mbedtls_mpi s; /**< Pre-shared secret (passphrase) */
|
||||
|
||||
const struct sx_ecc_curve_t *curve; /**< Elliptic curve for HW offload */
|
||||
int hashalg; /**< Hash algorithm for HW offload */
|
||||
} mbedtls_ecjpake_context;
|
||||
|
||||
#ifndef MBEDTLS_ECJPAKE_ALT // QORVO
|
||||
/**
|
||||
* \brief Initialize a context
|
||||
* (just makes it ready for setup() or free()).
|
||||
*
|
||||
* \param ctx context to initialize
|
||||
*/
|
||||
void mbedtls_ecjpake_init(mbedtls_ecjpake_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief Set up a context for use
|
||||
*
|
||||
* \note Currently the only values for hash/curve allowed by the
|
||||
* standard are MBEDTLS_MD_SHA256/MBEDTLS_ECP_DP_SECP256R1.
|
||||
*
|
||||
* \param ctx context to set up
|
||||
* \param role Our role: client or server
|
||||
* \param hash hash function to use (MBEDTLS_MD_XXX)
|
||||
* \param curve elliptic curve identifier (MBEDTLS_ECP_DP_XXX)
|
||||
* \param secret pre-shared secret (passphrase)
|
||||
* \param len length of the shared secret
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_setup(mbedtls_ecjpake_context *ctx,
|
||||
mbedtls_ecjpake_role role,
|
||||
mbedtls_md_type_t hash,
|
||||
mbedtls_ecp_group_id curve,
|
||||
const unsigned char * secret,
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* \brief Check if a context is ready for use
|
||||
*
|
||||
* \param ctx Context to check
|
||||
*
|
||||
* \return 0 if the context is ready for use,
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_check(const mbedtls_ecjpake_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief Generate and write the first round message
|
||||
* (TLS: contents of the Client/ServerHello extension,
|
||||
* excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Buffer to write the contents to
|
||||
* \param len Buffer size
|
||||
* \param olen Will be updated with the number of bytes written
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_write_round_one(mbedtls_ecjpake_context *ctx,
|
||||
unsigned char * buf,
|
||||
size_t len,
|
||||
size_t * olen,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Read and process the first round message
|
||||
* (TLS: contents of the Client/ServerHello extension,
|
||||
* excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Pointer to extension contents
|
||||
* \param len Extension length
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_read_round_one(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Generate and write the second round message
|
||||
* (TLS: contents of the Client/ServerKeyExchange)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Buffer to write the contents to
|
||||
* \param len Buffer size
|
||||
* \param olen Will be updated with the number of bytes written
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_write_round_two(mbedtls_ecjpake_context *ctx,
|
||||
unsigned char * buf,
|
||||
size_t len,
|
||||
size_t * olen,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Read and process the second round message
|
||||
* (TLS: contents of the Client/ServerKeyExchange)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Pointer to the message
|
||||
* \param len Message length
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_read_round_two(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Derive the shared secret
|
||||
* (TLS: Pre-Master Secret)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Buffer to write the contents to
|
||||
* \param len Buffer size
|
||||
* \param olen Will be updated with the number of bytes written
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_derive_secret(mbedtls_ecjpake_context *ctx,
|
||||
unsigned char * buf,
|
||||
size_t len,
|
||||
size_t * olen,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Free a context's content
|
||||
*
|
||||
* \param ctx context to free
|
||||
*/
|
||||
void mbedtls_ecjpake_free(mbedtls_ecjpake_context *ctx);
|
||||
#endif // MBEDTLS_ECJPAKE_ALT // QORVO
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_ECJPAKE_ALT */
|
||||
|
||||
#endif /* ecjpake.h */
|
||||
@@ -0,0 +1,657 @@
|
||||
/**
|
||||
* \file ecp_alt.h
|
||||
*
|
||||
* \brief Elliptic curves over GF(p)
|
||||
*
|
||||
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
/* Adapted for hardware acceleration by CryptoSoc
|
||||
* Copyright (c) 2018 Barco Silex
|
||||
* Copyright (c) 2018 François Beerten
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_ECP_ALT_H
|
||||
#define MBEDTLS_ECP_ALT_H
|
||||
|
||||
/*
|
||||
* default mbed TLS elliptic curve arithmetic implementation
|
||||
*
|
||||
* (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
|
||||
* alternative implementation for the whole module and it will replace this
|
||||
* one.)
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MBEDTLS_ECP_ALT // QORVO
|
||||
/**
|
||||
* Domain parameters (curve, subgroup and generator) identifiers.
|
||||
*
|
||||
* Only curves over prime fields are supported.
|
||||
*
|
||||
* \warning This library does not support validation of arbitrary domain
|
||||
* parameters. Therefore, only well-known domain parameters from trusted
|
||||
* sources should be used. See mbedtls_ecp_group_load().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
MBEDTLS_ECP_DP_NONE = 0,
|
||||
MBEDTLS_ECP_DP_SECP192R1, /*!< 192-bits NIST curve */
|
||||
MBEDTLS_ECP_DP_SECP224R1, /*!< 224-bits NIST curve */
|
||||
MBEDTLS_ECP_DP_SECP256R1, /*!< 256-bits NIST curve */
|
||||
MBEDTLS_ECP_DP_SECP384R1, /*!< 384-bits NIST curve */
|
||||
MBEDTLS_ECP_DP_SECP521R1, /*!< 521-bits NIST curve */
|
||||
MBEDTLS_ECP_DP_BP256R1, /*!< 256-bits Brainpool curve */
|
||||
MBEDTLS_ECP_DP_BP384R1, /*!< 384-bits Brainpool curve */
|
||||
MBEDTLS_ECP_DP_BP512R1, /*!< 512-bits Brainpool curve */
|
||||
MBEDTLS_ECP_DP_CURVE25519, /*!< Curve25519 */
|
||||
MBEDTLS_ECP_DP_SECP192K1, /*!< 192-bits "Koblitz" curve */
|
||||
MBEDTLS_ECP_DP_SECP224K1, /*!< 224-bits "Koblitz" curve */
|
||||
MBEDTLS_ECP_DP_SECP256K1, /*!< 256-bits "Koblitz" curve */
|
||||
} mbedtls_ecp_group_id;
|
||||
|
||||
/**
|
||||
* Number of supported curves (plus one for NONE).
|
||||
*
|
||||
* (Montgomery curves excluded for now.)
|
||||
*/
|
||||
#define MBEDTLS_ECP_DP_MAX 12
|
||||
|
||||
/**
|
||||
* Curve information for use by other modules
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mbedtls_ecp_group_id grp_id; /*!< Internal identifier */
|
||||
uint16_t tls_id; /*!< TLS NamedCurve identifier */
|
||||
uint16_t bit_size; /*!< Curve size in bits */
|
||||
const char * name; /*!< Human-friendly name */
|
||||
} mbedtls_ecp_curve_info;
|
||||
|
||||
/**
|
||||
* \brief ECP point structure (jacobian coordinates)
|
||||
*
|
||||
* \note All functions expect and return points satisfying
|
||||
* the following condition: Z == 0 or Z == 1. (Other
|
||||
* values of Z are used by internal functions only.)
|
||||
* The point is zero, or "at infinity", if Z == 0.
|
||||
* Otherwise, X and Y are its standard (affine) coordinates.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mbedtls_mpi X; /*!< the point's X coordinate */
|
||||
mbedtls_mpi Y; /*!< the point's Y coordinate */
|
||||
mbedtls_mpi Z; /*!< the point's Z coordinate */
|
||||
} mbedtls_ecp_point;
|
||||
#endif // MBEDTLS_ECP_ALT // QORVO
|
||||
|
||||
/**
|
||||
* \brief ECP group structure
|
||||
*
|
||||
* We consider two types of curves equations:
|
||||
* 1. Short Weierstrass y^2 = x^3 + A x + B mod P (SEC1 + RFC 4492)
|
||||
* 2. Montgomery, y^2 = x^3 + A x^2 + x mod P (Curve25519 + draft)
|
||||
* In both cases, a generator G for a prime-order subgroup is fixed. In the
|
||||
* short weierstrass, this subgroup is actually the whole curve, and its
|
||||
* cardinal is denoted by N.
|
||||
*
|
||||
* In the case of Short Weierstrass curves, our code requires that N is an odd
|
||||
* prime. (Use odd in mbedtls_ecp_mul() and prime in mbedtls_ecdsa_sign() for blinding.)
|
||||
*
|
||||
* In the case of Montgomery curves, we don't store A but (A + 2) / 4 which is
|
||||
* the quantity actually used in the formulas. Also, nbits is not the size of N
|
||||
* but the required size for private keys.
|
||||
*
|
||||
* If modp is NULL, reduction modulo P is done using a generic algorithm.
|
||||
* Otherwise, it must point to a function that takes an mbedtls_mpi in the range
|
||||
* 0..2^(2*pbits)-1 and transforms it in-place in an integer of little more
|
||||
* than pbits, so that the integer may be efficiently brought in the 0..P-1
|
||||
* range by a few additions or substractions. It must return 0 on success and
|
||||
* non-zero on failure.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mbedtls_ecp_group_id id; /*!< internal group identifier */
|
||||
mbedtls_mpi P; /*!< prime modulus of the base field */
|
||||
mbedtls_mpi A; /*!< 1. A in the equation, or 2. (A + 2) / 4. for pkparse only. */
|
||||
mbedtls_mpi B; /*!< 1. B in the equation, or 2. unused. for pkparse only. */
|
||||
mbedtls_ecp_point G; /*!< generator of the (sub)group used */
|
||||
mbedtls_mpi N; /*!< 1. the order of G, or 2. unused */
|
||||
size_t pbits; /*!< number of bits in P */
|
||||
size_t nbits; /*!< number of bits in 1. P, or 2. private keys */
|
||||
unsigned int h; /*!< internal: 1 if the constants are static */
|
||||
int (*modp)(mbedtls_mpi *); /*!< Internally unused. NULL to build some tests. */
|
||||
mbedtls_ecp_point *T; /*!< Internally unused. Needed to build benchmark. */
|
||||
size_t T_size; /*!< Internally unused. Needed to build benchmark. */
|
||||
} mbedtls_ecp_group;
|
||||
|
||||
#ifndef MBEDTLS_ECP_ALT // QORVO
|
||||
/**
|
||||
* \brief ECP key pair structure
|
||||
*
|
||||
* A generic key pair that could be used for ECDSA, fixed ECDH, etc.
|
||||
*
|
||||
* \note Members purposefully in the same order as struc mbedtls_ecdsa_context.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mbedtls_ecp_group grp; /*!< Elliptic curve and base point */
|
||||
mbedtls_mpi d; /*!< our secret value */
|
||||
mbedtls_ecp_point Q; /*!< our public value */
|
||||
} mbedtls_ecp_keypair;
|
||||
#endif // MBEDTLS_ECP_ALT // QORVO
|
||||
|
||||
/**
|
||||
* \name SECTION: Module settings
|
||||
*
|
||||
* The configuration options you can set for this module are in this section.
|
||||
* Either change them in config.h or define them on the compiler command line.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#if !defined(MBEDTLS_ECP_MAX_BITS)
|
||||
/**
|
||||
* Maximum size of the groups (that is, of N and P)
|
||||
*/
|
||||
#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
|
||||
#define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1)
|
||||
|
||||
#if defined(MBEDTLS_ECP_WINDOW_SIZE)
|
||||
#error "MBEDTLS_ECP_WINDOW_SIZE not applicable for HW accel"
|
||||
#endif /* MBEDTLS_ECP_WINDOW_SIZE */
|
||||
|
||||
#if defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
|
||||
#error "MBEDTLS_ECP_FIXED_POINT_OPTIM not applicable for HW accel"
|
||||
#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
|
||||
|
||||
/* \} name SECTION: Module settings */
|
||||
|
||||
/*
|
||||
* Point formats, from RFC 4492's enum ECPointFormat
|
||||
*/
|
||||
#define MBEDTLS_ECP_PF_UNCOMPRESSED 0 /**< Uncompressed point format */
|
||||
#define MBEDTLS_ECP_PF_COMPRESSED 1 /**< Compressed point format */
|
||||
|
||||
/*
|
||||
* Some other constants from RFC 4492
|
||||
*/
|
||||
#define MBEDTLS_ECP_TLS_NAMED_CURVE 3 /**< ECCurveType's named_curve */
|
||||
|
||||
#ifndef MBEDTLS_ECP_ALT // QORVO
|
||||
/**
|
||||
* \brief Get the list of supported curves in order of preferrence
|
||||
* (full information)
|
||||
*
|
||||
* \return A statically allocated array, the last entry is 0.
|
||||
*/
|
||||
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list(void);
|
||||
|
||||
/**
|
||||
* \brief Get the list of supported curves in order of preferrence
|
||||
* (grp_id only)
|
||||
*
|
||||
* \return A statically allocated array,
|
||||
* terminated with MBEDTLS_ECP_DP_NONE.
|
||||
*/
|
||||
const mbedtls_ecp_group_id *mbedtls_ecp_grp_id_list(void);
|
||||
|
||||
/**
|
||||
* \brief Get curve information from an internal group identifier
|
||||
*
|
||||
* \param grp_id A MBEDTLS_ECP_DP_XXX value
|
||||
*
|
||||
* \return The associated curve information or NULL
|
||||
*/
|
||||
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id(mbedtls_ecp_group_id grp_id);
|
||||
|
||||
/**
|
||||
* \brief Get curve information from a TLS NamedCurve value
|
||||
*
|
||||
* \param tls_id A MBEDTLS_ECP_DP_XXX value
|
||||
*
|
||||
* \return The associated curve information or NULL
|
||||
*/
|
||||
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id);
|
||||
|
||||
/**
|
||||
* \brief Get curve information from a human-readable name
|
||||
*
|
||||
* \param name The name
|
||||
*
|
||||
* \return The associated curve information or NULL
|
||||
*/
|
||||
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name(const char *name);
|
||||
|
||||
/**
|
||||
* \brief Initialize a point (as zero)
|
||||
*/
|
||||
void mbedtls_ecp_point_init(mbedtls_ecp_point *pt);
|
||||
|
||||
/**
|
||||
* \brief Initialize a group (to something meaningless)
|
||||
*/
|
||||
void mbedtls_ecp_group_init(mbedtls_ecp_group *grp);
|
||||
|
||||
/**
|
||||
* \brief Initialize a key pair (as an invalid one)
|
||||
*/
|
||||
void mbedtls_ecp_keypair_init(mbedtls_ecp_keypair *key);
|
||||
|
||||
/**
|
||||
* \brief Free the components of a point
|
||||
*/
|
||||
void mbedtls_ecp_point_free(mbedtls_ecp_point *pt);
|
||||
|
||||
/**
|
||||
* \brief Free the components of an ECP group
|
||||
*/
|
||||
void mbedtls_ecp_group_free(mbedtls_ecp_group *grp);
|
||||
|
||||
/**
|
||||
* \brief Free the components of a key pair
|
||||
*/
|
||||
void mbedtls_ecp_keypair_free(mbedtls_ecp_keypair *key);
|
||||
|
||||
/**
|
||||
* \brief Copy the contents of point Q into P
|
||||
*
|
||||
* \param P Destination point
|
||||
* \param Q Source point
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
|
||||
*/
|
||||
int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q);
|
||||
|
||||
/**
|
||||
* \brief Copy the contents of a group object
|
||||
*
|
||||
* \param dst Destination group
|
||||
* \param src Source group
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
|
||||
*/
|
||||
int mbedtls_ecp_group_copy(mbedtls_ecp_group *dst, const mbedtls_ecp_group *src);
|
||||
|
||||
/**
|
||||
* \brief Set a point to zero
|
||||
*
|
||||
* \param pt Destination point
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
|
||||
*/
|
||||
int mbedtls_ecp_set_zero(mbedtls_ecp_point *pt);
|
||||
|
||||
/**
|
||||
* \brief Tell if a point is zero
|
||||
*
|
||||
* \param pt Point to test
|
||||
*
|
||||
* \return 1 if point is zero, 0 otherwise
|
||||
*/
|
||||
int mbedtls_ecp_is_zero(mbedtls_ecp_point *pt);
|
||||
|
||||
/**
|
||||
* \brief Compare two points
|
||||
*
|
||||
* \note This assumes the points are normalized. Otherwise,
|
||||
* they may compare as "not equal" even if they are.
|
||||
*
|
||||
* \param P First point to compare
|
||||
* \param Q Second point to compare
|
||||
*
|
||||
* \return 0 if the points are equal,
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise
|
||||
*/
|
||||
int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q);
|
||||
|
||||
/**
|
||||
* \brief Import a non-zero point from two ASCII strings
|
||||
*
|
||||
* \param P Destination point
|
||||
* \param radix Input numeric base
|
||||
* \param x First affine coordinate as a null-terminated string
|
||||
* \param y Second affine coordinate as a null-terminated string
|
||||
*
|
||||
* \return 0 if successful, or a MBEDTLS_ERR_MPI_XXX error code
|
||||
*/
|
||||
int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, const char *x, const char *y);
|
||||
|
||||
/**
|
||||
* \brief Export a point into unsigned binary data
|
||||
*
|
||||
* \param grp Group to which the point should belong
|
||||
* \param P Point to export
|
||||
* \param format Point format, should be a MBEDTLS_ECP_PF_XXX macro
|
||||
* \param olen Length of the actual output
|
||||
* \param buf Output buffer
|
||||
* \param buflen Length of the output buffer
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or MBEDTLS_ERR_ECP_BAD_INPUT_DATA
|
||||
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
|
||||
*/
|
||||
int mbedtls_ecp_point_write_binary(const mbedtls_ecp_group *grp,
|
||||
const mbedtls_ecp_point *P,
|
||||
int format,
|
||||
size_t * olen,
|
||||
unsigned char * buf,
|
||||
size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Import a point from unsigned binary data
|
||||
*
|
||||
* \param grp Group to which the point should belong
|
||||
* \param P Point to import
|
||||
* \param buf Input buffer
|
||||
* \param ilen Actual length of input
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed,
|
||||
* MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the point format
|
||||
* is not implemented.
|
||||
*
|
||||
* \note This function does NOT check that the point actually
|
||||
* belongs to the given group, see mbedtls_ecp_check_pubkey() for
|
||||
* that.
|
||||
*/
|
||||
int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp,
|
||||
mbedtls_ecp_point * P,
|
||||
const unsigned char * buf,
|
||||
size_t ilen);
|
||||
|
||||
/**
|
||||
* \brief Import a point from a TLS ECPoint record
|
||||
*
|
||||
* \param grp ECP group used
|
||||
* \param pt Destination point
|
||||
* \param buf $(Start of input buffer)
|
||||
* \param len Buffer length
|
||||
*
|
||||
* \note buf is updated to point right after the ECPoint on exit
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_XXX if initialization failed
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid
|
||||
*/
|
||||
int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp,
|
||||
mbedtls_ecp_point * pt,
|
||||
const unsigned char ** buf,
|
||||
size_t len);
|
||||
|
||||
/**
|
||||
* \brief Export a point as a TLS ECPoint record
|
||||
*
|
||||
* \param grp ECP group used
|
||||
* \param pt Point to export
|
||||
* \param format Export format
|
||||
* \param olen length of data written
|
||||
* \param buf Buffer to write to
|
||||
* \param blen Buffer length
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or MBEDTLS_ERR_ECP_BAD_INPUT_DATA
|
||||
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
|
||||
*/
|
||||
int mbedtls_ecp_tls_write_point(const mbedtls_ecp_group *grp,
|
||||
const mbedtls_ecp_point *pt,
|
||||
int format,
|
||||
size_t * olen,
|
||||
unsigned char * buf,
|
||||
size_t blen);
|
||||
|
||||
/**
|
||||
* \brief Set a group using well-known domain parameters
|
||||
*
|
||||
* \param grp Destination group
|
||||
* \param id Index in the list of well-known domain parameters
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_XXX if initialization failed
|
||||
* MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE for unkownn groups
|
||||
*
|
||||
* \note Index should be a value of RFC 4492's enum NamedCurve,
|
||||
* usually in the form of a MBEDTLS_ECP_DP_XXX macro.
|
||||
*/
|
||||
int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id);
|
||||
|
||||
/**
|
||||
* \brief Set a group from a TLS ECParameters record
|
||||
*
|
||||
* \param grp Destination group
|
||||
* \param buf &(Start of input buffer)
|
||||
* \param len Buffer length
|
||||
*
|
||||
* \note buf is updated to point right after ECParameters on exit
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_MPI_XXX if initialization failed
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid
|
||||
*/
|
||||
int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp, const unsigned char **buf, size_t len);
|
||||
|
||||
/**
|
||||
* \brief Write the TLS ECParameters record for a group
|
||||
*
|
||||
* \param grp ECP group used
|
||||
* \param olen Number of bytes actually written
|
||||
* \param buf Buffer to write to
|
||||
* \param blen Buffer length
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
|
||||
*/
|
||||
int mbedtls_ecp_tls_write_group(const mbedtls_ecp_group *grp, size_t *olen, unsigned char *buf, size_t blen);
|
||||
|
||||
/**
|
||||
* \brief Multiplication by an integer: R = m * P
|
||||
* (Not thread-safe to use same group in multiple threads)
|
||||
*
|
||||
* \note In order to prevent timing attacks, this function
|
||||
* executes the exact same sequence of (base field)
|
||||
* operations for any valid m. It avoids any if-branch or
|
||||
* array index depending on the value of m.
|
||||
*
|
||||
* \note If f_rng is not NULL, it is used to randomize intermediate
|
||||
* results in order to prevent potential timing attacks
|
||||
* targeting these results. It is recommended to always
|
||||
* provide a non-NULL f_rng (the overhead is negligible).
|
||||
*
|
||||
* \param grp ECP group
|
||||
* \param R Destination point
|
||||
* \param m Integer by which to multiply
|
||||
* \param P Point to multiply
|
||||
* \param f_rng RNG function (see notes)
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_ECP_INVALID_KEY if m is not a valid privkey
|
||||
* or P is not a valid pubkey,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
|
||||
*/
|
||||
int mbedtls_ecp_mul(mbedtls_ecp_group * grp,
|
||||
mbedtls_ecp_point * R,
|
||||
const mbedtls_mpi * m,
|
||||
const mbedtls_ecp_point *P,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Multiplication and addition of two points by integers:
|
||||
* R = m * P + n * Q
|
||||
* (Not thread-safe to use same group in multiple threads)
|
||||
*
|
||||
* \note In contrast to mbedtls_ecp_mul(), this function does not guarantee
|
||||
* a constant execution flow and timing.
|
||||
*
|
||||
* \param grp ECP group
|
||||
* \param R Destination point
|
||||
* \param m Integer by which to multiply P
|
||||
* \param P Point to multiply by m
|
||||
* \param n Integer by which to multiply Q
|
||||
* \param Q Point to be multiplied by n
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* MBEDTLS_ERR_ECP_INVALID_KEY if m or n is not a valid privkey
|
||||
* or P or Q is not a valid pubkey,
|
||||
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
|
||||
*/
|
||||
int mbedtls_ecp_muladd(mbedtls_ecp_group * grp,
|
||||
mbedtls_ecp_point * R,
|
||||
const mbedtls_mpi * m,
|
||||
const mbedtls_ecp_point *P,
|
||||
const mbedtls_mpi * n,
|
||||
const mbedtls_ecp_point *Q);
|
||||
|
||||
/**
|
||||
* \brief Check that a point is a valid public key on this curve
|
||||
*
|
||||
* \param grp Curve/group the point should belong to
|
||||
* \param pt Point to check
|
||||
*
|
||||
* \return 0 if point is a valid public key,
|
||||
* MBEDTLS_ERR_ECP_INVALID_KEY otherwise.
|
||||
*
|
||||
* \note This function only checks the point is non-zero, has valid
|
||||
* coordinates and lies on the curve, but not that it is
|
||||
* indeed a multiple of G. This is additional check is more
|
||||
* expensive, isn't required by standards, and shouldn't be
|
||||
* necessary if the group used has a small cofactor. In
|
||||
* particular, it is useless for the NIST groups which all
|
||||
* have a cofactor of 1.
|
||||
*
|
||||
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
|
||||
* in order to ease use with other structures such as
|
||||
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
|
||||
*/
|
||||
int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt);
|
||||
|
||||
/**
|
||||
* \brief Check that an mbedtls_mpi is a valid private key for this curve
|
||||
*
|
||||
* \param grp Group used
|
||||
* \param d Integer to check
|
||||
*
|
||||
* \return 0 if point is a valid private key,
|
||||
* MBEDTLS_ERR_ECP_INVALID_KEY otherwise.
|
||||
*
|
||||
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
|
||||
* in order to ease use with other structures such as
|
||||
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
|
||||
*/
|
||||
int mbedtls_ecp_check_privkey(const mbedtls_ecp_group *grp, const mbedtls_mpi *d);
|
||||
|
||||
/**
|
||||
* \brief Generate a keypair with configurable base point
|
||||
*
|
||||
* \param grp ECP group
|
||||
* \param G Chosen base point
|
||||
* \param d Destination MPI (secret part)
|
||||
* \param Q Destination point (public part)
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
|
||||
*
|
||||
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
|
||||
* in order to ease use with other structures such as
|
||||
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
|
||||
*/
|
||||
int mbedtls_ecp_gen_keypair_base(mbedtls_ecp_group * grp,
|
||||
const mbedtls_ecp_point *G,
|
||||
mbedtls_mpi * d,
|
||||
mbedtls_ecp_point * Q,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Generate a keypair
|
||||
*
|
||||
* \param grp ECP group
|
||||
* \param d Destination MPI (secret part)
|
||||
* \param Q Destination point (public part)
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
|
||||
*
|
||||
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
|
||||
* in order to ease use with other structures such as
|
||||
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
|
||||
*/
|
||||
int mbedtls_ecp_gen_keypair(mbedtls_ecp_group *grp,
|
||||
mbedtls_mpi * d,
|
||||
mbedtls_ecp_point *Q,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Generate a keypair
|
||||
*
|
||||
* \param grp_id ECP group identifier
|
||||
* \param key Destination keypair
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
|
||||
*/
|
||||
int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id,
|
||||
mbedtls_ecp_keypair *key,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Check a public-private key pair
|
||||
*
|
||||
* \param pub Keypair structure holding a public key
|
||||
* \param prv Keypair structure holding a private (plus public) key
|
||||
*
|
||||
* \return 0 if successful (keys are valid and match), or
|
||||
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA, or
|
||||
* a MBEDTLS_ERR_ECP_XXX or MBEDTLS_ERR_MPI_XXX code.
|
||||
*/
|
||||
int mbedtls_ecp_check_pub_priv(const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv);
|
||||
#endif // MBEDTLS_ECP_ALT // QORVO
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/**
|
||||
* \brief Checkup routine
|
||||
*
|
||||
* \return 0 if successful, or 1 if a test failed
|
||||
*/
|
||||
int mbedtls_ecp_self_test(int verbose);
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ecp_alt.h */
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 QGP6100_MBEDTLS_CONFIG_H
|
||||
#define QGP6100_MBEDTLS_CONFIG_H
|
||||
|
||||
#ifdef QORVO_CRYPTO_ENGINE
|
||||
|
||||
#undef MBEDTLS_ECP_WINDOW_SIZE
|
||||
#undef MBEDTLS_ECP_FIXED_POINT_OPTIM
|
||||
|
||||
#define MBEDTLS_AES_ALT
|
||||
#define MBEDTLS_CCM_ALT
|
||||
#define MBEDTLS_ECP_ALT
|
||||
#define MBEDTLS_ECJPAKE_ALT
|
||||
#define MBEDTLS_SHA256_ALT
|
||||
|
||||
#else
|
||||
|
||||
#define MBEDTLS_SLOW_CPU 1
|
||||
#define MBEDTLS_COMPUTATION_UNTILL_SEQ_NR 6
|
||||
|
||||
#endif // QORVO_CRYPTO_ENGINE
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif // QGP6100_MBEDTLS_CONFIG_H
|
||||
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* \file mbedtls_sha256.h
|
||||
*
|
||||
* \brief SHA-224 and SHA-256 cryptographic hash function
|
||||
*
|
||||
* Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#ifndef MBEDTLS_SHA256_ALT_H
|
||||
#define MBEDTLS_SHA256_ALT_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief SHA-256 context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t total[2]; /*!< number of bytes processed */
|
||||
uint32_t state[8]; /*!< intermediate digest state */
|
||||
unsigned char buffer[64]; /*!< data block being processed */
|
||||
int is224; /*!< 0 => SHA-256, else SHA-224 */
|
||||
} mbedtls_sha256_context;
|
||||
|
||||
/**
|
||||
* \brief This function initializes a SHA-256 context.
|
||||
*
|
||||
* \param ctx The SHA-256 context to initialize.
|
||||
*/
|
||||
void mbedtls_sha256_init(mbedtls_sha256_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief This function clears a SHA-256 context.
|
||||
*
|
||||
* \param ctx The SHA-256 context to clear.
|
||||
*/
|
||||
void mbedtls_sha256_free(mbedtls_sha256_context *ctx);
|
||||
|
||||
/**
|
||||
* \brief This function clones the state of a SHA-256 context.
|
||||
*
|
||||
* \param dst The destination context.
|
||||
* \param src The context to clone.
|
||||
*/
|
||||
void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src);
|
||||
|
||||
/**
|
||||
* \brief This function starts a SHA-224 or SHA-256 checksum
|
||||
* calculation.
|
||||
*
|
||||
* \param ctx The context to initialize.
|
||||
* \param is224 Determines which function to use.
|
||||
* <ul><li>0: Use SHA-256.</li>
|
||||
* <li>1: Use SHA-224.</li></ul>
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224);
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
* SHA-256 checksum calculation.
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen);
|
||||
|
||||
/**
|
||||
* \brief This function finishes the SHA-256 operation, and writes
|
||||
* the result to the output buffer.
|
||||
*
|
||||
* \param ctx The SHA-256 context.
|
||||
* \param output The SHA-224 or SHA-256 checksum result.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32]);
|
||||
|
||||
/**
|
||||
* \brief This function processes a single data block within
|
||||
* the ongoing SHA-256 computation. This function is for
|
||||
* internal use only.
|
||||
*
|
||||
* \param ctx The SHA-256 context.
|
||||
* \param data The buffer holding one block of data.
|
||||
*
|
||||
* \return \c 0 on success.
|
||||
*/
|
||||
int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64]);
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
/**
|
||||
* \brief This function starts a SHA-256 checksum calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context to initialize.
|
||||
* \param is224 Determines which function to use.
|
||||
* <ul><li>0: Use SHA-256.</li>
|
||||
* <li>1: Use SHA-224.</li></ul>
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
|
||||
{
|
||||
mbedtls_sha256_starts_ret(ctx, is224);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function feeds an input buffer into an ongoing
|
||||
* SHA-256 checksum calculation.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context to initialize.
|
||||
* \param input The buffer holding the data.
|
||||
* \param ilen The length of the input data.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_update(mbedtls_sha256_context *ctx,
|
||||
const unsigned char * input,
|
||||
size_t ilen)
|
||||
{
|
||||
mbedtls_sha256_update_ret(ctx, input, ilen);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function finishes the SHA-256 operation, and writes
|
||||
* the result to the output buffer.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context.
|
||||
* \param output The SHA-224or SHA-256 checksum result.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32])
|
||||
{
|
||||
mbedtls_sha256_finish_ret(ctx, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function processes a single data block within
|
||||
* the ongoing SHA-256 computation. This function is for
|
||||
* internal use only.
|
||||
*
|
||||
* \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0.
|
||||
*
|
||||
* \param ctx The SHA-256 context.
|
||||
* \param data The buffer holding one block of data.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
|
||||
{
|
||||
mbedtls_internal_sha256_process(ctx, data);
|
||||
}
|
||||
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/diag.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/entropy.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/logging.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/misc.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/misc_qorvo.h
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||
#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
|
||||
#endif
|
||||
|
||||
#endif /* OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_ */
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 qpg6100 compile-time configuration constants for OpenThread.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_QPG6100_CONFIG_H_
|
||||
#define OPENTHREAD_CORE_QPG6100_CONFIG_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE
|
||||
*
|
||||
* Define to 1 if you want use legacy transmit done.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE 1
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6100"
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_UART_ENABLE
|
||||
*
|
||||
* Define to 1 to enable NCP UART support.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1
|
||||
|
||||
#endif // OPENTHREAD_CORE_QPG6100_CONFIG_H_
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/platform.c
|
||||
@@ -0,0 +1 @@
|
||||
../qpg6095/platform_qorvo.h
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* (c) 2019-2020, Qorvo
|
||||
*/
|
||||
|
||||
/* Memory Spaces Definitions */
|
||||
MEMORY
|
||||
{
|
||||
/* Last 32 bytes of UCRAM in use by ROM bootloader stack. */
|
||||
RAM (rxw) : ORIGIN = 0x20008000, LENGTH = 0x17fe0
|
||||
FLASH (rx) : ORIGIN = 0x4000000, LENGTH = 0x80000
|
||||
ROM (rx) : ORIGIN = 0x04800000, LENGTH = 0x8000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
eFLASH = 0x4080000;
|
||||
|
||||
sSYSRAM = 0x20008000;
|
||||
eSYSRAM = 0x20010000;
|
||||
sUCRAM = 0x20010000;
|
||||
eUCRAM = 0x20020000;
|
||||
|
||||
/* Linkerscript only for contiguous SYS and UCRAM */
|
||||
ASSERT(eSYSRAM == sUCRAM, "Non contiguous SYS and UCRAM")
|
||||
|
||||
/*
|
||||
* User license is first - only for FLASH programs.
|
||||
*
|
||||
* BLE/MAC address entries (+0x10) in the user license skipped to
|
||||
* allow injection of custom values by programmer tool.
|
||||
*/
|
||||
.native_user_license 0x4000000 + 0x10 : {
|
||||
sUserLicense = .;
|
||||
KEEP(*(.native_user_license))
|
||||
eUserLicense = .;
|
||||
} > FLASH
|
||||
ASSERT(sUserLicense < eUserLicense, "No User License")
|
||||
|
||||
/* Reserve space for RT system in FLASH */
|
||||
rt_system_start_offset = 0x400;
|
||||
rt_system_start_address = ORIGIN(FLASH) + rt_system_start_offset;
|
||||
.rt_flash rt_system_start_address : {. = ALIGN(4); *(.rt_flash); } > FLASH
|
||||
ASSERT((rt_system_start_offset % 0x80 == 0), "RT system start should be aligned on 128 bytes")
|
||||
ASSERT((rt_system_start_address / 0x20000 == . / 0x20000 ), "RT system shall not cross 128kb boundary")
|
||||
.isr_vector : ALIGN(0x100) { KEEP(*(.isr_vector)); } > FLASH
|
||||
.text : { . = ALIGN(4); *(.text) *(.text.*); } > FLASH
|
||||
.rodata : { . = ALIGN(4); *(.rodata) *(.rodata.*);} > FLASH
|
||||
.rom : { . = ALIGN(4); *(.rom) *(.rom.*); } > ROM
|
||||
|
||||
|
||||
/* Start of memory to be retained in sleep */
|
||||
_sretain = 0x20008000;
|
||||
|
||||
/* Fixed sections */
|
||||
.mw_crc 0x20008000 : { . += 0x4; } > RAM
|
||||
.crc 0x20008004 : { . += 0x4; } > RAM
|
||||
.ret_hw 0x20008008 : { . += 0x1B4; } > RAM
|
||||
.ret_sw 0x200081BC : { . += 0x7B; } > RAM
|
||||
ASSERT(. >= 0x200081c0, "gpmicro areas must fall into retention areas")
|
||||
/* 0x20008370-0x2000837F : unused space */
|
||||
/* PUF RAM Area */
|
||||
.pkey 0x20008380 : { . += 0x80; } > RAM
|
||||
.pufr 0x20008400 : { . += 0x400; } > RAM
|
||||
|
||||
/* Windowed sections */
|
||||
/* ram_regmap, events, pbm options and pbm data are taken from buffers in .lower_ram_retain */
|
||||
|
||||
.lower_ram_retain_gpmicro_accessible (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain_gpmicro_accessible) *(.lower_ram_retain_gpmicro_accessible.*); } > RAM
|
||||
ASSERT (. < 0x20008000+0x4000, ".lower_ram_retain_gpmicro_accessible area outside range")
|
||||
.lower_ram_retain (NOLOAD) : { . = ALIGN(4); *(.lower_ram_retain) *(.lower_ram_retain.*); } > RAM
|
||||
|
||||
_elower_ram = . ;
|
||||
|
||||
/* Check regions are allocated in lower ram */
|
||||
ASSERT(_elower_ram < eSYSRAM, "SYSRAM ram full")
|
||||
|
||||
.data : { . = ALIGN(4); *(.data) *(.data.*); } > RAM AT > FLASH
|
||||
.bss : { . = ALIGN(4); *(.bss) *(.bss.*) *(COMMON); } > RAM
|
||||
|
||||
/* End of memory to be retained */
|
||||
_eretain = . ;
|
||||
|
||||
/* Scroll up to higher ram area for scratchpad variables */
|
||||
.higher_ram_noretain (NOLOAD) : {
|
||||
. = (_eretain > sUCRAM) ? ALIGN(4) : (sUCRAM - _eretain);
|
||||
_shigher_ram_noretain = . ;
|
||||
*(.higher_ram_noretain) *(.higher_ram_noretain.*);
|
||||
_ehigher_ram_noretain = . ;
|
||||
} > RAM
|
||||
/* Check if properly allocated in UCRAM only if any variables required specific allocation. */
|
||||
ASSERT((_ehigher_ram_noretain - _shigher_ram_noretain) > 0 ? (_shigher_ram_noretain >= sUCRAM) : 1, "higher_ram_noretain not in higher ram")
|
||||
|
||||
_eram = .;
|
||||
|
||||
/* Remove the debugging information from the standard libraries */
|
||||
/DISCARD/ : {
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.gpNvm eFLASH - 0x4000:
|
||||
{
|
||||
gpNvm_Start = . ;
|
||||
. = 0x4000 ;
|
||||
gpNvm_End = . ;
|
||||
} > FLASH
|
||||
|
||||
/* Linker Symbols */
|
||||
_native_user_license_vpp = ADDR(.isr_vector) >> 8;
|
||||
_loaded_user_license_vpp = ADDR(.isr_vector) >> 8;
|
||||
_etext = ADDR(.text) + SIZEOF(.text);
|
||||
_sidata = LOADADDR(.data);
|
||||
_sdata = ADDR(.data);
|
||||
_edata = ADDR(.data) + ALIGN(SIZEOF(.data), 4);
|
||||
_ldata = _edata - _sdata;
|
||||
_sbss = ADDR(.bss);
|
||||
_ebss = ADDR(.bss) + ALIGN(SIZEOF(.bss), 4);
|
||||
_lbss = _ebss - _sbss;
|
||||
|
||||
/* using remaining RAM for stack */
|
||||
_sstack = _eram;
|
||||
_estack = ORIGIN(RAM) + LENGTH(RAM) - SIZEOF(.higher_ram_noretain);
|
||||
|
||||
/* check minimum stack size is still available */
|
||||
min_stack_size = 0x800;
|
||||
stack_size = _estack - _sstack;
|
||||
ASSERT(stack_size >= min_stack_size, "STACK too small")
|
||||
|
||||
/* needed for ram retention configuration */
|
||||
__lowerram_retain_size = _eretain < eSYSRAM ? _eretain - _sretain : eSYSRAM - _sretain;
|
||||
__higherram_retain_size = _eretain < eSYSRAM ? 0 : _eretain - eSYSRAM;
|
||||
|
||||
sw_retention_begin = ADDR(.ret_sw);
|
||||
sw_retention_end = ADDR(.ret_sw) + SIZEOF(.ret_sw);
|
||||
sw_retention_size = SIZEOF(.ret_sw);
|
||||
}
|
||||
|
||||
ENTRY(reset_handler)
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/radio.c
|
||||
@@ -0,0 +1 @@
|
||||
../qpg6095/radio_qorvo.h
|
||||
@@ -0,0 +1 @@
|
||||
../qpg6095/random_qorvo.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/settings.cpp
|
||||
@@ -0,0 +1 @@
|
||||
../qpg6095/settings_qorvo.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/uart.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../qpg6095/uart_qorvo.h
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
# Do not enable -Wcast-align for this platform
|
||||
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
|
||||
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
|
||||
|
||||
lib_LIBRARIES = libopenthread-qpg7015m.a
|
||||
|
||||
libopenthread_qpg7015m_a_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src/core \
|
||||
-I$(top_srcdir)/examples/platforms \
|
||||
-I$(top_srcdir)/examples/platforms/qpg7015m \
|
||||
-lrt \
|
||||
-lpthread \
|
||||
$(NULL)
|
||||
|
||||
PLATFORM_SOURCES = \
|
||||
alarm.c \
|
||||
alarm_qorvo.h \
|
||||
diag.c \
|
||||
entropy.c \
|
||||
flash.c \
|
||||
logging.c \
|
||||
misc.c \
|
||||
openthread-core-qpg7015m-config.h \
|
||||
openthread-core-qpg7015m-config-check.h \
|
||||
platform_qorvo.h \
|
||||
radio.c \
|
||||
radio_qorvo.h \
|
||||
random_qorvo.h \
|
||||
system.c \
|
||||
uart-posix.c \
|
||||
uart_qorvo.h \
|
||||
$(NULL)
|
||||
|
||||
libopenthread_qpg7015m_a_SOURCES = \
|
||||
$(PLATFORM_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
if OPENTHREAD_BUILD_COVERAGE
|
||||
CLEANFILES = $(wildcard *.gcda *.gcno)
|
||||
endif # OPENTHREAD_BUILD_COVERAGE
|
||||
|
||||
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
# qpg7015m platform-specific Makefile
|
||||
#
|
||||
|
||||
LDADD_COMMON += \
|
||||
$(top_builddir)/examples/platforms/qpg7015m/libopenthread-qpg7015m.a \
|
||||
$(NULL)
|
||||
if OPENTHREAD_ENABLE_FTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/libQorvoQPG7015M_ftd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_FTD
|
||||
if OPENTHREAD_ENABLE_MTD
|
||||
LDADD_COMMON += \
|
||||
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/libQorvoQPG7015M_mtd.a \
|
||||
$(NULL)
|
||||
endif # OPENTHREAD_ENABLE_MTD
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/alarm.c
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/alarm_qorvo.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/diag.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/entropy.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/flash.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/logging.c
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/misc.c
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_
|
||||
#define OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_
|
||||
|
||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
|
||||
#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
|
||||
#endif
|
||||
|
||||
#endif /* OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_ */
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 qpg7015m compile-time configuration constants for OpenThread.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_CORE_QPG7015M_CONFIG_H_
|
||||
#define OPENTHREAD_CORE_QPG7015M_CONFIG_H_
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* The platform-specific string to insert into the OpenThread version string.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG7015M"
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
*
|
||||
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
|
||||
*
|
||||
* When defined to 1, the platform MUST implement the otPlatFlash* APIs
|
||||
* instead of the otPlatSettings*
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
|
||||
|
||||
#endif // OPENTHREAD_CORE_QPG7015M_CONFIG_H_
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/platform_qorvo.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/radio.c
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/radio_qorvo.h
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/random_qorvo.h
|
||||
+1
@@ -0,0 +1 @@
|
||||
../gp712/system.c
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/uart-posix.c
|
||||
@@ -0,0 +1 @@
|
||||
../gp712/uart_qorvo.h
|
||||
Vendored
+53
-4
@@ -26,9 +26,58 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
add_library(gp712-driver INTERFACE)
|
||||
|
||||
if (OT_MTD)
|
||||
target_link_libraries(gp712-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/gp712/libQorvoGP712_mtd.a
|
||||
)
|
||||
else()
|
||||
target_link_libraries(gp712-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/gp712/libQorvoGP712_ftd.a
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(qpg6095-driver INTERFACE)
|
||||
|
||||
target_link_libraries(qpg6095-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qpg6095/libQorvoQPG6095.a
|
||||
)
|
||||
if (OT_MTD)
|
||||
target_link_libraries(qpg6095-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg6095/libQorvoQPG6095_mtd.a
|
||||
)
|
||||
else()
|
||||
target_link_libraries(qpg6095-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg6095/libQorvoQPG6095_ftd.a
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(qpg6100-driver INTERFACE)
|
||||
|
||||
if (OT_MTD)
|
||||
target_link_libraries(qpg6100-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg6100/libQorvoQPG6100_mtd.a
|
||||
)
|
||||
else()
|
||||
target_link_libraries(qpg6100-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg6100/libQorvoQPG6100_ftd.a
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(qpg7015m-driver INTERFACE)
|
||||
|
||||
if (OT_MTD)
|
||||
target_link_libraries(qpg7015m-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg7015m/libQorvoQPG7015m_mtd.a
|
||||
)
|
||||
else()
|
||||
target_link_libraries(qpg7015m-driver
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/repo/qpg7015m/libQorvoQPG7015m_ftd.a
|
||||
)
|
||||
endif()
|
||||
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
|
||||
Copyright (c) 2012-2016, GreenPeak Technologies
|
||||
Copyright (c) 2017-2019, Qorvo Inc
|
||||
|
||||
This software is owned by Qorvo Inc
|
||||
and protected under applicable copyright laws.
|
||||
It is delivered under the terms of the license
|
||||
and is intended and supplied for use solely and
|
||||
exclusively with products manufactured by
|
||||
Qorvo Inc.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED IN AN "AS IS"
|
||||
CONDITION. NO WARRANTIES, WHETHER EXPRESS,
|
||||
IMPLIED OR STATUTORY, INCLUDING, BUT NOT
|
||||
LIMITED TO, IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
||||
QORVO INC. SHALL NOT, IN ANY
|
||||
CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
||||
FOR ANY REASON WHATSOEVER.
|
||||
Vendored
-15
@@ -1,15 +0,0 @@
|
||||
# Qorvo
|
||||
|
||||
## Version
|
||||
|
||||
0.8.0.0
|
||||
|
||||
## License File
|
||||
|
||||
[LICENSE](LICENSE.txt)
|
||||
|
||||
## Description
|
||||
|
||||
The gp712 folder contains library with the glue code to interface with the kernel drivers for linux based platforms containing the GP712.
|
||||
|
||||
The qpg6095 folder contains library with the hal code for the QPG6095.
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
Submodule third_party/Qorvo/repo added at afc3e73ddd
Reference in New Issue
Block a user