| # 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/chip.gni") |
| import("//build_overrides/efr32_sdk.gni") |
| import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") |
| import("${chip_root}/src/app/icd/icd.gni") |
| import("${chip_root}/src/lib/lib.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("${silabs_sdk_build_root}/efr32_sdk.gni") |
| import("${silabs_sdk_build_root}/silabs_board.gni") |
| |
| import("${matter_support_root}/provision/args.gni") # Seperate import since the |
| # matter_support_root is |
| # defined in the |
| # ef32_sdk.gni |
| declare_args() { |
| enable_heap_monitoring = false |
| |
| # OTA timeout in seconds |
| ota_periodic_query_timeout_sec = 86400 |
| } |
| |
| chip_detail_logging = sl_verbose_mode |
| |
| import("${silabs_common_plat_dir}/args.gni") |
| |
| # Sanity check |
| assert(!(chip_enable_wifi && chip_enable_openthread)) |
| assert(!(use_SiWx917 && chip_enable_openthread)) |
| assert(!(use_wf200 && chip_enable_openthread)) |
| |
| config("chip_examples_project_config") { |
| include_dirs = [ "project_include" ] |
| |
| # Link options that provide a replacement for dynamic memory operations in standard |
| # library with the sl_memory_manager in platform code. |
| ldflags = [ |
| "-Wl,--wrap=MemoryAlloc", |
| |
| # Wrap these in case internal newlib call them (e.g. strdup will) |
| # directly call _malloc_r) |
| "-Wl,--wrap=_malloc_r", |
| "-Wl,--wrap=_realloc_r", |
| "-Wl,--wrap=_free_r", |
| "-Wl,--wrap=_calloc_r", |
| "-Wl,--wrap=main", |
| ] |
| } |
| |
| source_set("openthread_core_config_efr32_chip_examples") { |
| if (chip_enable_openthread) { |
| sources = [ "project_include/OpenThreadConfig.h" ] |
| |
| public_deps = [ "${silabs_sdk_build_root}:silabs_sdk" ] |
| |
| if (use_silabs_thread_lib) { |
| public_deps += [ "${silabs_sdk_build_root}:openthread_core_config_efr32" ] |
| } else { |
| public_deps += [ "${chip_root}/third_party/openthread/platforms/efr32:openthread_core_config_efr32" ] |
| } |
| |
| public_configs = [ ":chip_examples_project_config" ] |
| } |
| } |
| |
| source_set("matter-shell") { |
| defines = [ "ENABLE_CHIP_SHELL" ] |
| |
| sources = [ "${silabs_common_plat_dir}/MatterShell.cpp" ] |
| include_dirs = [ |
| ".", |
| "${silabs_common_plat_dir}", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/examples/shell/shell_common:shell_common", |
| "${chip_root}/src/lib/shell:shell", |
| "${chip_root}/src/lib/shell:shell_core", |
| ] |
| } |
| |
| config("efr32-common-config") { |
| defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ] |
| |
| if (!disable_lcd) { |
| include_dirs = [ "${silabs_common_plat_dir}/display" ] |
| |
| defines += [ "DISPLAY_ENABLED" ] |
| } |
| |
| if (show_qr_code) { |
| defines += [ "QR_CODE_ENABLED" ] |
| } |
| |
| if (chip_enable_ota_requestor) { |
| defines += [ "SILABS_OTA_ENABLED" ] |
| } |
| |
| if (enable_heap_monitoring) { |
| defines += [ "HEAP_MONITORING" ] |
| } |
| |
| ldflags = [ |
| "-Wl,--no-warn-rwx-segment", |
| "-fno-lto", |
| ] |
| } |
| |
| source_set("efr32-common") { |
| deps = [ |
| "${chip_root}/src/app/clusters/network-commissioning:network-commissioning", |
| "${chip_root}/src/app/clusters/software-diagnostics-server:software-fault-listener", |
| "${silabs_common_plat_dir}/provision:storage", |
| ] |
| defines = [] |
| public_deps = [] |
| public_configs = [ |
| ":efr32-common-config", |
| "${silabs_sdk_build_root}:silabs_config", |
| ":chip_examples_project_config", |
| ] |
| |
| # MATTER_AWS |
| if (enable_matter_aws) { |
| public_deps += [ "${silabs_common_plat_dir}/matter_aws/matter_aws_interface:silabs-matter-aws" ] |
| } |
| |
| # AWS SDK OTA |
| if (aws_sdk_ota) { |
| public_deps += [ "${silabs_common_plat_dir}/matter_aws/matter_aws_interface:silabs-matter-aws-sdk-ota" ] |
| } |
| |
| include_dirs = [ "." ] |
| |
| sources = [ |
| "${silabs_common_plat_dir}/BaseApplication.cpp", |
| "${silabs_common_plat_dir}/LEDWidget.cpp", |
| "${silabs_common_plat_dir}/MatterConfig.cpp", |
| "${silabs_common_plat_dir}/SoftwareFaultReports.cpp", |
| "${silabs_common_plat_dir}/silabs_utils.cpp", |
| "${silabs_common_plat_dir}/syscalls_stubs.cpp", |
| ] |
| |
| if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || |
| sl_uart_log_output) { |
| sources += [ "${silabs_common_plat_dir}/uart.cpp" ] |
| } |
| |
| if (chip_enable_ota_requestor) { |
| sources += [ "${silabs_common_plat_dir}/OTAConfig.cpp" ] |
| } |
| |
| if (!disable_lcd) { |
| sources += [ |
| "${silabs_common_plat_dir}/display/demo-ui.c", |
| "${silabs_common_plat_dir}/display/lcd.cpp", |
| ] |
| |
| include_dirs += [ "${silabs_common_plat_dir}/display" ] |
| public_deps += [ "${chip_root}/examples/common/QRCode" ] |
| } |
| |
| if (enable_heap_monitoring) { |
| sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ] |
| } |
| |
| # OpenThread Settings |
| if (chip_enable_openthread) { |
| deps += [ |
| "${chip_root}/third_party/openthread:openthread", |
| "${chip_root}/third_party/openthread:openthread-platform", |
| ] |
| } |
| |
| if (sl_enable_rgb_led) { |
| sources += [ "${silabs_common_plat_dir}/led/RGBLEDWidget.cpp" ] |
| include_dirs = [ "${silabs_common_plat_dir}/rgb_led" ] |
| } |
| |
| if (chip_build_libshell) { |
| deps += [ ":matter-shell" ] |
| |
| if (chip_enable_icd_server) { |
| deps += [ "${silabs_common_plat_dir}/shell:icd" ] |
| } |
| } |
| |
| public_deps += [ |
| "${chip_root}/examples/providers:device_info_provider_please_do_not_reuse_as_is", |
| "${chip_root}/src/app/server", |
| "${chip_root}/src/data-model-providers/codegen:instance-header", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/setup_payload", |
| ] |
| |
| if (sl_enable_test_event_trigger) { |
| public_deps += [ "${silabs_common_plat_dir}/test-event-trigger:sources" ] |
| } |
| |
| if (sl_enable_si70xx_sensor) { |
| sources += [ |
| "${silabs_common_plat_dir}/Si70xxSensor.cpp", |
| "${silabs_common_plat_dir}/Si70xxSensor.h", |
| ] |
| } |
| |
| if (app_data_model != "") { |
| public_deps += [ app_data_model ] |
| } |
| } |