| # 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("${chip_root}/src/platform/device.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/shell/efr32" |
| examples_plat_dir = "${chip_root}/examples/platform/efr32" |
| |
| declare_args() { |
| # Dump memory usage at link time. |
| chip_print_memory_usage = true |
| |
| # Monitor & log memory usage at runtime. |
| enable_heap_monitoring = false |
| } |
| |
| efr32_sdk("sdk") { |
| sources = [ |
| "${efr32_project_dir}/include/CHIPProjectConfig.h", |
| "${examples_plat_dir}/FreeRTOSConfig.h", |
| ] |
| |
| include_dirs = [ |
| "${chip_root}/src/platform/EFR32", |
| "${efr32_project_dir}/include", |
| "${examples_plat_dir}", |
| ] |
| |
| defines = [ |
| "BOARD_ID=${efr32_board}", |
| "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", |
| ] |
| } |
| |
| efr32_executable("shell_app") { |
| output_name = "chip-efr32-shell-example.out" |
| |
| sources = [ |
| "${examples_plat_dir}/heap_4_silabs.c", |
| "${examples_plat_dir}/init_efrPlatform.cpp", |
| "src/main.cpp", |
| ] |
| |
| if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { |
| sources += [ "${examples_plat_dir}/uart.cpp" ] |
| } |
| |
| deps = [ |
| ":sdk", |
| "${chip_root}/examples/shell/shell_common:shell_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", |
| "${examples_plat_dir}:efr-matter-shell", |
| ] |
| |
| include_dirs = [ "include" ] |
| |
| defines = [] |
| |
| if (enable_heap_monitoring) { |
| sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ] |
| defines += [ "HEAP_MONITORING" ] |
| } |
| |
| ldscript = "${examples_plat_dir}/ldscripts/${efr32_family}.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("efr32") { |
| deps = [ ":shell_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":efr32" ] |
| } |