| # 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_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/lib/core/core.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() { |
| chip_software_version = 0 |
| |
| # Setup discriminator as argument |
| setup_discriminator = 3840 |
| } |
| |
| assert(current_os == "freertos") |
| |
| k32w1_platform_dir = "${chip_root}/examples/platform/nxp/k32w/k32w1" |
| k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT") |
| |
| k32w1_sdk("sdk") { |
| sources = [ |
| "${k32w1_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", |
| "${k32w1_platform_dir}/app/project_include", |
| "${k32w1_platform_dir}/app/support", |
| "${k32w1_platform_dir}/app/ldscripts", |
| "${k32w1_platform_dir}/util/include", |
| ] |
| |
| 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}", |
| ] |
| } |
| |
| if (chip_enable_pw_rpc) { |
| defines += [ |
| "PW_RPC_ENABLED", |
| "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}", |
| ] |
| } |
| |
| k32w1_executable("light_app") { |
| output_name = "chip-k32w1-light-example" |
| |
| sources = [] |
| deps = [] |
| defines = [] |
| |
| if (chip_config_dimmable_led) { |
| defines += [ "CHIP_CONFIG_ENABLE_DIMMABLE_LED = 1" ] |
| } else { |
| defines += [ "CHIP_CONFIG_ENABLE_DIMMABLE_LED = 0" ] |
| } |
| |
| if (chip_enable_pw_rpc) { |
| forward_variables_from(pw_rpc_server, "*") |
| } else { |
| cflags = [ "-Wconversion" ] |
| } |
| |
| sources += [ |
| "${k32w1_platform_dir}/util/LEDWidget.cpp", |
| "${k32w1_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", |
| ] |
| |
| if (chip_config_dimmable_led) { |
| sources += [ |
| "${k32w1_platform_dir}/util/LED_Dimmer.cpp", |
| "${k32w1_platform_dir}/util/include/LED_Dimmer.h", |
| ] |
| deps += [ "${chip_root}/examples/lighting-app/lighting-common/" ] |
| } else { |
| deps += [ "${chip_root}/examples/lighting-app/nxp/zap/" ] |
| } |
| |
| 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}/third_party/mbedtls:mbedtls", |
| "${k32w1_platform_dir}/app/support:freertos_mbedtls_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 (use_smu2_static) { |
| ldscript = "${k32w1_platform_dir}/app/ldscripts/k32w1_app.ld" |
| base_ldscript_dir = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" |
| } else { |
| ldscript = "${k32w1_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,--defsym=gUseFactoryData_d=1", |
| "-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("k32w1") { |
| deps = [ ":light_app" ] |
| } |
| |
| group("default") { |
| deps = [ ":k32w1" ] |
| } |