blob: 95fd7e1f4e207c84b52e9eeb1f0658e4ce015069 [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")
declare_args() {
# Setup discriminator as argument
setup_discriminator = 3840
}
assert(current_os == "freertos")
assert(target_os == "freertos")
example_platform_dir =
"${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}"
common_example_dir = "${chip_root}/examples/platform/nxp/common"
support_common_platform_dir =
"${nxp_sdk_matter_support_root}/examples/platform/common"
mcxw72_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}/examples/_boards/${nxp_board}/wireless_examples",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/app_common",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/components",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/dcdc",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/ext_flash",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/low_power",
]
sources += [
"${nxp_sdk_root}/examples/_boards/${nxp_board}/wireless_examples/clock_config.c",
"${nxp_sdk_root}/examples/_boards/${nxp_board}/wireless_examples/pin_mux.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/app_common/app_services_init.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/app_common/hardware_init.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/board.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/components/board_comp.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/dcdc/board_dcdc.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/ext_flash/board_extflash.c",
"${nxp_sdk_root}/examples/_common/project_segments/wireless/wireless_mcu/low_power/board_lp.c",
"${support_common_platform_dir}/ble/ble_function_mux.c",
]
if (is_debug) {
defines += [ "BUILD_RELEASE=0" ]
} else {
defines += [ "BUILD_RELEASE=1" ]
}
defines += [
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}",
]
if (nxp_enable_matter_cli) {
defines += [ "gAppUseSerialManager_c=1" ]
}
}
mcxw72_executable("light_app") {
output_name = "chip-mcxw72-light-example"
defines = []
deps = []
sources = []
include_dirs = []
cflags = [ "-Wconversion" ]
# Defines used by common code
defines += [
"CONFIG_NET_L2_OPENTHREAD=1",
"CONFIG_NETWORK_LAYER_BLE=1",
"CONFIG_ENABLE_FEEDBACK=1",
"LED_MANAGER_ENABLE_STATUS_LED=1",
"APP_QUEUE_TICKS_TO_WAIT=pdMS_TO_TICKS(10)",
"EXTERNAL_FACTORY_DATA_PROVIDER_HEADER=\"platform/nxp/common/factory_data/legacy/FactoryDataProvider.h\"",
"CONFIG_APP_FREERTOS_OS=1",
]
# App common files
include_dirs += [
"${common_example_dir}/app_task/include",
"${common_example_dir}/app_ble/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}/matter_cli/include",
"${common_example_dir}/operational_keystore/include",
"${common_example_dir}/rpc/include",
"${common_example_dir}/ui_feedback/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}/factory_data/source/AppFactoryDataDefaultImpl.cpp",
"${common_example_dir}/matter_button/source/ButtonApp.cpp",
"${common_example_dir}/matter_button/source/ButtonBle.cpp",
"${common_example_dir}/matter_button/source/ButtonManager.cpp",
"${common_example_dir}/matter_button/source/ButtonRegistrationAppAndBle.cpp",
"${common_example_dir}/matter_button/source/ButtonWithTimer.cpp",
]
if (chip_enable_ota_requestor) {
defines += [ "CONFIG_CHIP_OTA_IMAGE_PROCESSOR_HEADER=\"platform/nxp/common/ota/OTAImageProcessorImpl.h\"" ]
include_dirs += [ "${common_example_dir}/ota_requestor/include" ]
sources += [
"${common_example_dir}/../mcxw71/ota/OtaUtils.cpp",
"${common_example_dir}/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp",
]
deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ]
}
# Platform specific files
if (chip_crypto == "platform") {
defines += [ "CONFIG_OPERATIONAL_KEYSTORE=1" ]
sources += [ "${common_example_dir}/operational_keystore/source/OperationalKeystoreS200.cpp" ]
}
if (nxp_use_factory_data) {
# Custom factory data files can be added here
}
sources += [
"../common/AppTask.cpp",
"../common/DeviceCallbacks.cpp",
"../common/main.cpp",
]
sources += [
"${common_example_dir}/../mcxw71/clusters/Identify.cpp",
"${common_example_dir}/../mcxw71/util/LedOnOff.cpp",
"${common_example_dir}/ui_feedback/source/LedManager.cpp",
]
include_dirs += [
"../common",
"../common/include",
"include/config",
"${common_example_dir}/../mcxw71/util",
"${common_example_dir}/../mcxw71/app/support",
"${common_example_dir}/../mcxw71/button",
]
deps += [
"${chip_root}/examples/lighting-app/nxp/zap",
"${chip_root}/examples/providers:device_info_provider_please_do_not_reuse_as_is",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload:onboarding-codes-utils",
]
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 (nxp_enable_matter_cli) {
defines += [ "ENABLE_CHIP_SHELL" ]
deps += [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
]
sources += [
"${common_example_dir}/matter_cli/source/AppCLIBase.cpp",
"${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp",
]
}
ldscript = "${nxp_sdk_root}/examples/_boards/${nxp_board}/wireless_examples/linker/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",
"-Wl,--defsym=gUseNVMLink_d=1",
"-T" + rebase_path(ldscript, root_build_dir),
]
output_dir = root_out_dir
}
group("default") {
deps = [ ":light_app" ]
}