| # 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") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/efr32_sdk.gni") |
| import("//build_overrides/pigweed.gni") |
| |
| import("${build_root}/config/defaults.gni") |
| import("${silabs_sdk_build_root}/silabs_executable.gni") |
| |
| import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("${chip_root}/third_party/silabs/silabs_board.gni") |
| |
| if (chip_enable_pw_rpc) { |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_build/target_types.gni") |
| } |
| |
| assert(current_os == "freertos") |
| |
| silabs_project_dir = "${chip_root}/examples/air-quality-sensor-app/silabs" |
| examples_common_plat_dir = "${chip_root}/examples/platform/silabs" |
| |
| if (wifi_soc) { |
| import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") |
| examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" |
| } else { |
| import("${silabs_sdk_build_root}/efr32_sdk.gni") |
| examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" |
| } |
| |
| import("${examples_common_plat_dir}/args.gni") |
| |
| declare_args() { |
| # Dump memory usage at link time. |
| chip_print_memory_usage = false |
| |
| # Enable the air quality sensor |
| # Some boards do not have a air quality sensor |
| use_air_quality_sensor = false |
| } |
| |
| if (wifi_soc) { |
| siwx917_sdk("sdk") { |
| sources = [ |
| "${examples_common_plat_dir}/FreeRTOSConfig.h", |
| "${silabs_project_dir}/include/CHIPProjectConfig.h", |
| ] |
| |
| include_dirs = [ |
| "${chip_root}/src/platform/silabs/SiWx917", |
| "${silabs_project_dir}/include", |
| "${examples_plat_dir}", |
| "${chip_root}/src/lib", |
| "${examples_common_plat_dir}", |
| ] |
| |
| defines = [] |
| if (chip_enable_pw_rpc) { |
| defines += [ |
| "HAL_VCOM_ENABLE=1", |
| "PW_RPC_ENABLED", |
| ] |
| } |
| } |
| } else { |
| efr32_sdk("sdk") { |
| sources = [ |
| "${examples_common_plat_dir}/FreeRTOSConfig.h", |
| "${silabs_project_dir}/include/CHIPProjectConfig.h", |
| ] |
| |
| include_dirs = [ |
| "${chip_root}/src/platform/silabs/efr32", |
| "${silabs_project_dir}/include", |
| "${examples_plat_dir}", |
| "${chip_root}/src/lib", |
| "${examples_common_plat_dir}", |
| ] |
| |
| defines = [] |
| if (chip_enable_pw_rpc) { |
| defines += [ |
| "HAL_VCOM_ENABLE=1", |
| "PW_RPC_ENABLED", |
| ] |
| } |
| |
| #TODO: This is a placeholder for the actual implementation |
| if (use_air_quality_sensor) { |
| include_dirs += |
| [ "${efr32_sdk_root}/examples/platform/silabs/sensors/AirQuality" ] |
| |
| defines += [ "USE_AIR_QUALITY_SENSOR" ] |
| } |
| } |
| } |
| |
| #ENDTODO |
| |
| silabs_executable("air_quality_sensor_app") { |
| output_name = "matter-silabs-air-quality-sensor-example.out" |
| include_dirs = [ |
| "include", |
| "${chip_root}/examples/air-quality-sensor-app/air-quality-sensor-common/include", |
| ] |
| defines = [] |
| |
| sources = [ |
| "${chip_root}/examples/air-quality-sensor-app/air-quality-sensor-common/src/air-quality-sensor-manager.cpp", |
| "${examples_common_plat_dir}/main.cpp", |
| "src/AppTask.cpp", |
| "src/SensorManager.cpp", |
| "src/ZclCallbacks.cpp", |
| ] |
| |
| #TODO: This is a placeholder for the actual implementation |
| if (use_air_quality_sensor) { |
| sources += [ "${efr32_sdk_root}/examples/platform/silabs/sensors/AirQuality/AirQualitySensor.cpp" ] |
| } |
| |
| #ENDTODO |
| |
| if (!disable_lcd) { |
| sources += [ "src/AirQualitySensorUI.cpp" ] |
| } |
| |
| deps = [ |
| ":sdk", |
| "${chip_root}/src/platform/logging:default", |
| app_data_model, |
| ] |
| |
| if (wifi_soc) { |
| deps += [ "${examples_plat_dir}:siwx917-common" ] |
| } else { |
| deps += [ "${examples_plat_dir}:efr32-common" ] |
| } |
| |
| if (chip_enable_pw_rpc) { |
| defines += [ |
| "PW_RPC_ENABLED", |
| "PW_RPC_ATTRIBUTE_SERVICE=1", |
| "PW_RPC_BUTTON_SERVICE=1", |
| "PW_RPC_DESCRIPTOR_SERVICE=1", |
| "PW_RPC_DEVICE_SERVICE=1", |
| "PW_RPC_LIGHTING_SERVICE=1", |
| ] |
| |
| sources += [ |
| "${chip_root}/examples/common/pigweed/RpcService.cpp", |
| "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp", |
| "${examples_common_plat_dir}/PigweedLogger.cpp", |
| "${examples_common_plat_dir}/Rpc.cpp", |
| ] |
| |
| deps += [ |
| "$dir_pw_hdlc:default_addresses", |
| "$dir_pw_hdlc:rpc_channel_output", |
| "$dir_pw_stream:sys_io_stream", |
| "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc", |
| "${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:button_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:device_service.nanopb_rpc", |
| "${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc", |
| ] |
| |
| if (wifi_soc) { |
| deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ] |
| } else { |
| deps += [ "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs" ] |
| } |
| |
| deps += pw_build_LINK_DEPS |
| |
| include_dirs += [ |
| "${chip_root}/examples/common", |
| "${chip_root}/examples/common/pigweed/efr32", |
| ] |
| } |
| |
| ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld" |
| |
| inputs = [ ldscript ] |
| |
| ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| |
| if (chip_print_memory_usage) { |
| ldflags += [ |
| "-Wl,--print-memory-usage", |
| "-fstack-usage", |
| ] |
| } |
| |
| # WiFi Settings |
| if (chip_enable_wifi) { |
| ldflags += [ |
| "-Wl,--defsym", |
| "-Wl,SILABS_WIFI=1", |
| ] |
| } |
| |
| output_dir = root_out_dir |
| } |
| |
| group("silabs") { |
| deps = [ ":air_quality_sensor_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":silabs" ] |
| } |