Skip to content

Commit 0168a57

Browse files
paklsj8xixo12restyled-commits
authored
[genio] mt793x support (project-chip#22404)
* [genio] mt793x support * [genio] fix lint error * [genio] update file mode * [genio] update file mode * [genio] fix conflict * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * [genio] update .gitmodules * [genio] re-add submodules * [genio] specify platforms in .gitmodules * [genio] fix build error and warning * [genio] update lwip & mDNSResponder * [genio] update filogic * [genio] add filogic flash tool * [genio] remove config/mt793x unused code * [genio] remove ineffective blink code * [genio] delete commented out code * [genio] delete unused code * [genio] update vendor name/vendor id/product id * [genio] add builder and fixing "gn gen --check" * [genio] improve code base for Matter integration - fix non-words - sync naming: 'mtk' to 'genio' - add paramter for API change after rebase * [genio] fix github actions build error * [genio] link wrap _gettimeofday to fix broken mDNS * [genio] fix misspell * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by autopep8 * [genio] fix line ending Co-authored-by: j8xixo12 <as2266317@gmail.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 1b76f8b commit 0168a57

File tree

111 files changed

+11593
-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.

111 files changed

+11593
-4
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ mdash
828828
MDNS
829829
MediaInput
830830
MediaPlayback
831+
MediaTek
831832
mem
832833
memdf
833834
MemMonitoring

.gitmodules

+15
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,18 @@
273273
url = https://github.com/bouffalolab/bl_iot_sdk.git
274274
branch = master
275275
platforms = bouffalolab,bl602
276+
[submodule "third_party/mt793x_sdk/filogic"]
277+
path = third_party/mt793x_sdk/filogic
278+
url = https://github.com/MediaTek-Labs/genio-matter-bsp.git
279+
branch = main
280+
platforms = genio
281+
[submodule "third_party/mt793x_sdk/mDNSResponder"]
282+
path = third_party/mt793x_sdk/mDNSResponder
283+
url = https://github.com/matter-mtk/genio-matter-mdnsresponder.git
284+
branch = main
285+
platforms = genio
286+
[submodule "third_party/mt793x_sdk/lwip"]
287+
path = third_party/mt793x_sdk/lwip
288+
url = https://github.com/matter-mtk/genio-matter-lwip.git
289+
branch = main
290+
platforms = genio

BUILD.gn

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

289289
# Set this to true to enable mw320 builds by default.
290290
enable_mw320_builds = false
291+
292+
# Set this to true to enable genio builds by default.
293+
enable_genio_builds = false
291294
}
292295

293296
declare_args() {
@@ -397,6 +400,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
397400
# Build the mw320 shell app example.
398401
enable_mw320_shell_build = enable_mw320_builds
399402

403+
# Build the genio shell app example.
404+
enable_genio_shell_app_build = enable_genio_builds
405+
400406
enable_fake_tests = enable_default_builds && host_os == "linux"
401407

402408
enable_tizen_lighting_app = enable_tizen_builds
@@ -696,6 +702,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
696702
extra_build_deps += [ ":bl702_shell" ]
697703
}
698704

705+
if (enable_genio_shell_app_build) {
706+
group("genio_shell_app") {
707+
deps = [ "${chip_root}/examples/shell/genio(${chip_root}/config/genio/toolchain:genio_shell_app)" ]
708+
}
709+
710+
extra_build_deps += [ ":genio_shell_app" ]
711+
}
712+
699713
group("default") {
700714
deps = extra_build_deps + builds
701715
}

build_overrides/mt793x_sdk.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2022 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 mt793x SDK build files.
17+
mt793x_sdk_build_root = "//third_party/mt793x_sdk"
18+
}

config/genio/BUILD.gn

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
# Options from standalone-chip.mk that differ from configure defaults. These
16+
# options are used from examples/.
17+
18+
import("//build_overrides/build.gni")
19+
import("//build_overrides/chip.gni")
20+
21+
import("${chip_root}/build/chip/tests.gni")
22+
23+
declare_args() {
24+
chip_build_pw_rpc_lib = false
25+
}
26+
27+
group("genio") {
28+
deps = [ "${chip_root}/src/lib" ]
29+
30+
if (chip_build_pw_rpc_lib) {
31+
deps += [ "//lib/pw_rpc" ]
32+
}
33+
34+
if (chip_build_tests) {
35+
deps += [ "${chip_root}/src:tests" ]
36+
}
37+
}

config/genio/args.gni

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2022 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+
# Options from standalone-chip.mk that differ from configure defaults. These
16+
# options are used from examples/.
17+
18+
chip_project_config_include = ""
19+
chip_system_project_config_include = ""
20+
chip_ble_project_config_include = ""
21+
22+
mbedtls_target = "//mbedtls:mbedtls"
23+
lwip_platform = "external"
24+
25+
chip_build_tests = true
26+
27+
chip_inet_config_enable_tcp_endpoint = true
28+
chip_inet_config_enable_udp_endpoint = true
29+
30+
custom_toolchain = "//third_party/connectedhomeip/config/genio/toolchain:genio"
31+
32+
pw_build_PIP_CONSTRAINTS =
33+
[ "//third_party/connectedhomeip/scripts/constraints.txt" ]

config/genio/toolchain/BUILD.gn

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2022 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/arm_gcc/arm_toolchain.gni")
19+
20+
arm_toolchain("genio_shell_app") {
21+
toolchain_args = {
22+
current_os = "freertos"
23+
import("${chip_root}/examples/shell/genio/args.gni")
24+
}
25+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2022 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 mt793x SDK build files.
17+
mt793x_sdk_build_root = "//third_party/connectedhomeip/third_party/mt793x_sdk"
18+
}

examples/lighting-app/genio/.gn

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 = "arm"
25+
target_os = "freertos"
26+
import("//args.gni")
27+
}

examples/lighting-app/genio/BUILD.gn

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Copyright (c) 2022 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+
import("//build_overrides/mt793x_sdk.gni")
18+
import("//build_overrides/pigweed.gni")
19+
20+
import("${build_root}/config/defaults.gni")
21+
import("${mt793x_sdk_build_root}/mt793x_executable.gni")
22+
import("${mt793x_sdk_build_root}/mt793x_sdk.gni")
23+
24+
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
25+
import("${chip_root}/src/platform/device.gni")
26+
27+
if (chip_enable_pw_rpc) {
28+
import("//build_overrides/pigweed.gni")
29+
import("$dir_pw_build/target_types.gni")
30+
}
31+
32+
assert(current_os == "freertos")
33+
34+
mt793x_project_dir = "${chip_root}/examples/lighting-app/genio"
35+
mt793x_examples_plat_dir = "${chip_root}/examples/platform/mt793x"
36+
37+
declare_args() {
38+
# Dump memory usage at link time.
39+
chip_print_memory_usage = true
40+
41+
# PIN code for PASE session establishment.
42+
setupPinCode = 20202021
43+
setupDiscriminator = 3840
44+
}
45+
46+
mt793x_sdk("sdk") {
47+
sources = [ "${mt793x_project_dir}/include/CHIPProjectConfig.h" ]
48+
49+
include_dirs = [
50+
"${chip_root}/src/platform/mt793x",
51+
"${mt793x_project_dir}/include",
52+
"${mt793x_examples_plat_dir}",
53+
"${chip_root}/src/lib",
54+
]
55+
56+
defines = [ "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE" ]
57+
58+
defines += [
59+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
60+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
61+
]
62+
}
63+
64+
mt793x_executable("lighting_app") {
65+
output_name = "chip-mt793x-lighting-app-example.out"
66+
include_dirs = [ "include" ]
67+
defines = []
68+
69+
sources = [
70+
"src/AppTask.cpp",
71+
"src/LEDWidget.cpp",
72+
"src/LightingManager.cpp",
73+
"src/ZclCallbacks.cpp",
74+
"src/main.cpp",
75+
]
76+
77+
deps = [
78+
":sdk",
79+
"${chip_root}/examples/common/QRCode",
80+
"${chip_root}/examples/lighting-app/lighting-common",
81+
"${chip_root}/examples/providers:device_info_provider",
82+
"${chip_root}/src/lib",
83+
"${chip_root}/src/setup_payload",
84+
"${mt793x_examples_plat_dir}:genio-matter-shell",
85+
]
86+
87+
if (chip_enable_ota_requestor) {
88+
defines += [ "MT793X_OTA_ENABLED" ]
89+
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
90+
}
91+
92+
ldscript = "mt793x_xip.ld"
93+
94+
inputs = [ ldscript ]
95+
96+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
97+
98+
if (chip_print_memory_usage) {
99+
ldflags += [
100+
"-Wl,--print-memory-usage",
101+
"-fstack-usage",
102+
]
103+
}
104+
105+
output_dir = root_out_dir
106+
}
107+
108+
group("mt793x") {
109+
deps = [ ":lighting_app" ]
110+
}
111+
112+
group("default") {
113+
deps = [ ":mt793x" ]
114+
}

0 commit comments

Comments
 (0)