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