1 # Copyright (c) 2020 Project CHIP Authors
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/efr32_sdk.gni")
19 import("${build_root}/config/defaults.gni")
20 import("${efr32_sdk_build_root}/efr32_executable.gni")
21 import("${efr32_sdk_build_root}/efr32_sdk.gni")
23 assert(current_os == "freertos")
25 efr32_project_dir = "${chip_root}/examples/lock-app/efr32"
26 examples_plat_dir = "${chip_root}/examples/platform/efr32"
29 # Dump memory usage at link time.
30 chip_print_memory_usage = false
31 setupPinCode = 73141520
32 enable_heap_monitoring = false
37 # BRD4166A --> ThunderBoard Sense 2 (No LCD)
38 if (efr32_board == "BRD4166A") {
44 "${chip_root}/src/platform/EFR32",
45 "${efr32_project_dir}/include",
46 "${examples_plat_dir}",
47 "${examples_plat_dir}/${efr32_family}/${efr32_board}",
51 "${efr32_project_dir}/include/CHIPProjectConfig.h",
52 "${efr32_project_dir}/include/FreeRTOSConfig.h",
56 "BOARD_ID=${efr32_board}",
57 "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
58 "SL_HEAP_SIZE=(10 * 1024)",
62 efr32_executable("lock_app") {
65 output_name = "chip-efr32-lock-example.out"
69 "${chip_root}/examples/common/QRCode",
70 "${chip_root}/examples/lock-app/lock-common",
71 "${chip_root}/src/lib",
72 "${chip_root}/src/setup_payload",
73 "${chip_root}/third_party/openthread/platforms:libopenthread-platform",
74 "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
75 "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
76 "${chip_root}/third_party/openthread/repo:libopenthread-ftd",
81 "${chip_root}/src/app/util",
82 "${chip_root}/src/app/server",
83 "${examples_plat_dir}",
84 "${examples_plat_dir}/${efr32_family}/${efr32_board}",
88 "${examples_plat_dir}/LEDWidget.cpp",
89 "${examples_plat_dir}/Service.cpp",
90 "${examples_plat_dir}/init_efrPlatform.cpp",
91 "${examples_plat_dir}/uart.c",
93 "src/BoltLockManager.cpp",
94 "src/ButtonHandler.cpp",
95 "src/ZclCallbacks.cpp",
100 sources += [ "${examples_plat_dir}/display/lcd.c" ]
102 defines += [ "DISPLAY_ENABLED" ]
104 output_dir = root_out_dir
106 if (enable_heap_monitoring) {
107 defines += [ "HEAP_MONITORING" ]
108 sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ]
111 if (efr32_family == "efr32mg12") {
112 ldscript = "${examples_plat_dir}/ldscripts/efr32-MG12P.ld"
113 } else if (efr32_family == "efr32mg21") {
114 ldscript = "${examples_plat_dir}/ldscripts/efr32-MG21.ld"
117 ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
119 if (chip_print_memory_usage) {
121 "-Wl,--print-memory-usage",
128 deps = [ ":lock_app" ]