Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 1 | # Copyright (c) 2020 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 | |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 15 | import("//build_overrides/build.gni") |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 16 | import("//build_overrides/chip.gni") |
| 17 | import("//build_overrides/nlio.gni") |
rgoliver | bf60cc2 | 2021-01-26 21:15:59 -0500 | [diff] [blame] | 18 | import("//build_overrides/pigweed.gni") |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 19 | |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 20 | import("${build_root}/config/linux/pkg_config.gni") |
Michael Spang | 09611bf | 2021-03-02 16:31:57 -0500 | [diff] [blame] | 21 | import("${chip_root}/build/chip/buildconfig_header.gni") |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 22 | |
Michael Spang | 8d085b3 | 2020-07-10 10:26:23 -0400 | [diff] [blame] | 23 | import("device.gni") |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 24 | |
Michael Spang | c32dd2f | 2020-08-13 08:42:21 -0400 | [diff] [blame] | 25 | if (chip_enable_openthread) { |
| 26 | import("//build_overrides/openthread.gni") |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 27 | |
Boris Zbarsky | ec71346 | 2022-01-06 15:53:22 -0500 | [diff] [blame] | 28 | if (chip_device_platform == "linux" || chip_device_platform == "darwin") { |
Łukasz Duda | 4e1faf2 | 2021-01-27 17:47:25 +0100 | [diff] [blame] | 29 | import("//build_overrides/ot_br_posix.gni") |
| 30 | } |
Michael Spang | c32dd2f | 2020-08-13 08:42:21 -0400 | [diff] [blame] | 31 | } |
| 32 | |
Jiacheng Guo | d3dd5e0 | 2022-03-30 23:43:12 +0800 | [diff] [blame] | 33 | if (chip_device_platform != "none" && chip_device_platform != "external") { |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 34 | declare_args() { |
| 35 | # Extra header to include in CHIPDeviceConfig.h for project. |
| 36 | chip_device_project_config_include = "" |
Michael Spang | da4c125 | 2020-08-06 10:40:49 -0400 | [diff] [blame] | 37 | |
| 38 | # Date the firmware was built. |
| 39 | chip_device_config_firmware_build_date = "" |
| 40 | |
| 41 | # Time the firmware was built. |
| 42 | chip_device_config_firmware_build_time = "" |
Jiacheng Guo | e4ac46a | 2020-11-11 00:04:34 +0800 | [diff] [blame] | 43 | |
Jiacheng Guo | b7598a0 | 2021-12-09 23:44:38 +0800 | [diff] [blame] | 44 | # Use OpenThread ftd or mtd library |
| 45 | chip_device_config_thread_ftd = chip_openthread_ftd |
| 46 | |
hnnajh | 9661374 | 2021-01-06 08:05:28 -0800 | [diff] [blame] | 47 | # Enable including the additional data in the advertisement packets |
Shubham Patil | 175218b | 2022-01-04 21:31:30 +0530 | [diff] [blame] | 48 | chip_enable_additional_data_advertising = false |
hnnajh | 846f2f1 | 2021-02-18 05:45:15 -0800 | [diff] [blame] | 49 | |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 50 | # Enable default/generic test-mode CommissionableDataProvider in GenericConfigurationManagerImpl |
| 51 | # === FOR TRANSITION UNTIL ALL EXAMPLES PROVIDE THEIR OWN === |
| 52 | # Linux platform has already transitioned. |
| 53 | chip_use_transitional_commissionable_data_provider = |
Hui.Li-TCL | 48b48c2 | 2022-03-25 23:18:10 +0800 | [diff] [blame] | 54 | chip_device_platform != "linux" && chip_device_platform != "android" |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 55 | |
Andrei Litvin | 4ae09b3 | 2021-05-11 09:14:27 -0400 | [diff] [blame] | 56 | # lock tracking: none/log/fatal or auto for a platform-dependent choice |
| 57 | chip_stack_lock_tracking = "auto" |
Hui.Li-TCL | 924f36e | 2021-09-30 20:51:41 +0800 | [diff] [blame] | 58 | |
| 59 | # todo: below operates are not work without root permission |
| 60 | # pthread_attr_setschedpolicy in GenericPlatformManagerImpl_POSIX.cpp |
| 61 | chip_device_config_run_as_root = current_os != "android" |
Artur Tynecki | b4921fc | 2022-02-21 17:44:34 +0100 | [diff] [blame] | 62 | |
| 63 | # Indication that the CHIP data model is included |
| 64 | chip_enable_data_model = false |
MtTsai | 5809552 | 2022-06-23 02:34:17 +0800 | [diff] [blame] | 65 | |
| 66 | # The string of device software version was built. |
| 67 | chip_device_config_device_software_version_string = "" |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 68 | } |
| 69 | |
Michael Spang | 732e1c0 | 2021-06-14 10:21:18 -0400 | [diff] [blame] | 70 | if (chip_stack_lock_tracking == "auto") { |
Hui.Li-TCL | 924f36e | 2021-09-30 20:51:41 +0800 | [diff] [blame] | 71 | if (chip_device_platform == "linux" || chip_device_platform == "tizen" || |
sungmok shin | b3c3799 | 2022-03-02 02:55:12 +0900 | [diff] [blame] | 72 | chip_device_platform == "android" || current_os == "freertos" || |
Boris Zbarsky | c1d5431 | 2022-06-30 20:58:20 -0400 | [diff] [blame] | 73 | chip_device_platform == "webos" || chip_device_platform == "darwin") { |
Michael Spang | 732e1c0 | 2021-06-14 10:21:18 -0400 | [diff] [blame] | 74 | # TODO: should be fatal for development. Change once bugs are fixed |
Boris Zbarsky | 17dc4b0 | 2022-02-15 08:58:13 -0500 | [diff] [blame] | 75 | chip_stack_lock_tracking = "fatal" |
Michael Spang | 732e1c0 | 2021-06-14 10:21:18 -0400 | [diff] [blame] | 76 | } else { |
| 77 | # TODO: may want to enable at least logging for embedded to find bugs |
| 78 | # this needs tuning depending on how many resources various platforms have |
| 79 | # available (mainly flash size) |
| 80 | chip_stack_lock_tracking = "none" |
| 81 | } |
| 82 | } else { |
| 83 | assert( |
| 84 | chip_stack_lock_tracking == "none" || |
| 85 | chip_stack_lock_tracking == "log" || |
| 86 | chip_stack_lock_tracking == "fatal", |
| 87 | "Please select a valid value for chip_stack_lock_tracking: auto, none, log, fatal") |
| 88 | } |
| 89 | |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 90 | buildconfig_header("platform_buildconfig") { |
| 91 | header = "CHIPDeviceBuildConfig.h" |
| 92 | header_dir = "platform" |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 93 | |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 94 | chip_with_gio = chip_enable_wifi |
Vivien Nicolas | 770a2e2 | 2022-07-05 18:21:02 +0200 | [diff] [blame] | 95 | chip_device_config_enable_wpa = |
| 96 | chip_enable_wifi && chip_device_platform != "darwin" |
Michael Spang | 732e1c0 | 2021-06-14 10:21:18 -0400 | [diff] [blame] | 97 | chip_stack_lock_tracking_log = chip_stack_lock_tracking != "none" |
| 98 | chip_stack_lock_tracking_fatal = chip_stack_lock_tracking == "fatal" |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 99 | defines = [ |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 100 | "CHIP_DEVICE_CONFIG_ENABLE_WPA=${chip_device_config_enable_wpa}", |
| 101 | "CHIP_ENABLE_OPENTHREAD=${chip_enable_openthread}", |
Jiacheng Guo | b7598a0 | 2021-12-09 23:44:38 +0800 | [diff] [blame] | 102 | "CHIP_DEVICE_CONFIG_THREAD_FTD=${chip_device_config_thread_ftd}", |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 103 | "CHIP_WITH_GIO=${chip_with_gio}", |
| 104 | "OPENTHREAD_CONFIG_ENABLE_TOBLE=false", |
Michael Spang | 732e1c0 | 2021-06-14 10:21:18 -0400 | [diff] [blame] | 105 | "CHIP_STACK_LOCK_TRACKING_ENABLED=${chip_stack_lock_tracking_log}", |
| 106 | "CHIP_STACK_LOCK_TRACKING_ERROR_FATAL=${chip_stack_lock_tracking_fatal}", |
| 107 | "CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING=${chip_enable_additional_data_advertising}", |
Hui.Li-TCL | 924f36e | 2021-09-30 20:51:41 +0800 | [diff] [blame] | 108 | "CHIP_DEVICE_CONFIG_RUN_AS_ROOT=${chip_device_config_run_as_root}", |
Boris Zbarsky | 7666b04 | 2022-04-27 10:19:16 -0400 | [diff] [blame] | 109 | "CHIP_DISABLE_PLATFORM_KVS=${chip_disable_platform_kvs}", |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 110 | ] |
| 111 | |
Wootak Jung | e945d16 | 2021-09-13 10:39:32 +0900 | [diff] [blame] | 112 | if (chip_device_platform == "linux" || chip_device_platform == "darwin" || |
doru91 | ca807a2 | 2022-04-05 18:44:08 +0300 | [diff] [blame] | 113 | chip_device_platform == "tizen" || chip_device_platform == "android" || |
sungho1.shin | fda7854 | 2022-05-25 04:21:58 +0900 | [diff] [blame] | 114 | chip_device_platform == "k32w0" || chip_device_platform == "webos") { |
Michael Spang | e1aa7b1 | 2021-03-09 18:08:38 -0500 | [diff] [blame] | 115 | defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ] |
| 116 | } |
| 117 | |
Damian Królik | 5d00d1c | 2021-04-07 03:31:43 +0200 | [diff] [blame] | 118 | if (chip_enable_nfc) { |
doru91 | 01e54b2 | 2022-04-14 13:29:13 +0300 | [diff] [blame] | 119 | defines += [ |
| 120 | "CHIP_DEVICE_CONFIG_ENABLE_NFC=1", |
| 121 | "CONFIG_CHIP_NFC_COMMISSIONING=1", |
| 122 | ] |
Damian Królik | 5d00d1c | 2021-04-07 03:31:43 +0200 | [diff] [blame] | 123 | } |
| 124 | |
Damian Królik | 79fe72a | 2021-11-23 10:26:03 +0100 | [diff] [blame] | 125 | if (chip_enable_ota_requestor) { |
| 126 | defines += [ "CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR=1" ] |
| 127 | } |
| 128 | |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 129 | if (chip_device_project_config_include != "") { |
| 130 | defines += [ "CHIP_DEVICE_PROJECT_CONFIG_INCLUDE=${chip_device_project_config_include}" ] |
| 131 | } |
| 132 | if (chip_device_platform_config_include != "") { |
| 133 | defines += [ "CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=${chip_device_platform_config_include}" ] |
| 134 | } |
| 135 | |
Michael Spang | da4c125 | 2020-08-06 10:40:49 -0400 | [diff] [blame] | 136 | if (chip_device_config_firmware_build_date != "") { |
Michael Spang | 801349e | 2020-08-10 09:15:04 -0400 | [diff] [blame] | 137 | defines += [ "CHIP_DEVICE_CONFIG_FIRWMARE_BUILD_DATE=\"${chip_device_config_firmware_build_date}\"" ] |
Michael Spang | da4c125 | 2020-08-06 10:40:49 -0400 | [diff] [blame] | 138 | } |
| 139 | if (chip_device_config_firmware_build_time != "") { |
Michael Spang | 801349e | 2020-08-10 09:15:04 -0400 | [diff] [blame] | 140 | defines += [ "CHIP_DEVICE_CONFIG_FIRMWARE_BUILD_TIME=\"${chip_device_config_firmware_build_time}\"" ] |
Michael Spang | da4c125 | 2020-08-06 10:40:49 -0400 | [diff] [blame] | 141 | } |
| 142 | |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 143 | if (chip_use_transitional_commissionable_data_provider) { |
| 144 | defines += [ "CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER=1" ] |
| 145 | } else { |
| 146 | defines += [ "CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER=0" ] |
| 147 | } |
| 148 | |
Seth Rickard | 4f0521f | 2021-01-12 16:06:52 -0600 | [diff] [blame] | 149 | if (chip_device_platform == "cc13x2_26x2") { |
| 150 | defines += [ |
| 151 | "CHIP_DEVICE_LAYER_TARGET_CC13X2_26X2=1", |
| 152 | "CHIP_DEVICE_LAYER_TARGET=cc13x2_26x2", |
| 153 | ] |
abiradarti | f496784 | 2022-06-28 09:19:03 -0500 | [diff] [blame] | 154 | } else if (chip_device_platform == "cc32xx") { |
| 155 | defines += [ |
| 156 | "CHIP_DEVICE_LAYER_TARGET_CC32XX=1", |
| 157 | "CHIP_DEVICE_LAYER_TARGET=cc32xx", |
| 158 | ] |
Seth Rickard | 4f0521f | 2021-01-12 16:06:52 -0600 | [diff] [blame] | 159 | } else if (chip_device_platform == "darwin") { |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 160 | defines += [ |
| 161 | "CHIP_DEVICE_LAYER_TARGET_DARWIN=1", |
| 162 | "CHIP_DEVICE_LAYER_TARGET=Darwin", |
Vivien Nicolas | 770a2e2 | 2022-07-05 18:21:02 +0200 | [diff] [blame] | 163 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 164 | ] |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 165 | } else if (chip_device_platform == "efr32") { |
| 166 | defines += [ |
| 167 | "CHIP_DEVICE_LAYER_TARGET_EFR32=1", |
| 168 | "CHIP_DEVICE_LAYER_TARGET=EFR32", |
| 169 | ] |
| 170 | } else if (chip_device_platform == "esp32") { |
| 171 | defines += [ |
| 172 | "CHIP_DEVICE_LAYER_TARGET_ESP32=1", |
| 173 | "CHIP_DEVICE_LAYER_TARGET=ESP32", |
| 174 | ] |
Praveen Chandran | 080ae57 | 2021-08-12 07:58:27 -0700 | [diff] [blame] | 175 | } else if (chip_device_platform == "p6") { |
| 176 | defines += [ |
| 177 | "CHIP_DEVICE_LAYER_TARGET_P6=1", |
| 178 | "CHIP_DEVICE_LAYER_TARGET=P6", |
| 179 | ] |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 180 | } else if (chip_device_platform == "linux") { |
| 181 | defines += [ |
| 182 | "CHIP_DEVICE_LAYER_TARGET_LINUX=1", |
| 183 | "CHIP_DEVICE_LAYER_TARGET=Linux", |
Yufeng Wang | c23becb | 2021-09-30 11:18:04 -0700 | [diff] [blame] | 184 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 185 | ] |
Wootak Jung | e945d16 | 2021-09-13 10:39:32 +0900 | [diff] [blame] | 186 | } else if (chip_device_platform == "tizen") { |
| 187 | defines += [ |
| 188 | "CHIP_DEVICE_LAYER_TARGET_TIZEN=1", |
| 189 | "CHIP_DEVICE_LAYER_TARGET=Tizen", |
| 190 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
| 191 | ] |
| 192 | defines -= |
| 193 | [ "CHIP_DEVICE_CONFIG_ENABLE_WPA=${chip_device_config_enable_wpa}" ] |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 194 | } else if (chip_device_platform == "nrfconnect") { |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 195 | defines += [ |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 196 | "CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=1", |
| 197 | "CHIP_DEVICE_LAYER_TARGET=nrfconnect", |
Kedar Sovani | 8617e2a | 2020-08-30 02:33:21 +0530 | [diff] [blame] | 198 | ] |
Timothy Maes | 2478e02 | 2021-07-02 04:03:46 +0200 | [diff] [blame] | 199 | } else if (chip_device_platform == "qpg") { |
Timothy Maes | b5b3d38 | 2020-10-05 16:59:21 +0200 | [diff] [blame] | 200 | defines += [ |
Timothy Maes | 2478e02 | 2021-07-02 04:03:46 +0200 | [diff] [blame] | 201 | "CHIP_DEVICE_LAYER_TARGET_QPG=1", |
| 202 | "CHIP_DEVICE_LAYER_TARGET=qpg", |
Timothy Maes | b5b3d38 | 2020-10-05 16:59:21 +0200 | [diff] [blame] | 203 | ] |
PetruSicoe | 0aac8fd | 2021-10-07 15:52:08 +0300 | [diff] [blame] | 204 | } else if (chip_device_platform == "k32w0") { |
doru91 | 04ac26b | 2020-10-13 18:23:28 +0300 | [diff] [blame] | 205 | defines += [ |
| 206 | "CHIP_DEVICE_LAYER_TARGET_K32W=1", |
PetruSicoe | 0aac8fd | 2021-10-07 15:52:08 +0300 | [diff] [blame] | 207 | "CHIP_DEVICE_LAYER_TARGET=nxp/k32w/k32w0", |
doru91 | 04ac26b | 2020-10-13 18:23:28 +0300 | [diff] [blame] | 208 | ] |
Alexandr Kolosov | fc7146c | 2021-06-09 20:57:36 +0300 | [diff] [blame] | 209 | } else if (chip_device_platform == "telink") { |
| 210 | defines += [ |
| 211 | "CHIP_DEVICE_LAYER_TARGET_TELINK=1", |
| 212 | "CHIP_DEVICE_LAYER_TARGET=telink", |
| 213 | ] |
Vincent Coubard | cc13560 | 2021-06-29 16:58:47 +0100 | [diff] [blame] | 214 | } else if (chip_device_platform == "mbed") { |
| 215 | defines += [ |
| 216 | "CHIP_DEVICE_LAYER_TARGET_MBED=1", |
| 217 | "CHIP_DEVICE_LAYER_TARGET=mbed", |
Artur Tynecki | b4921fc | 2022-02-21 17:44:34 +0100 | [diff] [blame] | 218 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
| 219 | "CHIP_DEVICE_ENABLE_DATA_MODEL=${chip_enable_data_model}", |
Vincent Coubard | cc13560 | 2021-06-29 16:58:47 +0100 | [diff] [blame] | 220 | ] |
jczhang777 | 3666138 | 2022-04-04 21:33:18 +0800 | [diff] [blame] | 221 | } else if (chip_device_platform == "bl602") { |
| 222 | defines += [ |
| 223 | "CHIP_DEVICE_LAYER_TARGET_BL602=1", |
| 224 | "CHIP_DEVICE_LAYER_TARGET=bouffalolab/BL602", |
| 225 | ] |
C Freeman | 79c9315 | 2021-08-18 00:20:05 -0400 | [diff] [blame] | 226 | } else if (chip_device_platform == "fake") { |
| 227 | defines += [ |
| 228 | "CHIP_DEVICE_LAYER_TARGET_FAKE=1", |
| 229 | "CHIP_DEVICE_LAYER_TARGET=fake", |
| 230 | ] |
Hui.Li-TCL | 924f36e | 2021-09-30 20:51:41 +0800 | [diff] [blame] | 231 | } else if (chip_device_platform == "android") { |
| 232 | defines += [ |
| 233 | "CHIP_DEVICE_LAYER_TARGET_ANDROID=1", |
| 234 | "CHIP_DEVICE_LAYER_TARGET=android", |
| 235 | ] |
pankore | 544da73c | 2021-10-19 02:51:16 +0800 | [diff] [blame] | 236 | } else if (chip_device_platform == "ameba") { |
| 237 | defines += [ |
| 238 | "CHIP_DEVICE_LAYER_TARGET_AMEBA=1", |
| 239 | "CHIP_DEVICE_LAYER_TARGET=Ameba", |
pankore | e6dab371 | 2021-11-10 01:52:01 +0800 | [diff] [blame] | 240 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
pankore | 544da73c | 2021-10-19 02:51:16 +0800 | [diff] [blame] | 241 | ] |
Todd Chou | 1af90eb | 2022-01-21 12:29:29 +0800 | [diff] [blame] | 242 | } else if (chip_device_platform == "cyw30739") { |
| 243 | defines += [ |
| 244 | "CHIP_DEVICE_LAYER_TARGET_CYW30739=1", |
| 245 | "CHIP_DEVICE_LAYER_TARGET=CYW30739", |
| 246 | ] |
sungmok shin | b3c3799 | 2022-03-02 02:55:12 +0900 | [diff] [blame] | 247 | } else if (chip_device_platform == "webos") { |
| 248 | defines += [ |
| 249 | "CHIP_DEVICE_LAYER_TARGET_WEBOS=1", |
sungho1.shin | fda7854 | 2022-05-25 04:21:58 +0900 | [diff] [blame] | 250 | "CHIP_DEVICE_LAYER_TARGET=webos", |
sungmok shin | b3c3799 | 2022-03-02 02:55:12 +0900 | [diff] [blame] | 251 | "CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}", |
| 252 | ] |
| 253 | defines -= |
| 254 | [ "CHIP_DEVICE_CONFIG_ENABLE_WPA=${chip_device_config_enable_wpa}" ] |
nxptest | 2d0c529 | 2022-06-24 19:04:49 +0800 | [diff] [blame] | 255 | } else if (chip_device_platform == "mw320") { |
| 256 | defines += [ |
| 257 | "CHIP_DEVICE_LAYER_TARGET_MW320=1", |
| 258 | "CHIP_DEVICE_LAYER_TARGET=nxp/mw320", |
| 259 | ] |
Jandy Gou | 3ffd066 | 2022-06-14 22:02:05 +0800 | [diff] [blame] | 260 | } else if (chip_device_platform == "zephyr") { |
| 261 | defines += [ |
| 262 | "CHIP_DEVICE_LAYER_TARGET_ZEPHYR=1", |
| 263 | "CHIP_DEVICE_LAYER_TARGET=Zephyr", |
| 264 | ] |
Kedar Sovani | 8617e2a | 2020-08-30 02:33:21 +0530 | [diff] [blame] | 265 | } |
MtTsai | 5809552 | 2022-06-23 02:34:17 +0800 | [diff] [blame] | 266 | |
| 267 | if (chip_device_config_device_software_version_string != "") { |
| 268 | defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${chip_device_config_device_software_version_string}\"" ] |
| 269 | } |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 270 | } |
Jiacheng Guo | d3dd5e0 | 2022-03-30 23:43:12 +0800 | [diff] [blame] | 271 | } else if (chip_device_platform == "none") { |
Jiacheng Guo | e4ac46a | 2020-11-11 00:04:34 +0800 | [diff] [blame] | 272 | buildconfig_header("platform_buildconfig") { |
| 273 | header = "CHIPDeviceBuildConfig.h" |
| 274 | header_dir = "platform" |
| 275 | |
| 276 | defines = [ |
| 277 | "CHIP_DEVICE_LAYER_NONE=1", |
| 278 | "CHIP_DEVICE_LAYER_TARGET=NONE", |
| 279 | ] |
Andrei Litvin | 1274bcf | 2021-04-09 14:13:37 -0400 | [diff] [blame] | 280 | |
| 281 | if (current_os == "android") { |
Andrei Litvin | b792463 | 2022-03-03 15:29:54 -0500 | [diff] [blame] | 282 | defines += [ "EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=\"controller/java/AndroidKeyValueStoreManagerImpl.h\"" ] |
Andrei Litvin | 1274bcf | 2021-04-09 14:13:37 -0400 | [diff] [blame] | 283 | } |
Jiacheng Guo | e4ac46a | 2020-11-11 00:04:34 +0800 | [diff] [blame] | 284 | } |
Jiacheng Guo | d3dd5e0 | 2022-03-30 23:43:12 +0800 | [diff] [blame] | 285 | } else { |
| 286 | group("platform_buildconfig") { |
| 287 | public_deps = [ "${chip_platform_target}:platform_buildconfig" ] |
| 288 | } |
Jiacheng Guo | 57945c2 | 2020-08-29 03:56:59 +0800 | [diff] [blame] | 289 | } |
Michael Spang | 1fcb6dd | 2020-08-24 11:19:04 -0400 | [diff] [blame] | 290 | |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 291 | if (chip_device_platform != "none") { |
| 292 | group("platform_base") { |
| 293 | public_deps = [ |
| 294 | ":platform_buildconfig", |
| 295 | "${chip_root}/src/ble", |
| 296 | "${chip_root}/src/inet", |
| 297 | "${chip_root}/src/lib/core", |
| 298 | "${chip_root}/src/lib/support", |
Kamil Kasperczyk | 838e489 | 2022-02-25 15:43:35 +0100 | [diff] [blame] | 299 | "${chip_root}/src/setup_payload:additional_data_payload", |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 300 | "${chip_root}/src/system", |
| 301 | ] |
| 302 | |
| 303 | public_configs = [ "${chip_root}/src:includes" ] |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | static_library("platform") { |
| 307 | output_name = "libDeviceLayer" |
| 308 | |
| 309 | sources = [ |
Michael Sandstedt | 8cc291d | 2022-06-07 10:02:58 -0500 | [diff] [blame] | 310 | "../include/platform/BuildTime.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 311 | "../include/platform/CHIPDeviceConfig.h", |
| 312 | "../include/platform/CHIPDeviceError.h", |
| 313 | "../include/platform/CHIPDeviceEvent.h", |
| 314 | "../include/platform/CHIPDeviceLayer.h", |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 315 | "../include/platform/CommissionableDataProvider.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 316 | "../include/platform/ConfigurationManager.h", |
| 317 | "../include/platform/ConnectivityManager.h", |
Yufeng Wang | 89aff25 | 2021-12-15 11:28:14 -0800 | [diff] [blame] | 318 | "../include/platform/DeviceControlServer.h", |
Arkadiusz Bałys | e023667 | 2022-05-27 11:19:32 +0200 | [diff] [blame] | 319 | "../include/platform/DeviceInstanceInfoProvider.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 320 | "../include/platform/GeneralUtils.h", |
rgoliver | bf60cc2 | 2021-01-26 21:15:59 -0500 | [diff] [blame] | 321 | "../include/platform/KeyValueStoreManager.h", |
Tennessee Carmel-Veilleux | def1881 | 2022-04-04 13:12:25 -0400 | [diff] [blame] | 322 | "../include/platform/KvsPersistentStorageDelegate.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 323 | "../include/platform/PersistedStorage.h", |
| 324 | "../include/platform/PlatformManager.h", |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 325 | "../include/platform/TestOnlyCommissionableDataProvider.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 326 | "../include/platform/ThreadStackManager.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 327 | "../include/platform/internal/BLEManager.h", |
| 328 | "../include/platform/internal/CHIPDeviceLayerInternal.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 329 | "../include/platform/internal/DeviceNetworkInfo.h", |
Pankaj Garg | 4239bcf | 2020-10-27 08:41:54 -0700 | [diff] [blame] | 330 | "../include/platform/internal/DeviceNetworkProvisioning.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 331 | "../include/platform/internal/EventLogging.h", |
| 332 | "../include/platform/internal/GenericConfigurationManagerImpl.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 333 | "../include/platform/internal/GenericConfigurationManagerImpl.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 334 | "../include/platform/internal/GenericConnectivityManagerImpl.h", |
| 335 | "../include/platform/internal/GenericConnectivityManagerImpl_BLE.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 336 | "../include/platform/internal/GenericConnectivityManagerImpl_BLE.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 337 | "../include/platform/internal/GenericConnectivityManagerImpl_NoBLE.h", |
| 338 | "../include/platform/internal/GenericConnectivityManagerImpl_NoThread.h", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 339 | "../include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h", |
Michael Spang | 65bea66 | 2022-06-21 17:33:51 -0400 | [diff] [blame] | 340 | "../include/platform/internal/GenericConnectivityManagerImpl_TCP.h", |
| 341 | "../include/platform/internal/GenericConnectivityManagerImpl_TCP.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 342 | "../include/platform/internal/GenericConnectivityManagerImpl_Thread.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 343 | "../include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp", |
Michael Spang | 65bea66 | 2022-06-21 17:33:51 -0400 | [diff] [blame] | 344 | "../include/platform/internal/GenericConnectivityManagerImpl_UDP.h", |
| 345 | "../include/platform/internal/GenericConnectivityManagerImpl_UDP.ipp", |
Yufeng Wang | 2a1e8bc | 2020-09-27 23:27:02 -0700 | [diff] [blame] | 346 | "../include/platform/internal/GenericConnectivityManagerImpl_WiFi.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 347 | "../include/platform/internal/GenericConnectivityManagerImpl_WiFi.ipp", |
Kamil Kasperczyk | 09f3e4a | 2022-06-15 10:27:34 +0200 | [diff] [blame] | 348 | "../include/platform/internal/GenericDeviceInstanceInfoProvider.h", |
| 349 | "../include/platform/internal/GenericDeviceInstanceInfoProvider.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 350 | "../include/platform/internal/GenericPlatformManagerImpl.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 351 | "../include/platform/internal/GenericPlatformManagerImpl.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 352 | "../include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 353 | "../include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 354 | "../include/platform/internal/GenericPlatformManagerImpl_POSIX.h", |
Michael Spang | feb81b6 | 2022-03-22 14:34:32 -0400 | [diff] [blame] | 355 | "../include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp", |
| 356 | "../include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp", |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 357 | "../include/platform/internal/testing/ConfigUnitTest.h", |
Tennessee Carmel-Veilleux | 8f86c43 | 2022-03-11 15:49:56 -0500 | [diff] [blame] | 358 | "CommissionableDataProvider.cpp", |
Yufeng Wang | 17be4af | 2021-05-03 21:46:33 -0700 | [diff] [blame] | 359 | "DeviceControlServer.cpp", |
Yufeng Wang | 6a55194 | 2022-03-30 23:37:40 -0700 | [diff] [blame] | 360 | "DeviceInfoProvider.cpp", |
Arkadiusz Bałys | e023667 | 2022-05-27 11:19:32 +0200 | [diff] [blame] | 361 | "DeviceInstanceInfoProvider.cpp", |
Yufeng Wang | 3e863a9 | 2021-11-22 11:41:21 -0800 | [diff] [blame] | 362 | "DiagnosticDataProvider.cpp", |
Zang MingJie | 659848c | 2021-09-03 23:13:45 +0800 | [diff] [blame] | 363 | "Entropy.cpp", |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 364 | "GeneralUtils.cpp", |
| 365 | "Globals.cpp", |
Andrei Litvin | 4ae09b3 | 2021-05-11 09:14:27 -0400 | [diff] [blame] | 366 | "LockTracker.cpp", |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 367 | "PersistedStorage.cpp", |
Zang MingJie | 39ff9bf | 2021-11-05 12:29:08 +0800 | [diff] [blame] | 368 | "PlatformEventSupport.cpp", |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 369 | ] |
| 370 | |
jmartinez-silabs | a92d1a8 | 2022-02-07 12:50:17 -0500 | [diff] [blame] | 371 | # Linux has its own NetworkCommissioningThreadDriver |
Abhay Agarwal | df5d0ee | 2022-05-02 20:00:25 +0530 | [diff] [blame] | 372 | if (chip_enable_openthread && chip_device_platform != "linux" && |
sungho1.shin | fda7854 | 2022-05-25 04:21:58 +0900 | [diff] [blame] | 373 | chip_device_platform != "tizen" && chip_device_platform != "webos") { |
jmartinez-silabs | a92d1a8 | 2022-02-07 12:50:17 -0500 | [diff] [blame] | 374 | sources += [ |
| 375 | "OpenThread/GenericNetworkCommissioningThreadDriver.cpp", |
| 376 | "OpenThread/GenericNetworkCommissioningThreadDriver.h", |
| 377 | ] |
| 378 | } |
| 379 | |
Boris Zbarsky | 444b50b | 2020-09-23 19:53:06 -0400 | [diff] [blame] | 380 | cflags = [ "-Wconversion" ] |
| 381 | |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 382 | public_deps = [ |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 383 | ":platform_base", |
Daniel Nicoara | 641e3ad | 2022-07-25 15:32:03 -0400 | [diff] [blame] | 384 | "${chip_root}/src/app:app_config", |
Yufeng Wang | 551e53f | 2021-10-26 13:41:18 -0700 | [diff] [blame] | 385 | "${chip_root}/src/app/common:cluster-objects", |
Zang MingJie | 659848c | 2021-09-03 23:13:45 +0800 | [diff] [blame] | 386 | "${chip_root}/src/crypto", |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 387 | "${chip_root}/src/lib/support", |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 388 | ] |
| 389 | |
Seth Rickard | 4f0521f | 2021-01-12 16:06:52 -0600 | [diff] [blame] | 390 | if (chip_device_platform == "cc13x2_26x2") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 391 | _platform_target = "cc13x2_26x2" |
abiradarti | f496784 | 2022-06-28 09:19:03 -0500 | [diff] [blame] | 392 | } else if (chip_device_platform == "cc32xx") { |
| 393 | _platform_target = "cc32xx" |
Seth Rickard | 4f0521f | 2021-01-12 16:06:52 -0600 | [diff] [blame] | 394 | } else if (chip_device_platform == "darwin") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 395 | _platform_target = "Darwin" |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 396 | } else if (chip_device_platform == "efr32") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 397 | _platform_target = "EFR32" |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 398 | } else if (chip_device_platform == "esp32") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 399 | _platform_target = "ESP32" |
PetruSicoe | 0aac8fd | 2021-10-07 15:52:08 +0300 | [diff] [blame] | 400 | } else if (chip_device_platform == "k32w0") { |
| 401 | _platform_target = "nxp/k32w/k32w0" |
Michael Spang | 4314d81 | 2020-08-07 10:17:09 -0400 | [diff] [blame] | 402 | } else if (chip_device_platform == "linux") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 403 | _platform_target = "Linux" |
Rafał Kuźnia | 90bc94c | 2020-08-31 19:54:04 +0200 | [diff] [blame] | 404 | } else if (chip_device_platform == "nrfconnect") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 405 | _platform_target = "nrfconnect" |
Timothy Maes | 2478e02 | 2021-07-02 04:03:46 +0200 | [diff] [blame] | 406 | } else if (chip_device_platform == "qpg") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 407 | _platform_target = "qpg" |
Alexandr Kolosov | fc7146c | 2021-06-09 20:57:36 +0300 | [diff] [blame] | 408 | } else if (chip_device_platform == "telink") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 409 | _platform_target = "telink" |
Vincent Coubard | cc13560 | 2021-06-29 16:58:47 +0100 | [diff] [blame] | 410 | } else if (chip_device_platform == "mbed") { |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 411 | _platform_target = "mbed" |
Wootak Jung | e945d16 | 2021-09-13 10:39:32 +0900 | [diff] [blame] | 412 | } else if (chip_device_platform == "tizen") { |
| 413 | _platform_target = "Tizen" |
Hui.Li-TCL | 924f36e | 2021-09-30 20:51:41 +0800 | [diff] [blame] | 414 | } else if (chip_device_platform == "android") { |
| 415 | _platform_target = "android" |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 416 | } else if (chip_device_platform == "external") { |
| 417 | _platform_target = chip_platform_target |
Praveen Chandran | 080ae57 | 2021-08-12 07:58:27 -0700 | [diff] [blame] | 418 | } else if (chip_device_platform == "p6") { |
| 419 | _platform_target = "P6" |
pankore | 544da73c | 2021-10-19 02:51:16 +0800 | [diff] [blame] | 420 | } else if (chip_device_platform == "ameba") { |
| 421 | _platform_target = "Ameba" |
sungmok shin | b3c3799 | 2022-03-02 02:55:12 +0900 | [diff] [blame] | 422 | } else if (chip_device_platform == "webos") { |
| 423 | _platform_target = "webos" |
jczhang777 | 3666138 | 2022-04-04 21:33:18 +0800 | [diff] [blame] | 424 | } else if (chip_device_platform == "bl602") { |
| 425 | _platform_target = "bouffalolab/BL602" |
C Freeman | 79c9315 | 2021-08-18 00:20:05 -0400 | [diff] [blame] | 426 | } else if (chip_device_platform == "fake") { |
| 427 | _platform_target = "fake" |
Todd Chou | 1af90eb | 2022-01-21 12:29:29 +0800 | [diff] [blame] | 428 | } else if (chip_device_platform == "cyw30739") { |
| 429 | _platform_target = "CYW30739" |
nxptest | 2d0c529 | 2022-06-24 19:04:49 +0800 | [diff] [blame] | 430 | } else if (chip_device_platform == "mw320") { |
| 431 | _platform_target = "nxp/mw320" |
Jandy Gou | 3ffd066 | 2022-06-14 22:02:05 +0800 | [diff] [blame] | 432 | } else if (chip_device_platform == "zephyr") { |
| 433 | _platform_target = "Zephyr" |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 434 | } else { |
| 435 | assert(false, "Unknown chip_device_platform: ${chip_device_platform}") |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 436 | } |
Michael Spang | db9b861 | 2020-07-13 09:43:13 -0400 | [diff] [blame] | 437 | |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 438 | public_deps += [ _platform_target ] |
Kamil Kasperczyk | 4401402 | 2021-03-12 21:18:45 +0100 | [diff] [blame] | 439 | |
Michael Spang | 68fcef6 | 2021-07-05 21:50:23 -0400 | [diff] [blame] | 440 | # The platform target needs to include the headers, so allow that here. |
| 441 | # It should be considered logically part of this target. |
| 442 | allow_circular_includes_from = [ |
| 443 | _platform_target, |
| 444 | "${chip_root}/src/lib/support", |
| 445 | ] |
Jiacheng Guo | d8f58a0 | 2020-08-19 00:23:40 +0800 | [diff] [blame] | 446 | } |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 447 | } else { |
| 448 | group("platform") { |
Jiacheng Guo | e4ac46a | 2020-11-11 00:04:34 +0800 | [diff] [blame] | 449 | public_deps = [ ":platform_buildconfig" ] |
Michael Spang | efa630b | 2020-07-08 22:23:08 -0400 | [diff] [blame] | 450 | } |
| 451 | } |