blob: efd3af6fd5e19a13676cdfa3813926e0f0b8d402 [file] [log] [blame]
# Copyright (c) 2024 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_executable.gni")
import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni")
import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
if (chip_enable_pw_rpc) {
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/target_types.gni")
import("${chip_root}/examples/platform/nxp/pw_rpc_server.gni")
}
declare_args() {
# Setup discriminator as argument
setup_discriminator = 3840
}
assert(current_os == "freertos")
assert(target_os == "freertos")
example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}"
common_example_dir = "${chip_root}/examples/platform/nxp/common"
support_common_platform_dir =
"${nxp_sdk_matter_support_root}/examples/platform/common"
mcxw71_k32w1_sdk("sdk") {
defines = []
include_dirs = []
sources = []
# Indicate the path to CHIPProjectConfig.h
include_dirs += [ "include/config" ]
# Indicate the default path to FreeRTOSConfig.h
include_dirs += [ "${example_platform_dir}/app/project_include/freeRTOS" ]
# Indicate the default path to OpenThreadConfig.h
include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ]
# Indicate the default path to GATT database
include_dirs += [ "${support_common_platform_dir}/ble" ]
include_dirs += [
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/MCXW716C",
]
sources += [
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/MCXW716C/clock_config.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/MCXW716C/pin_mux.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/app_services_init.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_dcdc.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_extflash.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c",
"${nxp_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c",
"${support_common_platform_dir}/ble/ble_function_mux.c",
]
if (is_debug) {
defines += [ "BUILD_RELEASE=0" ]
} else {
defines += [ "BUILD_RELEASE=1" ]
}
if (chip_enable_pw_rpc) {
defines += [
"CONFIG_ENABLE_PW_RPC",
"STREAMER_UART_FLUSH_DELAY_MS=0",
"STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE=512",
"BOARD_APP_UART_CLK_FREQ=96000000",
]
}
defines += [
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}",
]
if (chip_key_storage == "littlefs") {
include_dirs += [ "${example_platform_dir}/board" ]
sources += [
"${example_platform_dir}/board/peripherals.c",
"${example_platform_dir}/board/peripherals.h",
]
}
}
mcxw71_k32w1_executable("light_app") {
output_name = "chip-mcxw71-light-example"
defines = []
deps = []
sources = []
if (chip_enable_pw_rpc) {
forward_variables_from(pw_rpc_server, "*")
} else {
include_dirs = []
cflags = [ "-Wconversion" ]
}
# Defines used by common code
defines += [
"CONFIG_NET_L2_OPENTHREAD=1",
"CONFIG_NETWORK_LAYER_BLE=1",
"CONFIG_OPERATIONAL_KEYSTORE=1",
"CONFIG_ENABLE_FEEDBACK=1",
"APP_QUEUE_TICKS_TO_WAIT=pdMS_TO_TICKS(10)",
"EXTERNAL_FACTORY_DATA_PROVIDER_HEADER=\"platform/nxp/common/factory_data/legacy/FactoryDataProvider.h\"",
]
# App common files
include_dirs += [
"${common_example_dir}/app_task/include",
"${common_example_dir}/matter_button/include",
"${common_example_dir}/clusters/include",
"${common_example_dir}/device_callbacks/include",
"${common_example_dir}/device_manager/include",
"${common_example_dir}/factory_data/include",
"${common_example_dir}/led_widget/include",
"${common_example_dir}/operational_keystore/include",
"${common_example_dir}/rpc/include",
"${common_example_dir}/ui_feedback/include",
"${common_example_dir}/app_ble/include",
]
sources += [
"${common_example_dir}/app_ble/source/BLEApplicationManagerEmpty.cpp",
"${common_example_dir}/app_task/source/AppTaskBase.cpp",
"${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp",
"${common_example_dir}/clusters/source/ZclCallbacks.cpp",
"${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp",
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
"${common_example_dir}/operational_keystore/source/OperationalKeystoreS200.cpp",
"${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp",
]
if (chip_enable_ota_requestor) {
defines += [
"CONFIG_CHIP_OTA_IMAGE_PROCESSOR_HEADER=\"platform/nxp/common/ota/OTAImageProcessorImpl.h\"",
# The status LED and the external flash CS pin are wired together. The OTA image writing may fail if used together.
"LED_MANAGER_ENABLE_STATUS_LED=0",
]
include_dirs += [
"${common_example_dir}/ota_requestor/include",
"${chip_root}/src/platform/nxp/common/ota",
]
sources += [ "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp" ]
deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ]
}
# Platform specific files
include_dirs += [
"${example_platform_dir}/util",
"${example_platform_dir}/app/support",
"${example_platform_dir}/button",
]
sources += [
"${example_platform_dir}/button/ButtonManager.cpp",
"${example_platform_dir}/clusters/Identify.cpp",
]
if (chip_enable_ota_requestor) {
sources += [ "${example_platform_dir}/ota/OtaUtils.cpp" ]
}
if (chip_enable_pw_rpc) {
sources += [ "${example_platform_dir}/rpc/AppRpc.cpp" ]
}
if (chip_with_factory_data == 1) {
include_dirs +=
[ "${chip_root}/src/platform/nxp/common/factory_data/legacy" ]
deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ]
}
sources += [
"../common/AppTask.cpp",
"../common/DeviceCallbacks.cpp",
"../common/main.cpp",
]
include_dirs += [
"../common",
"../common/include",
"include/config",
]
deps += [
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/platform/logging:default",
]
if (chip_config_dimmable_led) {
defines += [ "LIGHTING_MANAGER_ENABLE_DIMMABLE_LED=1" ]
sources += [
"${common_example_dir}/led_widget/include/LedDimmer.h",
"${example_platform_dir}/util/LedDimmer.cpp",
"${example_platform_dir}/util/LightingManagerDimmable.cpp",
]
deps += [ "${chip_root}/examples/lighting-app/lighting-common/" ]
} else {
sources += [
"${common_example_dir}/ui_feedback/source/LedManager.cpp",
"${example_platform_dir}/util/LedOnOff.cpp",
]
deps += [ "${chip_root}/examples/lighting-app/nxp/zap/" ]
}
if (chip_openthread_ftd) {
deps += [
"${openthread_root}:libopenthread-cli-ftd",
"${openthread_root}:libopenthread-ftd",
]
} else {
deps += [
"${openthread_root}:libopenthread-cli-mtd",
"${openthread_root}:libopenthread-mtd",
]
}
if (use_smu2_static) {
ldscript = "${example_platform_dir}/app/ldscripts/app.ld"
base_ldscript_dir = "${nxp_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc"
} else {
ldscript = "${nxp_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld"
}
inputs = [ ldscript ]
ldflags = [
"-Wl,--defsym=__heap_size__=0",
"-Wl,--defsym=__stack_size__=0x480",
"-Wl,-print-memory-usage",
"-Wl,--no-warn-rwx-segments",
"-T" + rebase_path(ldscript, root_build_dir),
]
if (chip_with_factory_data == 1) {
ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ]
}
if (use_smu2_static) {
ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ]
}
output_dir = root_out_dir
}
group("default") {
deps = [ ":light_app" ]
}