Skip to content

Commit 3666138

Browse files
BL602 pull request (#16370)
* BL602 pull request * [BL602] delete README.pdf, restyled README.md, add items for include config check * [BL602] Rebase code to fix compile errors * BL602 pull request * [BL602] delete README.pdf, restyled README.md, add items for include config check * [BL602] Update compile cmds * [BL602] Fix compile error, and update submodule * [BL602] Update compile errors * [BL602] Update lwip build, add bouffalolab to world list * [BL602] Update test action * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by autopep8 * [BL602] Update action data * [BL602] Update lwipconfig, and fix action errors * Restyled by clang-format * [BL602] Fix check error Co-authored-by: Restyled.io <commits@restyled.io>
1 parent a208c3d commit 3666138

File tree

117 files changed

+12865
-4
lines changed

Some content is hidden

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

117 files changed

+12865
-4
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1451,3 +1451,4 @@ localedef
14511451
nameserver
14521452
nmcli
14531453
tsan
1454+
bouffalolab

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,7 @@
203203
[submodule "third_party/efr32_sdk/wiseconnect-wifi-bt-sdk"]
204204
path = third_party/efr32_sdk/wiseconnect-wifi-bt-sdk
205205
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk
206+
[submodule "third_party/bouffalolab/bl602"]
207+
path = third_party/bouffalolab/bl602_sdk/repo
208+
url = https://github.com/bouffalolab/bl_iot_sdk_matter.git
209+
branch = bl602_release

BUILD.gn

+6
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
192192

193193
# Set this to true to enable k32w builds by default.
194194
enable_k32w_builds = false
195+
196+
# Set this to true to enable bl602 builds by default.
197+
enable_bl602_builds = false
195198
}
196199

197200
declare_args() {
@@ -274,6 +277,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
274277
# Build the k32w shell app example.
275278
enable_k32w_shell_app_build = enable_k32w_builds
276279

280+
# Build the bl602 lighting app example.
281+
enable_bl602_lighting_app_build = enable_bl602_builds
282+
277283
enable_fake_tests = enable_default_builds && host_os == "linux"
278284
}
279285

build/config/BUILDCONFIG.gn

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ if (_chip_defaults.custom_toolchain != "") {
7474
} else if (target_os == "freertos") {
7575
if (target_cpu == "arm") {
7676
_default_toolchain = "${_build_overrides.build_root}/toolchain/arm_gcc"
77+
} else if (target_cpu == "riscv") {
78+
_default_toolchain = "${_build_overrides.build_root}/toolchain/riscv_gcc"
7779
} else {
7880
assert(false, "Unsupported target_cpu: ${target_cpu}")
7981
}

build/config/compiler/BUILD.gn

+22
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if (current_cpu == "arm" || current_cpu == "arm64") {
4242
import("${build_root}/config/arm.gni")
4343
} else if (current_cpu == "x86" || current_cpu == "x86_64") {
4444
import("${build_root}/config/x86.gni")
45+
} else if (current_cpu == "riscv") {
46+
import("${build_root}/config/riscv.gni")
4547
}
4648

4749
config("release") {
@@ -122,6 +124,26 @@ config("abi_default") {
122124
]
123125
}
124126
}
127+
if (current_cpu == "riscv") {
128+
if (riscv_arch != "") {
129+
cflags += [ "-march=${riscv_arch}" ]
130+
}
131+
if (riscv_cpu != "") {
132+
cflags += [ "-mcpu=${riscv_cpu}" ]
133+
}
134+
if (riscv_tune != "") {
135+
cflags += [ "-mtune=${riscv_tune}" ]
136+
}
137+
if (riscv_abi != "") {
138+
cflags += [ "-mabi=${riscv_abi}" ]
139+
}
140+
if (riscv_fpu != "") {
141+
cflags += [ "-mfpu=${riscv_fpu}" ]
142+
}
143+
if (riscv_float_abi != "") {
144+
cflags += [ "-mfloat-abi=${riscv_float_abi}" ]
145+
}
146+
}
125147
}
126148

127149
asmflags = cflags

build/config/riscv.gni

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
if (current_cpu == "riscv") {
18+
declare_args() {
19+
# Build file to import for RISCV defaults.
20+
riscv_platform_config = ""
21+
}
22+
23+
# Allow platforms to override how RISCV architecture flags are chosen by
24+
# providing a file to import.
25+
if (riscv_platform_config != "") {
26+
_platform_defaults = {
27+
import(riscv_platform_config)
28+
}
29+
}
30+
31+
_defaults = {
32+
riscv_arch = ""
33+
riscv_cpu = ""
34+
riscv_tune = ""
35+
riscv_fpu = ""
36+
riscv_float_abi = ""
37+
riscv_abi = ""
38+
39+
# Update defaults with platform values, if any.
40+
if (riscv_platform_config != "") {
41+
forward_variables_from(_platform_defaults, "*")
42+
}
43+
}
44+
45+
declare_args() {
46+
# RISCV architecture (value for -march flag).
47+
riscv_arch = _defaults.riscv_arch
48+
49+
# RISCV CPU (value for -mcpu flag).
50+
riscv_cpu = _defaults.riscv_cpu
51+
52+
# RISCV tuning (value for -mtune flag).
53+
riscv_tune = _defaults.riscv_tune
54+
55+
# RISCV FPU (value for -mfpu flag).
56+
riscv_fpu = _defaults.riscv_fpu
57+
58+
# RISCV float ABI (value for -mfloat-abi flag).
59+
riscv_float_abi = _defaults.riscv_float_abi
60+
61+
# RISCV ABI (value for -mabi flag).
62+
riscv_abi = _defaults.riscv_abi
63+
}
64+
}

build/toolchain/riscv_gcc/BUILD.gn

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2021 The Pigweed Authors
2+
# Copyright (c) 2021 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import("riscv_toolchain.gni")
17+
18+
riscv_toolchain("riscv_gcc") {
19+
toolchain_args = {
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/bl602_sdk.gni")
16+
import("//build_overrides/build.gni")
17+
18+
import("${build_root}/toolchain/gcc_toolchain.gni")
19+
20+
template("riscv_toolchain") {
21+
gcc_toolchain(target_name) {
22+
_tool_name_root = "${root_build_dir}/../../third_party/bouffalolab/bl602_sdk/repo/toolchain/riscv/Linux/bin/riscv64-unknown-elf-"
23+
ar = _tool_name_root + "ar"
24+
cc = _tool_name_root + "gcc"
25+
cxx = _tool_name_root + "g++"
26+
27+
toolchain_args = {
28+
current_cpu = "riscv"
29+
current_os = invoker.current_os
30+
is_clang = false
31+
32+
forward_variables_from(invoker.toolchain_args, "*")
33+
}
34+
}
35+
}

build_overrides/bl602_sdk.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for bl602 SDK build files.
17+
bl602_sdk_build_root = "//third_party/bouffalolab/bl602_sdk"
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("//build_overrides/pigweed.gni")
17+
import("$dir_pw_build/target_types.gni")
18+
19+
static_library("pw_rpc") {
20+
output_name = "libPwRpc"
21+
22+
public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ]
23+
24+
public_deps = [
25+
"$dir_pw_rpc:server",
26+
"$dir_pw_rpc/nanopb:echo_service",
27+
"${chip_root}/examples/platform/bl602/pw_sys_io:pw_sys_io_bl602",
28+
"${dir_pigweed}/pw_hdlc:pw_rpc",
29+
dir_pw_assert,
30+
dir_pw_checksum,
31+
dir_pw_hdlc,
32+
dir_pw_log,
33+
]
34+
35+
output_dir = "${root_out_dir}/lib"
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("//build_overrides/pigweed.gni")
17+
18+
pw_log_BACKEND = "$dir_pw_log_basic"
19+
pw_assert_BACKEND = "$dir_pw_assert_log"
20+
pw_sys_io_BACKEND =
21+
"${chip_root}/examples/platform/bl602/pw_sys_io:pw_sys_io_bl602"
22+
23+
pw_build_LINK_DEPS = [
24+
"$dir_pw_assert:impl",
25+
"$dir_pw_log:impl",
26+
]
27+
28+
dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
import("${build_root}/toolchain/riscv_gcc/riscv_toolchain.gni")
19+
20+
riscv_toolchain("bl602_lock_app") {
21+
toolchain_args = {
22+
current_os = "freertos"
23+
import("${chip_root}/examples/lock-app/bl602/args.gni")
24+
}
25+
}
26+
27+
riscv_toolchain("bl602_lighting_app") {
28+
toolchain_args = {
29+
current_os = "freertos"
30+
import("${chip_root}/examples/lighting-app/bl602/args.gni")
31+
}
32+
}
33+
34+
riscv_toolchain("bl602_window_app") {
35+
toolchain_args = {
36+
current_os = "freertos"
37+
import("${chip_root}/examples/window-app/bl602/args.gni")
38+
}
39+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for bl602 SDK.
17+
bl602_sdk_build_root =
18+
"//third_party/connectedhomeip/third_party/bouffalolab/bl602_sdk"
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "riscv"
25+
target_os = "freertos"
26+
27+
import("//args.gni")
28+
}

0 commit comments

Comments
 (0)