blob: 0b752583604a897482aa6435ba4cca57812bbfed [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/k32w0_sdk.gni")
import("//build_overrides/openthread.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/third_party/simw-top-mini/simw_config.gni")
import("${k32w0_sdk_build_root}/k32w0_executable.gni")
import("${k32w0_sdk_build_root}/k32w0_sdk.gni")
import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/lib/core/core.gni")
declare_args() {
chip_software_version = 0
}
if (chip_pw_tokenizer_logging) {
import("//build_overrides/pigweed.gni")
import("$dir_pw_tokenizer/database.gni")
}
assert(current_os == "freertos")
k32w0_platform_dir = "${chip_root}/examples/platform/nxp/k32w/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/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}",
]
}
}
k32w0_executable("lock_app") {
output_name = "chip-k32w0x-lock-example"
sources = [
"${k32w0_platform_dir}/util/LEDWidget.cpp",
"${k32w0_platform_dir}/util/include/LEDWidget.h",
"main/AppTask.cpp",
"main/BoltLockManager.cpp",
"main/ZclCallbacks.cpp",
"main/include/AppEvent.h",
"main/include/AppTask.h",
"main/include/BoltLockManager.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",
"CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS=3",
]
}
deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lock-app/nxp/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/crypto",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
]
if (chip_openthread_ftd) {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
"${chip_root}/third_party/openthread/repo:libopenthread-ftd",
]
} else {
deps += [
"${chip_root}/third_party/openthread/repo:libopenthread-cli-mtd",
"${chip_root}/third_party/openthread/repo:libopenthread-mtd",
]
}
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,-print-memory-usage",
]
}
if (chip_pw_tokenizer_logging) {
pw_tokenizer_database("lock_app.database") {
database = "$root_build_dir/chip-k32w0x-lock-example-database.bin"
create = "binary"
deps = [ ":lock_app" ]
optional_paths = [ "$root_build_dir/chip-k32w0x-lock-example" ]
}
}
group("k32w0") {
deps = [
":binsign",
":lock_app",
]
if (chip_pw_tokenizer_logging) {
deps += [ ":lock_app.database" ]
}
}
action("binsign") {
deps = [ ":lock_app" ]
script = "${k32w0_platform_dir}/scripts/sign-outdir.py"
output_name = "bignsign.log"
outputs = [ "${root_build_dir}/${output_name}" ]
}
group("default") {
deps = [ ":k32w0" ]
}