Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / pigweed-app / efr32 / BUILD.gn
1 # Copyright (c) 2021 Project CHIP Authors
2 #
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
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/efr32_sdk.gni")
18 import("//build_overrides/pigweed.gni")
19 import("${build_root}/config/defaults.gni")
20
21 import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni")
22 import("${efr32_sdk_build_root}/efr32_executable.gni")
23 import("${efr32_sdk_build_root}/efr32_sdk.gni")
24
25 assert(current_os == "freertos")
26
27 efr32_project_dir = "${chip_root}/examples/pigweed-app/efr32"
28 examples_plat_dir = "${chip_root}/examples/platform/efr32"
29
30 efr32_sdk("sdk") {
31   include_dirs = [
32     "${chip_root}/src/platform/EFR32",
33     "${efr32_project_dir}/include",
34     "${examples_plat_dir}",
35     "${examples_plat_dir}/${efr32_family}/${efr32_board}",
36   ]
37
38   sources = [
39     "${efr32_project_dir}/include/CHIPProjectConfig.h",
40     "${efr32_project_dir}/include/FreeRTOSConfig.h",
41   ]
42
43   defines = [
44     "BOARD_ID=${efr32_board}",
45     "HAL_VCOM_ENABLE=1",
46     "EFR32_LOG_ENABLED=1",
47     "PW_RPC_ENABLED",
48     "SL_HEAP_SIZE=(10 * 1024)",
49   ]
50 }
51
52 efr32_executable("pigweed_app") {
53   include_dirs = []
54   defines = []
55   output_name = "chip-efr32-pigweed-example.out"
56
57   public_deps = [
58     ":sdk",
59     "$dir_pw_assert",
60     "$dir_pw_checksum",
61     "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
62     "${chip_root}/examples/common/pigweed:system_rpc_server",
63     "${chip_root}/src/lib",
64     "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32",
65   ]
66
67   include_dirs += [ "${chip_root}/examples/common/pigweed/efr32" ]
68
69   sources = [
70     "${chip_root}/examples/common/pigweed/RpcService.cpp",
71     "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
72     "${examples_plat_dir}/LEDWidget.cpp",
73     "${examples_plat_dir}/PigweedLogger.cpp",
74     "${examples_plat_dir}/init_efrPlatform.cpp",
75     "${examples_plat_dir}/uart.c",
76     "src/main.cpp",
77   ]
78
79   output_dir = root_out_dir
80
81   if (efr32_family == "efr32mg12") {
82     ldscript = "${examples_plat_dir}/ldscripts/efr32-MG12P.ld"
83   } else if (efr32_family == "efr32mg21") {
84     ldscript = "${examples_plat_dir}/ldscripts/efr32-MG21.ld"
85   }
86
87   ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
88 }
89
90 group("efr32") {
91   deps = [ ":pigweed_app" ]
92 }
93
94 group("default") {
95   deps = [ ":efr32" ]
96 }