blob: 2ee2e42a24259eaf9e7ff51dff3b82339194dfea [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/k32w0_sdk.gni")
import("//build_overrides/openthread.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")
import("${chip_root}/src/platform/device.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/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}",
]
}
}
k32w0_executable("light_app") {
output_name = "chip-k32w0x-light-example"
sources = [
"${k32w0_platform_dir}/util/LEDWidget.cpp",
"${k32w0_platform_dir}/util/include/LEDWidget.h",
"main/AppTask.cpp",
"main/LightingManager.cpp",
"main/ZclCallbacks.cpp",
"main/include/AppEvent.h",
"main/include/AppTask.h",
"main/include/LightingManager.h",
"main/main.cpp",
]
public = [ "${chip_root}/src/platform/nxp/k32w/k32w0/DefaultTestEventTriggerDelegate.h" ]
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/lighting-app/nxp/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${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" ]
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_enable_ota_requestor) {
ldflags += [
"-Wl,--defsym",
"-Wl,__app_load_address__=0x4000",
"-Wl,--defsym",
"-Wl,__app_stated_size__=0x99200",
]
}
output_dir = root_out_dir
}
if (chip_pw_tokenizer_logging) {
pw_tokenizer_database("light_app.database") {
database = "$root_build_dir/chip-k32w0x-light-example-database.bin"
create = "binary"
deps = [ ":light_app" ]
optional_paths = [ "$root_build_dir/chip-k32w0x-light-example" ]
}
}
group("k32w0") {
deps = [
":binsign",
":light_app",
]
if (chip_pw_tokenizer_logging) {
deps += [ ":light_app.database" ]
}
}
action("binsign") {
deps = [ ":light_app" ]
script = "${k32w0_platform_dir}/scripts/sign-outdir.py"
output_name = "bignsign.log"
outputs = [ "${root_build_dir}/${output_name}" ]
}
group("default") {
deps = [ ":k32w0" ]
}