Skip to content

Commit fb5af09

Browse files
committed
Initial commit.
0 parents  commit fb5af09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+13387
-0
lines changed

.clang-format

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: InlineOnly
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: true
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: false
30+
AfterObjCDeclaration: false
31+
AfterStruct: true
32+
AfterUnion: true
33+
BeforeCatch: false
34+
BeforeElse: true
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Custom
41+
BreakBeforeInheritanceComma: false
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializersBeforeComma: false
44+
BreakConstructorInitializers: BeforeComma
45+
BreakAfterJavaFieldAnnotations: false
46+
BreakStringLiterals: true
47+
ColumnLimit: 120
48+
CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
51+
ConstructorInitializerIndentWidth: 4
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: true
54+
DerivePointerAlignment: false
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: true
58+
ForEachMacros:
59+
- foreach
60+
- Q_FOREACH
61+
- BOOST_FOREACH
62+
IncludeCategories:
63+
- Regex: '^<openthread/.*/'
64+
Priority: 4
65+
- Regex: '^<openthread/'
66+
Priority: 3
67+
- Regex: '^<'
68+
Priority: 2
69+
- Regex: '^".*/'
70+
Priority: 5
71+
- Regex: '^"'
72+
Priority: 1
73+
IncludeIsMainRegex: '(Test)?$'
74+
IndentCaseLabels: false
75+
IndentWidth: 4
76+
IndentWrappedFunctionNames: false
77+
JavaScriptQuotes: Leave
78+
JavaScriptWrapImports: true
79+
KeepEmptyLinesAtTheStartOfBlocks: false
80+
MacroBlockBegin: ''
81+
MacroBlockEnd: ''
82+
MaxEmptyLinesToKeep: 1
83+
NamespaceIndentation: None
84+
ObjCBlockIndentWidth: 2
85+
ObjCSpaceAfterProperty: false
86+
ObjCSpaceBeforeProtocolList: true
87+
PenaltyBreakAssignment: 2
88+
PenaltyBreakBeforeFirstCallParameter: 19
89+
PenaltyBreakComment: 300
90+
PenaltyBreakFirstLessLess: 120
91+
PenaltyBreakString: 1000
92+
PenaltyExcessCharacter: 1000000
93+
PenaltyReturnTypeOnItsOwnLine: 1000
94+
PointerAlignment: Right
95+
ReflowComments: true
96+
SortIncludes: true
97+
SortUsingDeclarations: true
98+
SpaceAfterCStyleCast: false
99+
SpaceAfterTemplateKeyword: true
100+
SpaceBeforeAssignmentOperators: true
101+
SpaceBeforeParens: ControlStatements
102+
SpaceInEmptyParentheses: false
103+
SpacesBeforeTrailingComments: 1
104+
SpacesInAngles: false
105+
SpacesInContainerLiterals: true
106+
SpacesInCStyleCastParentheses: false
107+
SpacesInParentheses: false
108+
SpacesInSquareBrackets: false
109+
Standard: Cpp11
110+
TabWidth: 4
111+
UseTab: Never
112+
...
113+

.github/dependabot.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Copyright (c) 2021, The OpenThread Authors.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# 1. Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# 2. Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in the
11+
# documentation and/or other materials provided with the distribution.
12+
# 3. Neither the name of the copyright holder nor the
13+
# names of its contributors may be used to endorse or promote products
14+
# derived from this software without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
# POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
29+
version: 2
30+
updates:
31+
- package-ecosystem: "gitsubmodule"
32+
directory: "/"
33+
schedule:
34+
interval: "daily"
35+
allow:
36+
- dependency-name: "openthread"
37+
commit-message:
38+
prefix: "submodule"
39+
rebase-strategy: "disabled"
40+
open-pull-requests-limit: 1

.github/workflows/build.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#
2+
# Copyright (c) 2020, The OpenThread Authors.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# 1. Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# 2. Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in the
11+
# documentation and/or other materials provided with the distribution.
12+
# 3. Neither the name of the copyright holder nor the
13+
# names of its contributors may be used to endorse or promote products
14+
# derived from this software without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
# POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
29+
name: Build
30+
31+
on:
32+
push:
33+
branches-ignore:
34+
- 'dependabot/**'
35+
pull_request:
36+
branches:
37+
- 'main'
38+
39+
jobs:
40+
41+
cancel-previous-runs:
42+
runs-on: ubuntu-20.04
43+
steps:
44+
- uses: rokroskar/workflow-run-cleanup-action@master
45+
env:
46+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
47+
if: "github.ref != 'refs/heads/main'"
48+
49+
pretty:
50+
runs-on: ubuntu-20.04
51+
steps:
52+
- uses: actions/checkout@v2
53+
with:
54+
submodules: true
55+
- name: Bootstrap
56+
run: |
57+
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
58+
sudo apt-get --no-install-recommends install -y clang-format-9 shellcheck
59+
python3 -m pip install yapf==0.29.0
60+
sudo snap install shfmt
61+
- name: Check
62+
run: |
63+
script/make-pretty check
64+
arm-gcc:
65+
name: arm-gcc-${{ matrix.gcc_ver }}
66+
runs-on: ubuntu-18.04
67+
strategy:
68+
matrix:
69+
include:
70+
- gcc_ver: 4
71+
gcc_download_url: https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
72+
gcc_extract_dir: gcc-arm-none-eabi-4_9-2015q3
73+
- gcc_ver: 5
74+
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
75+
gcc_extract_dir: gcc-arm-none-eabi-5_4-2016q3
76+
- gcc_ver: 6
77+
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
78+
gcc_extract_dir: gcc-arm-none-eabi-6-2017-q2-update
79+
- gcc_ver: 7
80+
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
81+
gcc_extract_dir: gcc-arm-none-eabi-7-2018-q2-update
82+
- gcc_ver: 9
83+
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
84+
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
85+
steps:
86+
- uses: actions/checkout@v2
87+
with:
88+
submodules: true
89+
- name: Bootstrap
90+
run: |
91+
cd /tmp
92+
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
93+
sudo apt-get --no-install-recommends install -y lib32z1 ninja-build python3-setuptools
94+
wget ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
95+
tar xjf gcc-arm.tar.bz2
96+
# use the minimal required cmake version
97+
sudo pip3 install --system -U cmake==3.10.3
98+
sudo pip3 install pycrypto
99+
sudo pip3 install pycryptodome
100+
cmake --version | grep 3.10.3
101+
mkdir -p sdk_k32w061
102+
cd sdk_k32w061
103+
wget https://mcuxpresso.nxp.com/eclipse/sdk/2.6.3/plugins/com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.3.201911251446.jar
104+
unzip com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.3.201911251446.jar
105+
rm -rf com.nxp.mcuxpresso.sdk.sdk_2.x_k32w061dk6_2.6.3.201911251446.jar
106+
cd sdks
107+
unzip 5faab205f2663647c5c7ce05c382d2a8.zip
108+
rm -rf 5faab205f2663647c5c7ce05c382d2a8.zip
109+
cd /tmp
110+
mkdir -p sdk_jn5189
111+
cd sdk_jn5189
112+
wget https://mcuxpresso.nxp.com/eclipse/sdk/2.6.3/plugins/com.nxp.mcuxpresso.sdk.sdk_2.x_jn5189dk6_2.6.3.201911251446.jar
113+
unzip com.nxp.mcuxpresso.sdk.sdk_2.x_jn5189dk6_2.6.3.201911251446.jar
114+
rm -rf com.nxp.mcuxpresso.sdk.sdk_2.x_jn5189dk6_2.6.3.201911251446.jar
115+
cd sdks
116+
unzip 3527851720d25fc0a442c508518c1214.zip
117+
rm -rf 3527851720d25fc0a442c508518c1214.zip
118+
119+
- name: Build
120+
run: |
121+
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
122+
export NXP_K32W061_SDK_ROOT=/tmp/sdk_k32w061/sdks/
123+
export NXP_JN5189_SDK_ROOT=/tmp/sdk_jn5189/sdks/
124+
chmod +x $NXP_K32W061_SDK_ROOT/tools/imagetool/sign_images.sh
125+
chmod +x $NXP_JN5189_SDK_ROOT/tools/imagetool/sign_images.sh
126+
third_party/k32w061_sdk/mr3_fixes/patch_k32w061_mr3_sdk.sh
127+
third_party/jn5189_sdk/mr3_fixes/patch_jn5189_mr3_sdk.sh
128+
script/test

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "openthread"]
2+
path = openthread
3+
url = https://github.com/openthread/openthread.git

CMakeLists.txt

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#
2+
# Copyright (c) 2021, The OpenThread Authors.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# 1. Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# 2. Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in the
11+
# documentation and/or other materials provided with the distribution.
12+
# 3. Neither the name of the copyright holder nor the
13+
# names of its contributors may be used to endorse or promote products
14+
# derived from this software without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
# POSSIBILITY OF SUCH DAMAGE.
27+
#
28+
29+
cmake_minimum_required(VERSION 3.10.2)
30+
project(ot-nxp VERSION 0.2.0)
31+
32+
if (OT_BUILD_RT)
33+
if (OT_BUILD_RT1060)
34+
set(PLAT_LIB "openthread-rt1060")
35+
set(CONFIG_FILE "\"openthread-core-rt1060-config.h\"")
36+
set(CORE_CONFIG_FILE "\"openthread-core-rt1060-config.h\"")
37+
set(CORE_CONFIG_CHECK "\"openthread-core-rt1060-config-check.h\"")
38+
set(PLATFORM rt1060)
39+
set(CHIP imx_rt)
40+
endif()
41+
elseif (OT_BUILD_K32W)
42+
if (OT_BUILD_K32W061)
43+
set(PLAT_LIB "openthread-k32w061")
44+
set(CONFIG_FILE "\"openthread-core-k32w061-config.h\"")
45+
set(CORE_CONFIG_FILE "\"openthread-core-k32w061-config.h\"")
46+
set(CORE_CONFIG_CHECK "\"openthread-core-k32w061-config-check.h\"")
47+
set(PLATFORM k32w061)
48+
set(CHIP k32w)
49+
elseif (OT_BUILD_JN5189)
50+
set(PLAT_LIB "openthread-jn5189")
51+
set(CONFIG_FILE "\"openthread-core-jn5189-config.h\"")
52+
set(CORE_CONFIG_FILE "\"openthread-core-jn5189-config.h\"")
53+
set(CORE_CONFIG_CHECK "\"openthread-core-jn5189-config-check.h\"")
54+
set(PLATFORM jn5189)
55+
set(CHIP k32w)
56+
endif()
57+
endif()
58+
59+
set(OT_PLATFORM_LIB ${PLAT_LIB})
60+
61+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
62+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
63+
set(RUNTIME_OUTPUT_CMAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
64+
65+
add_subdirectory(openthread)
66+
67+
target_compile_definitions(ot-config INTERFACE
68+
OPENTHREAD_CONFIG_FILE=${CONFIG_FILE}
69+
OPENTHREAD_PROJECT_CORE_CONFIG_FILE=${CORE_CONFIG_FILE}
70+
OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=${CORE_CONFIG_CHECK}
71+
OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1
72+
)
73+
74+
target_include_directories(ot-config INTERFACE
75+
${PROJECT_SOURCE_DIR}/src/${CHIP}/${PLATFORM}
76+
)
77+
78+
add_subdirectory(src)
79+
add_subdirectory(third_party)
80+
81+
if (OT_BUILD_RT)
82+
if (OT_BUILD_RT1060)
83+
add_executable(ot-cli
84+
${PROJECT_SOURCE_DIR}/examples/cli/main.c
85+
)
86+
87+
target_include_directories(ot-cli PRIVATE ${COMMON_INCLUDES})
88+
89+
target_link_libraries(ot-cli PRIVATE
90+
openthread-cli-ftd
91+
${OT_PLATFORM_LIB}
92+
openthread-ftd
93+
${OT_PLATFORM_LIB}
94+
${OT_MBEDTLS}
95+
ot-config
96+
-Wl,--start-group mbedcrypto openthread-${PLATFORM} -Wl,--end-group
97+
)
98+
99+
install(TARGETS ot-cli
100+
DESTINATION bin)
101+
endif()
102+
endif()

0 commit comments

Comments
 (0)