Skip to content

Commit 77bfbbc

Browse files
authored
[bouffalo lab] add bl704l thread sed, low power, support on contact s… (#36953)
* [bouffalo lab] add bl704l thread sed, low power, support on contact sensor example * update zap file
1 parent a5bf60d commit 77bfbbc

File tree

38 files changed

+9386
-191
lines changed

38 files changed

+9386
-191
lines changed

.github/workflows/examples-bouffalolab.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,26 @@ jobs:
116116
- name: Clean out build output
117117
run: rm -rf ./out
118118

119+
- name: Build example BL702L Contact Sensor
120+
timeout-minutes: 30
121+
run: |
122+
./scripts/run_in_build_env.sh \
123+
"./scripts/build/build_examples.py \
124+
--target bouffalolab-bl704ldk-contact-sensor-thread-mtd-littlefs-mfd \
125+
build \
126+
--copy-artifacts-to out/artifacts \
127+
"
128+
- name: Prepare some bloat report from the previous builds
129+
run: |
130+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
131+
bl702l bl702l+mfd+littlefs contact-sensor-app \
132+
out/artifacts/bouffalolab-bl704ldk-contact-sensor-thread-mtd-littlefs-mfd/chip-bl702l-contact-sensor-example.out \
133+
/tmp/bloat_reports/
134+
- name: Clean out build output
135+
run: rm -rf ./out
136+
119137
- name: Uploading Size Reports
120138
uses: ./.github/actions/upload-size-reports
121139
if: ${{ !env.ACT }}
122140
with:
123-
platform-name: BouffaloLab
141+
platform-name: BouffaloLab
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
# 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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
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/bouffalolab_iot_sdk.gni")
16+
import("//build_overrides/build.gni")
17+
import("//build_overrides/chip.gni")
18+
19+
import("${bouffalolab_iot_sdk_build_root}/bl702l/bl_iot_sdk.gni")
20+
import("${bouffalolab_iot_sdk_build_root}/common/bouffalolab_executable.gni")
21+
import("${build_root}/config/defaults.gni")
22+
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
23+
import("${chip_root}/src/platform/bouffalolab/common/args.gni")
24+
import("${chip_root}/src/platform/device.gni")
25+
26+
import("${chip_root}/src/app/chip_data_model.gni")
27+
28+
if (chip_enable_pw_rpc) {
29+
import("//build_overrides/pigweed.gni")
30+
import("$dir_pw_build/target_types.gni")
31+
}
32+
33+
assert(current_os == "freertos")
34+
35+
example_dir = "${chip_root}/examples/contact-sensor-app/bouffalolab"
36+
examples_plat_dir = "${chip_root}/examples/platform/bouffalolab"
37+
38+
declare_args() {
39+
# Dump memory usage at link time.
40+
chip_print_memory_usage = true
41+
42+
# OTA periodic query timeout in seconds
43+
ota_periodic_query_timeout_seconds = 86400
44+
45+
# reboot delay in seconds to apply new OTA image
46+
ota_auto_reboot_delay_seconds = 5
47+
48+
enable_heap_monitoring = false
49+
50+
setupPinCode = 20202021
51+
setupDiscriminator = 3840
52+
53+
board = "BL704L-EVB"
54+
module_type = "BL704L"
55+
baudrate = 2000000
56+
57+
enable_psram = true
58+
}
59+
60+
bl_iot_sdk("sdk") {
61+
include_dirs = [
62+
"${example_dir}/bl702l",
63+
"${example_dir}/bl702l/include",
64+
"${examples_plat_dir}",
65+
"${chip_root}/src/platform/bouffalolab/BL702L",
66+
"${chip_root}/src/platform/bouffalolab/common",
67+
]
68+
69+
freertos_config = "${example_dir}/bl702l/FreeRTOSConfig.h"
70+
71+
defines = [
72+
"INCLUDE_xSemaphoreGetMutexHolder=1",
73+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
74+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
75+
"OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_seconds}",
76+
"OTA_AUTO_REBOOT_DELAY=${ota_auto_reboot_delay_seconds}",
77+
"PRINT_DEBUG=0",
78+
]
79+
80+
defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
81+
if (chip_enable_pw_rpc) {
82+
include_dirs += [ "${examples_plat_dir}/common/rpc" ]
83+
defines += [ "DISABLE_PRINT=1" ]
84+
} else if (chip_build_libshell) {
85+
include_dirs += [ "${examples_plat_dir}/common/plat" ]
86+
}
87+
88+
if (chip_enable_openthread) {
89+
defines += [ "OPENTHREAD_CONFIG_PLATFORM_XTAL_ACCURACY=40" ]
90+
}
91+
92+
assert(enable_psram == true, "BL702L must have psram for this application")
93+
defines += [ "CFG_USE_PSRAM=1" ]
94+
}
95+
96+
chip_data_model("bouffalolab_contact_sensor") {
97+
zap_file = "${example_dir}/data_model/contact-sensor-app.zap"
98+
is_server = true
99+
}
100+
101+
bouffalolab_executable("contact_sensor_app") {
102+
output_name = "chip-bl702l-contact-sensor-example.out"
103+
bl_plat_name = "bl702l"
104+
105+
defines = [
106+
"APP_TASK_STACK_SIZE=2048",
107+
"CHIP_UART_BAUDRATE=${baudrate}",
108+
"START_ENTRY=bl702_main",
109+
]
110+
111+
defines +=
112+
[ "CONFIG_BOUFFALOLAB_FACTORY_DATA_ENABLE=${chip_enable_factory_data}" ]
113+
if (chip_config_network_layer_ble) {
114+
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ]
115+
}
116+
117+
if ("BL704LDK" == board) {
118+
defines += [ "XT_ZB6_DevKit" ]
119+
}
120+
121+
include_dirs = [
122+
"${chip_root}/src/platform/bouffalolab/BL702L",
123+
"${example_dir}/common",
124+
"${example_dir}/bl702l",
125+
"${examples_plat_dir}/common/plat",
126+
"${examples_plat_dir}/common/iot_sdk",
127+
]
128+
129+
sources = [
130+
"${example_dir}/bl702l/app_pds.cpp",
131+
"${example_dir}/common/AppTask.cpp",
132+
"${example_dir}/common/ZclCallbacks.cpp",
133+
"${examples_plat_dir}/common/iot_sdk/aos_task.c",
134+
"${examples_plat_dir}/common/iot_sdk/platform_port.cpp",
135+
"${examples_plat_dir}/common/iot_sdk/uart.cpp",
136+
"${examples_plat_dir}/common/plat/OTAConfig.cpp",
137+
"${examples_plat_dir}/common/plat/main.cpp",
138+
"${examples_plat_dir}/common/plat/platform.cpp",
139+
]
140+
141+
deps = [
142+
":bouffalolab_contact_sensor",
143+
":sdk",
144+
"${chip_root}/examples/providers:device_info_provider",
145+
"${chip_root}/src/lib",
146+
"${chip_root}/src/platform/logging:default",
147+
"${chip_root}/src/setup_payload",
148+
]
149+
150+
if (chip_enable_openthread) {
151+
deps += [
152+
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
153+
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
154+
]
155+
156+
assert(chip_openthread_ftd == false,
157+
"Only Thread MTD support on contact sensor application.")
158+
defines += [ "CHIP_DEVICE_CONFIG_THREAD_FTD=0" ]
159+
deps += [ "${openthread_root}:libopenthread-mtd" ]
160+
if (chip_build_libshell) {
161+
deps += [ "${openthread_root}:libopenthread-cli-mtd" ]
162+
}
163+
}
164+
165+
defines += [ "CONFIG_ENABLE_CHIP_SHELL=${chip_build_libshell}" ]
166+
defines += [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ]
167+
if (chip_enable_pw_rpc) {
168+
defines += [
169+
"PW_RPC_ATTRIBUTE_SERVICE=1",
170+
"PW_RPC_BUTTON_SERVICE=1",
171+
"PW_RPC_DESCRIPTOR_SERVICE=1",
172+
"PW_RPC_DEVICE_SERVICE=1",
173+
"PW_RPC_LIGHTING_SERVICE=1",
174+
175+
"PW_RPC_OTCLI_SERVICE=1",
176+
"PW_RPC_THREAD_SERVICE=1",
177+
178+
#"PW_RPC_TRACING_SERVICE=1",
179+
]
180+
181+
sources += [
182+
"${chip_root}/examples/common/pigweed/RpcService.cpp",
183+
"${chip_root}/examples/common/pigweed/bouffalolab/PigweedLoggerMutex.cpp",
184+
"${examples_plat_dir}/common/rpc/PigweedLogger.cpp",
185+
"${examples_plat_dir}/common/rpc/Rpc.cpp",
186+
]
187+
188+
deps += [
189+
"$dir_pw_hdlc:default_addresses",
190+
"$dir_pw_hdlc:rpc_channel_output",
191+
"$dir_pw_stream:sys_io_stream",
192+
193+
#"$dir_pw_trace",
194+
#"$dir_pw_trace_tokenized",
195+
#"$dir_pw_trace_tokenized:trace_rpc_service",
196+
"${chip_root}/config/bouffalolab/common/lib/pw_rpc:pw_rpc",
197+
"${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
198+
"${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
199+
"${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
200+
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
201+
"${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
202+
"${examples_plat_dir}/common/rpc/pw_sys_io:pw_sys_io",
203+
]
204+
205+
if (chip_enable_openthread) {
206+
deps += [
207+
"${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
208+
"${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
209+
]
210+
}
211+
212+
deps += pw_build_LINK_DEPS
213+
214+
include_dirs += [
215+
"${chip_root}/examples/common",
216+
"${chip_root}/examples/common/pigweed/bouffalolab",
217+
]
218+
} else {
219+
if (chip_build_libshell) {
220+
include_dirs += [
221+
"${chip_root}/src/lib/shell",
222+
"${chip_root}/examples/shell/shell_common/include",
223+
]
224+
225+
deps += [ "${chip_root}/examples/shell/shell_common:shell_common" ]
226+
}
227+
}
228+
229+
defines += [ "HEAP_MONITORING=${enable_heap_monitoring}" ]
230+
if (enable_heap_monitoring) {
231+
sources += [ "${examples_plat_dir}/common/plat/MemMonitoring.cpp" ]
232+
}
233+
234+
assert(enable_psram == true, "BL702L must have psram for this application")
235+
defines += [ "CFG_USE_PSRAM=1" ]
236+
ldscript = "${examples_plat_dir}/bl702l/ldscripts/psram_flash.ld"
237+
238+
inputs = [ ldscript ]
239+
240+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
241+
cflags_c = [
242+
"-Wno-unused-variable",
243+
"-Wno-old-style-declaration",
244+
]
245+
cflags = [ "-Wno-unused-variable" ]
246+
if (chip_print_memory_usage) {
247+
ldflags += [
248+
"-Wl,--print-memory-usage",
249+
"-fstack-usage",
250+
]
251+
}
252+
253+
output_dir = root_out_dir
254+
}
255+
256+
group("bl702l") {
257+
deps = [ ":contact_sensor_app" ]
258+
}
259+
260+
group("default") {
261+
deps = [ ":bl702l" ]
262+
}

0 commit comments

Comments
 (0)