| # 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_root}/config/defaults.gni") |
| import("${efr32_sdk_build_root}/efr32_executable.gni") |
| import("${efr32_sdk_build_root}/efr32_sdk.gni") |
| |
| assert(current_os == "freertos") |
| |
| efr32_project_dir = "${chip_root}/examples/lighting-app/efr32" |
| examples_plat_dir = "${chip_root}/examples/platform/efr32" |
| |
| declare_args() { |
| # Dump memory usage at link time. |
| chip_print_memory_usage = false |
| } |
| |
| show_qr_code = true |
| |
| # BRD4166A --> ThunderBoard Sense 2 (No LCD) |
| if (efr32_board == "BRD4166A") { |
| show_qr_code = false |
| } |
| |
| efr32_sdk("sdk") { |
| include_dirs = [ |
| "${chip_root}/src/platform/EFR32", |
| "${efr32_project_dir}/include", |
| "${examples_plat_dir}", |
| "${examples_plat_dir}/${efr32_family}/${efr32_board}", |
| ] |
| |
| sources = [ |
| "${efr32_project_dir}/include/CHIPProjectConfig.h", |
| "${efr32_project_dir}/include/FreeRTOSConfig.h", |
| ] |
| |
| defines = [] |
| if (is_debug) { |
| defines += [ "BUILD_RELEASE=0" ] |
| } else { |
| defines += [ "BUILD_RELEASE=1" ] |
| } |
| |
| defines += [ "BOARD_ID=${efr32_board}" ] |
| } |
| |
| efr32_executable("lighting_app") { |
| include_dirs = [] |
| defines = [] |
| output_name = "chip-efr32-lighting-example.out" |
| |
| public_deps = [ |
| ":sdk", |
| "${chip_root}/examples/common/QRCode", |
| "${chip_root}/examples/lighting-app/lighting-common", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/setup_payload", |
| "${chip_root}/third_party/openthread/platforms:libopenthread-platform", |
| "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", |
| "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", |
| "${chip_root}/third_party/openthread/repo:libopenthread-ftd", |
| ] |
| |
| include_dirs += [ |
| "include", |
| "${chip_root}/src/app/util", |
| "${chip_root}/src/app/server", |
| "${examples_plat_dir}", |
| "${examples_plat_dir}/${efr32_family}/${efr32_board}", |
| ] |
| |
| sources = [ |
| "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c", |
| "${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c", |
| "${examples_plat_dir}/LEDWidget.cpp", |
| "${examples_plat_dir}/Service.cpp", |
| "${examples_plat_dir}/init_otSystem.c", |
| "src/AppTask.cpp", |
| "src/ButtonHandler.cpp", |
| "src/LightingManager.cpp", |
| "src/ZclCallbacks.cpp", |
| "src/main.cpp", |
| ] |
| |
| if (show_qr_code) { |
| sources += [ "${examples_plat_dir}/display/lcd.c" ] |
| |
| defines += [ "DISPLAY_ENABLED" ] |
| } |
| output_dir = root_out_dir |
| |
| if (efr32_family == "efr32mg12") { |
| ldscript = "${efr32_project_dir}/ldscripts/efr32-light-example-MG12P.ld" |
| } else if (efr32_family == "efr32mg21") { |
| ldscript = "${efr32_project_dir}/ldscripts/efr32-light-example-MG21.ld" |
| } |
| |
| ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| |
| if (chip_print_memory_usage) { |
| ldflags += [ |
| "-Wl,--print-memory-usage", |
| "-fstack-usage", |
| ] |
| } |
| } |
| |
| group("efr32") { |
| deps = [ ":lighting_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":efr32" ] |
| } |