blob: f032603d00457b61245715a39fa4331d6f0ad1f0 [file] [log] [blame]
# Copyright (c) 2021 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/nxp_sdk.gni")
import("//build_overrides/openthread.gni")
import("${nxp_sdk_build_root}/nxp_sdk.gni")
import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni")
import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni")
import("${chip_root}/src/app/icd/icd.gni")
import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/lib/core/core.gni")
import("${chip_root}/src/platform/device.gni")
declare_args() {
chip_software_version = 0
chip_simple_hash_verification = 0
# Setup discriminator as argument
setup_discriminator = 3840
}
if (chip_pw_tokenizer_logging) {
import("//build_overrides/pigweed.gni")
import("$dir_pw_tokenizer/database.gni")
}
assert(current_os == "freertos")
k32w0_platform_dir = "${nxp_sdk_matter_support_root}/examples/platform/k32w0"
k32w0_sdk("sdk") {
sources = [
"${k32w0_platform_dir}/app/project_include/OpenThreadConfig.h",
"include/CHIPProjectConfig.h",
"include/FreeRTOSConfig.h",
"main/include/app_config.h",
]
public_deps =
[ "${chip_root}/third_party/openthread/platforms:libopenthread-platform" ]
include_dirs = [
"main/include",
"main",
"include",
"${k32w0_platform_dir}/app/project_include",
"${k32w0_platform_dir}/app/support",
"${k32w0_platform_dir}/util/include",
"${k32w0_platform_dir}/common",
]
defines = []
if (is_debug) {
defines += [ "BUILD_RELEASE=0" ]
} else {
defines += [ "BUILD_RELEASE=1" ]
}
if (chip_software_version != 0) {
defines += [
"CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${chip_software_version}",
]
}
defines += [
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}",
]
}
k32w0_executable("contact_sensor_app") {
output_name = "chip-k32w0x-contact-example"
defines = []
sources = [
"${k32w0_platform_dir}/util/DefaultTestEventTriggerDelegate.cpp",
"${k32w0_platform_dir}/util/LEDWidget.cpp",
"${k32w0_platform_dir}/util/include/LEDWidget.h",
"main/AppTask.cpp",
"main/ContactSensorManager.cpp",
"main/ZclCallbacks.cpp",
"main/include/AppEvent.h",
"main/include/AppTask.h",
"main/include/ContactSensorManager.h",
"main/main.cpp",
]
if (chip_with_factory_data == 1 && use_custom_factory_provider == 1) {
sources += [
"${k32w0_platform_dir}/common/CustomFactoryDataProvider.cpp",
"${k32w0_platform_dir}/common/CustomFactoryDataProvider.h",
]
defines += [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ]
}
deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
]
defines += [ "CONNECTIVITY_MANAGER_THREAD_DEVICE_TYPE=ConnectivityManager::kThreadDeviceType_SleepyEndDevice" ]
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd",
"${chip_root}/third_party/openthread/repo:libopenthread-mtd",
]
#lit and sit are using different zap files
if (chip_enable_icd_lit) {
deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-lit/" ]
defines += [ "CHIP_ENABLE_LIT=1" ]
} else {
deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-sit/" ]
}
cflags = [ "-Wconversion" ]
output_dir = root_out_dir
ldscript = "${k32w0_platform_dir}/app/ldscripts/chip-k32w0x-linker.ld"
inputs = [ ldscript ]
ldflags = [
"-T" + rebase_path(ldscript, root_build_dir),
"-Wl,--defsym=__stack_size__=0x480",
"-Wl,-print-memory-usage",
]
if (chip_enable_ota_requestor) {
if (chip_reduce_ssbl_size) {
ldflags += [
"-Wl,--defsym",
"-Wl,__app_load_address__=0x2000",
"-Wl,--defsym",
"-Wl,__app_stated_size__=0x9B200",
]
} else {
ldflags += [
"-Wl,--defsym",
"-Wl,__app_load_address__=0x4000",
"-Wl,--defsym",
"-Wl,__app_stated_size__=0x99200",
]
}
}
}
if (chip_pw_tokenizer_logging) {
pw_tokenizer_database("contact_sensor_app.database") {
database = "$root_build_dir/chip-k32w0x-contact-example-database.bin"
create = "binary"
deps = [ ":contact_sensor_app" ]
optional_paths = [ "$root_build_dir/chip-k32w0x-contact-example" ]
}
}
group("k32w0") {
deps = [
":binsign",
":contact_sensor_app",
]
if (chip_enable_ota_requestor) {
deps += [ "${k32w0_platform_dir}/ssbl:ssbl" ]
}
if (chip_pw_tokenizer_logging) {
deps += [ ":contact_sensor_app.database" ]
}
}
action("binsign") {
deps = [ ":contact_sensor_app" ]
script = "${k32w0_platform_dir}/scripts/sign-outdir.py"
output_name = "bignsign.log"
outputs = [ "${root_build_dir}/${output_name}" ]
args = [
"--sdk-root",
rebase_path(k32w0_sdk_root),
]
if (chip_simple_hash_verification == 1) {
args += [ "--simple-hash" ]
}
if (chip_enable_ota_requestor) {
args += [ "--ota-enabled" ]
}
}
group("default") {
deps = [ ":k32w0" ]
}