blob: 9ef1251fd88f31b8f0b090dd06e9607ec1fb08d9 [file] [log] [blame]
# 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/chip.gni")
import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/jlink.gni")
import("${chip_root}/src/platform/device.gni")
import("${efr32_sdk_build_root}/silabs_board.gni")
if (silabs_board == "BRD4325A") { # CCP board
import("${efr32_sdk_build_root}/SiWx917_sdk.gni")
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
}
declare_args() {
# Build target to use for efr32 SDK. Use this to set global SDK defines.
efr32_sdk_target = ""
sl_ot_efr32_root = "${chip_root}/third_party/openthread/ot-efr32"
sl_openthread_root = "${chip_root}/third_party/openthread/ot-efr32/openthread"
use_thread_coap_lib = false
sl_matter_version_str = ""
}
assert(efr32_sdk_target != "", "efr32_sdk_target must be specified")
config("silabs_config") {
if (sl_matter_version_str != "") {
defines = [ "SL_MATTER_VERSION_STRING=\"${sl_matter_version_str}\"" ]
}
}
group("efr32_sdk") {
public_deps = [ efr32_sdk_target ]
}
if (use_silabs_thread_lib) {
config("libopenthread-platform_config") {
include_dirs = [ "${sl_openthread_root}/examples/platforms" ]
}
copy("copy_openthread_system") {
sources = [ "${sl_openthread_root}/examples/platforms/openthread-system.h" ]
outputs =
[ "${root_gen_dir}/include/openthread/platform/{{source_file_part}}" ]
}
source_set("openthread_system") {
sources =
[ "${root_gen_dir}/include/openthread/platform/openthread-system.h" ]
deps = [ ":copy_openthread_system" ]
}
source_set("libopenthread-platform") {
sources = [ "${sl_openthread_root}/examples/platforms/openthread-system.h" ]
public_deps = [ ":openthread_system" ]
public_configs = [ ":libopenthread-platform_config" ]
}
config("openthread_efr32_config") {
defines = [
"RADIO_CONFIG_DMP_SUPPORT=1",
"${silabs_board}=1",
"${silabs_mcu}",
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-efr32-config-check.h\"",
]
include_dirs = [
"${chip_root}/examples/platform/silabs/efr32",
"${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}",
"${sl_ot_efr32_root}/src/src",
"${sl_openthread_root}/src/",
]
}
source_set("openthread_core_config_efr32") {
sources = [
"${sl_ot_efr32_root}/src/src/openthread-core-efr32-config-check.h",
"${sl_ot_efr32_root}/src/src/openthread-core-efr32-config.h",
]
public_deps = [
":libopenthread-platform",
"${efr32_sdk_build_root}:efr32_sdk",
]
public_configs = [ ":openthread_efr32_config" ]
}
source_set("ot-efr32-cert") {
if (enable_openthread_cli) {
sources = [
"${sl_openthread_root}/examples/apps/cli/cli_uart.cpp",
"${sl_openthread_root}/src/cli/cli.cpp",
"${sl_openthread_root}/src/cli/cli.hpp",
"${sl_openthread_root}/src/cli/cli_coap.cpp",
"${sl_openthread_root}/src/cli/cli_coap.hpp",
"${sl_openthread_root}/src/cli/cli_coap_secure.cpp",
"${sl_openthread_root}/src/cli/cli_coap_secure.hpp",
"${sl_openthread_root}/src/cli/cli_commissioner.cpp",
"${sl_openthread_root}/src/cli/cli_commissioner.hpp",
"${sl_openthread_root}/src/cli/cli_config.h",
"${sl_openthread_root}/src/cli/cli_dataset.cpp",
"${sl_openthread_root}/src/cli/cli_dataset.hpp",
"${sl_openthread_root}/src/cli/cli_history.cpp",
"${sl_openthread_root}/src/cli/cli_history.hpp",
"${sl_openthread_root}/src/cli/cli_joiner.cpp",
"${sl_openthread_root}/src/cli/cli_joiner.hpp",
"${sl_openthread_root}/src/cli/cli_network_data.cpp",
"${sl_openthread_root}/src/cli/cli_network_data.hpp",
"${sl_openthread_root}/src/cli/cli_output.cpp",
"${sl_openthread_root}/src/cli/cli_output.hpp",
"${sl_openthread_root}/src/cli/cli_srp_client.cpp",
"${sl_openthread_root}/src/cli/cli_srp_client.hpp",
"${sl_openthread_root}/src/cli/cli_srp_server.cpp",
"${sl_openthread_root}/src/cli/cli_srp_server.hpp",
"${sl_openthread_root}/src/cli/cli_tcp.cpp",
"${sl_openthread_root}/src/cli/cli_tcp.hpp",
"${sl_openthread_root}/src/cli/cli_udp.cpp",
"${sl_openthread_root}/src/cli/cli_udp.hpp",
"${sl_openthread_root}/src/cli/x509_cert_key.hpp",
]
}
public_configs = [
":openthread_efr32_config",
":libopenthread-platform_config",
]
public_deps = [
":libopenthread-platform",
":openthread_core_config_efr32",
"${segger_rtt_root}:segger_rtt",
"${sl_openthread_root}/include/openthread:openthread",
"${sl_openthread_root}/src/core/:libopenthread_core_headers",
]
deps = [ "${efr32_sdk_build_root}:efr32_sdk" ]
# selected thread device type FTD or MTD
XTD = "ftd"
if (!chip_openthread_ftd) {
XTD = "mtd"
}
# Use silabs openthread library stack with or without coap api enabled
COAP_API = ""
if (use_thread_coap_lib) {
COAP_API = "coap_"
}
public_configs += [ "${sl_openthread_root}:openthread_${XTD}_config" ]
libs = [
"${sl_ot_efr32_root}/libs/libsl_ot_stack_${XTD}_${COAP_API}${silabs_family}_gcc.a",
"${sl_ot_efr32_root}/libs/libsl_platform_${XTD}_dmp_${silabs_family}_gcc.a",
]
}
}