blob: 3fca99ff0fb7c9ac346a83629a45eed945128f14 [file] [log] [blame]
# Copyright (c) 2021 Project CHIP Authors
# Copyright 2023 NXP
#
# 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/nxp_sdk.gni")
import("//build_overrides/openthread.gni")
import("${chip_root}/src/platform/device.gni")
import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni")
import("${nxp_sdk_build_root}/nxp_sdk.gni")
assert(chip_device_platform == "nxp")
config("nxp_platform_config") {
defines = [ "EXTERNAL_BLEMANAGERIMPL_HEADER=\"platform/nxp/common/ble_zephyr/BLEManagerImpl.h\"" ]
include_dirs = [
".",
"../../common",
]
if (chip_with_factory_data == 1) {
include_dirs += [
".",
"../../common/factory_data",
]
defines += [
"CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA=1",
"CONFIG_CHIP_ENCRYPTED_FACTORY_DATA=1",
]
if (chip_enable_secure_dac_private_key_storage == 1) {
defines += [ "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/rt/rw61x/FactoryDataProviderImpl.h\"" ]
} else {
defines += [ "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/common/factory_data/FactoryDataProviderFwkImpl.h\"" ]
}
}
if (chip_enable_wifi && chip_enable_openthread) {
# Disable thread nwk commissioning instance on endpoint 0, when OTBR is enabled
defines += [ "_NO_NETWORK_COMMISSIONING_DRIVER_" ]
}
}
static_library("nxp_platform") {
deps = []
defines = []
sources = [
"../../../FreeRTOS/SystemTimeSupport.cpp",
"../../../SingletonConfigurationManager.cpp",
"../../common/CHIPDevicePlatformEvent.h",
"../../common/ConfigurationManagerImpl.cpp",
"../../common/ConfigurationManagerImpl.h",
"../../common/ConnectivityManagerImpl.cpp",
"../../common/ConnectivityManagerImpl.h",
"../../common/DiagnosticDataProviderImpl.cpp",
"../../common/DiagnosticDataProviderImpl.h",
"../../common/KeyValueStoreManagerImpl.cpp",
"../../common/KeyValueStoreManagerImpl.h",
"../../common/Logging.cpp",
"../../common/NXPConfig.h",
"../../common/NetworkProvisioningServerImpl.h",
"../../common/PlatformManagerImpl.h",
"../../common/SoftwareUpdateManagerImpl.h",
"CHIPDevicePlatformConfig.h",
"PlatformManagerImpl.cpp",
]
if (rt_nvm_component == "nvm_fwk" || rt_nvm_component == "littlefs") {
sources += [
"../../common/NXPConfig.cpp",
"../../common/ram_storage.c",
"../../common/ram_storage.h",
]
} else if (rt_nvm_component == "key_storage") {
sources += [ "../../common/NXPConfigKS.cpp" ]
}
public_deps = [ "${chip_root}/src/platform:platform_base" ]
deps += [ "${chip_root}/src/platform/logging:headers" ]
if (chip_enable_ble) {
sources += [
# Adding random file which defines the function sys_csrand_get which is called by BLEManagerImpl from Zephyr
"${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/zephyr/random/random.cpp",
"../../../Zephyr/BLEAdvertisingArbiter.cpp",
"../../../Zephyr/BLEManagerImpl.cpp",
"../../common/ble_zephyr/BLEManagerImpl.h",
]
}
# define CHIP_PLAT_NVM_SUPPORT - See NXPConfig.cpp for definition
if (rt_nvm_component == "nvm_fwk") {
defines += [ "CHIP_PLAT_NVM_SUPPORT=1" ]
} else if (rt_nvm_component == "littlefs") {
defines += [ "CHIP_PLAT_NVM_SUPPORT=2" ]
} else if (rt_nvm_component == "key_storage") {
defines += [ "CHIP_PLAT_NVM_SUPPORT=3" ]
}
if (chip_enable_wifi) {
sources += [
"../../common/NetworkCommissioningDriver.h",
"../../common/NetworkCommissioningWiFiDriver.cpp",
]
defines += [ "WIFI_DFS_OPTIMIZATION=1" ]
}
if (chip_enable_ota_requestor) {
sources += [
"../../common/OTAImageProcessorImpl.cpp",
"../../common/OTAImageProcessorImpl.h",
]
include_dirs =
[ "${chip_root}/examples/platform/nxp/common/mcuboot_app_support/" ]
}
if (chip_enable_openthread) {
sources += [
"../../../OpenThread/OpenThreadUtils.cpp",
"../../common/ThreadStackManagerImpl.cpp",
"../../common/ThreadStackManagerImpl.h",
]
deps += [ "${chip_root}/third_party/openthread:openthread" ]
public_deps += [ "${chip_root}/third_party/openthread:openthread-platform" ]
if (chip_mdns == "platform") {
if (chip_enable_wifi) {
sources += [ "../../common/DnssdImpl.cpp" ]
} else {
sources += [
"../../../OpenThread/DnssdImpl.cpp",
"../../../OpenThread/OpenThreadDnssdImpl.cpp",
"../../../OpenThread/OpenThreadDnssdImpl.h",
]
}
deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
}
}
if (chip_with_factory_data == 1) {
sources += [
"../../common/factory_data/FactoryDataProvider.cpp",
"../../common/factory_data/FactoryDataProvider.h",
]
if (chip_enable_secure_dac_private_key_storage == 1) {
sources += [
# TO BE MOVED TO THE SDK
"ELSFactoryData.c",
"ELSFactoryData.h",
"FactoryDataProviderImpl.cpp",
"FactoryDataProviderImpl.h",
]
} else {
sources += [
"../../common/factory_data/FactoryDataProviderFwkImpl.cpp",
"../../common/factory_data/FactoryDataProviderFwkImpl.h",
]
}
deps += [ "${chip_root}/src/credentials:credentials_header" ]
}
if (chip_convert_dac_private_key == 1) {
defines += [ "CHIP_DEVICE_CONFIG_SECURE_DAC_PRIVATE_KEY=1" ]
}
deps += [ "${nxp_sdk_build_root}:nxp_sdk" ]
public_deps += [
"${chip_root}/examples/platform/nxp/common/app/support:freertos_memory_utils",
"${chip_root}/src/crypto",
"${chip_root}/src/platform:syscalls_stub",
]
public_configs = [ ":nxp_platform_config" ]
}