Skip to content

Commit

Permalink
[genio] mt793x support (#22404)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Oct 14, 2022
1 parent e7f10ec commit b7a045b
Show file tree
Hide file tree
Showing 111 changed files with 11,593 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ mdash
MDNS
MediaInput
MediaPlayback
MediaTek
mem
memdf
MemMonitoring
Expand Down
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,18 @@
url = https://github.com/bouffalolab/bl_iot_sdk.git
branch = master
platforms = bouffalolab,bl602
[submodule "third_party/mt793x_sdk/filogic"]
path = third_party/mt793x_sdk/filogic
url = https://github.com/MediaTek-Labs/genio-matter-bsp.git
branch = main
platforms = genio
[submodule "third_party/mt793x_sdk/mDNSResponder"]
path = third_party/mt793x_sdk/mDNSResponder
url = https://github.com/matter-mtk/genio-matter-mdnsresponder.git
branch = main
platforms = genio
[submodule "third_party/mt793x_sdk/lwip"]
path = third_party/mt793x_sdk/lwip
url = https://github.com/matter-mtk/genio-matter-lwip.git
branch = main
platforms = genio
14 changes: 14 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

# Set this to true to enable mw320 builds by default.
enable_mw320_builds = false

# Set this to true to enable genio builds by default.
enable_genio_builds = false
}

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

# Build the genio shell app example.
enable_genio_shell_app_build = enable_genio_builds

enable_fake_tests = enable_default_builds && host_os == "linux"

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

if (enable_genio_shell_app_build) {
group("genio_shell_app") {
deps = [ "${chip_root}/examples/shell/genio(${chip_root}/config/genio/toolchain:genio_shell_app)" ]
}

extra_build_deps += [ ":genio_shell_app" ]
}

group("default") {
deps = extra_build_deps + builds
}
Expand Down
18 changes: 18 additions & 0 deletions build_overrides/mt793x_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2022 Project CHIP Authors
#
# 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.

declare_args() {
# Root directory for mt793x SDK build files.
mt793x_sdk_build_root = "//third_party/mt793x_sdk"
}
37 changes: 37 additions & 0 deletions config/genio/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2020 Project CHIP Authors
#
# 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${chip_root}/build/chip/tests.gni")

declare_args() {
chip_build_pw_rpc_lib = false
}

group("genio") {
deps = [ "${chip_root}/src/lib" ]

if (chip_build_pw_rpc_lib) {
deps += [ "//lib/pw_rpc" ]
}

if (chip_build_tests) {
deps += [ "${chip_root}/src:tests" ]
}
}
33 changes: 33 additions & 0 deletions config/genio/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2022 Project CHIP Authors
#
# 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

chip_project_config_include = ""
chip_system_project_config_include = ""
chip_ble_project_config_include = ""

mbedtls_target = "//mbedtls:mbedtls"
lwip_platform = "external"

chip_build_tests = true

chip_inet_config_enable_tcp_endpoint = true
chip_inet_config_enable_udp_endpoint = true

custom_toolchain = "//third_party/connectedhomeip/config/genio/toolchain:genio"

pw_build_PIP_CONSTRAINTS =
[ "//third_party/connectedhomeip/scripts/constraints.txt" ]
25 changes: 25 additions & 0 deletions config/genio/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2022 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")

arm_toolchain("genio_shell_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/shell/genio/args.gni")
}
}
18 changes: 18 additions & 0 deletions examples/build_overrides/mt793x_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2022 Project CHIP Authors
#
# 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.

declare_args() {
# Root directory for mt793x SDK build files.
mt793x_sdk_build_root = "//third_party/connectedhomeip/third_party/mt793x_sdk"
}
27 changes: 27 additions & 0 deletions examples/lighting-app/genio/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2020 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = "arm"
target_os = "freertos"
import("//args.gni")
}
114 changes: 114 additions & 0 deletions examples/lighting-app/genio/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Copyright (c) 2022 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/mt793x_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${mt793x_sdk_build_root}/mt793x_executable.gni")
import("${mt793x_sdk_build_root}/mt793x_sdk.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")

if (chip_enable_pw_rpc) {
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/target_types.gni")
}

assert(current_os == "freertos")

mt793x_project_dir = "${chip_root}/examples/lighting-app/genio"
mt793x_examples_plat_dir = "${chip_root}/examples/platform/mt793x"

declare_args() {
# Dump memory usage at link time.
chip_print_memory_usage = true

# PIN code for PASE session establishment.
setupPinCode = 20202021
setupDiscriminator = 3840
}

mt793x_sdk("sdk") {
sources = [ "${mt793x_project_dir}/include/CHIPProjectConfig.h" ]

include_dirs = [
"${chip_root}/src/platform/mt793x",
"${mt793x_project_dir}/include",
"${mt793x_examples_plat_dir}",
"${chip_root}/src/lib",
]

defines = [ "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE" ]

defines += [
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
]
}

mt793x_executable("lighting_app") {
output_name = "chip-mt793x-lighting-app-example.out"
include_dirs = [ "include" ]
defines = []

sources = [
"src/AppTask.cpp",
"src/LEDWidget.cpp",
"src/LightingManager.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
]

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
"${mt793x_examples_plat_dir}:genio-matter-shell",
]

if (chip_enable_ota_requestor) {
defines += [ "MT793X_OTA_ENABLED" ]
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

ldscript = "mt793x_xip.ld"

inputs = [ ldscript ]

ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]

if (chip_print_memory_usage) {
ldflags += [
"-Wl,--print-memory-usage",
"-fstack-usage",
]
}

output_dir = root_out_dir
}

group("mt793x") {
deps = [ ":lighting_app" ]
}

group("default") {
deps = [ ":mt793x" ]
}
Loading

0 comments on commit b7a045b

Please sign in to comment.