|
| 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/light-switch-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 = [ |
| 48 | + "${mt793x_project_dir}/include/CHIPProjectConfig.h", |
| 49 | + "${mt793x_project_dir}/include/FreeRTOSConfig.h", |
| 50 | + ] |
| 51 | + |
| 52 | + include_dirs = [ |
| 53 | + "${chip_root}/src/platform/mt793x", |
| 54 | + "${mt793x_project_dir}/include", |
| 55 | + "${mt793x_examples_plat_dir}", |
| 56 | + "${chip_root}/src/lib", |
| 57 | + ] |
| 58 | + |
| 59 | + defines = [ "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE" ] |
| 60 | + |
| 61 | + defines += [ |
| 62 | + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", |
| 63 | + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", |
| 64 | + ] |
| 65 | +} |
| 66 | + |
| 67 | +mt793x_executable("light_switch_app") { |
| 68 | + output_name = "chip-mt793x-light-switch-app-example.out" |
| 69 | + include_dirs = [ "include" ] |
| 70 | + defines = [] |
| 71 | + |
| 72 | + sources = [ |
| 73 | + "src/BindingHandler.cpp", |
| 74 | + "src/AppTask.cpp", |
| 75 | + "src/ZclCallbacks.cpp", |
| 76 | + "src/main.cpp", |
| 77 | + "src/LEDWidget.cpp", |
| 78 | + ] |
| 79 | + |
| 80 | + deps = [ |
| 81 | + ":sdk", |
| 82 | + "${chip_root}/examples/common/QRCode", |
| 83 | + "${chip_root}/examples/light-switch-app/light-switch-common", |
| 84 | + "${chip_root}/examples/providers:device_info_provider", |
| 85 | + "${chip_root}/src/lib", |
| 86 | + "${chip_root}/src/setup_payload", |
| 87 | + "${mt793x_examples_plat_dir}:genio-matter-shell", |
| 88 | + ] |
| 89 | + |
| 90 | + if (chip_enable_ota_requestor) { |
| 91 | + defines += [ "MT793X_OTA_ENABLED" ] |
| 92 | + sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] |
| 93 | + } |
| 94 | + |
| 95 | + ldscript = "mt793x_xip.ld" |
| 96 | + |
| 97 | + inputs = [ ldscript ] |
| 98 | + |
| 99 | + ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| 100 | + |
| 101 | + if (chip_print_memory_usage) { |
| 102 | + ldflags += [ |
| 103 | + "-Wl,--print-memory-usage", |
| 104 | + "-fstack-usage", |
| 105 | + ] |
| 106 | + } |
| 107 | + |
| 108 | + output_dir = root_out_dir |
| 109 | +} |
| 110 | + |
| 111 | +group("mt793x") { |
| 112 | + deps = [ ":light_switch_app" ] |
| 113 | +} |
| 114 | + |
| 115 | +group("default") { |
| 116 | + deps = [ ":mt793x" ] |
| 117 | +} |
0 commit comments