| # 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/openthread.gni") |
| import("${chip_root}/src/platform/device.gni") |
| |
| if (chip_device_platform == "nrf5") { |
| # TODO: Unify :shell_nrf5 with :chip-shell |
| |
| import("//build_overrides/nrf5_sdk.gni") |
| import("${nrf5_sdk_build_root}/nrf5_sdk.gni") |
| |
| import("//build_overrides/openthread.gni") |
| |
| assert(current_os == "freertos") |
| public_deps = [ |
| "${chip_root}/src/lib/shell", |
| "${chip_root}/src/platform", |
| ] |
| |
| nrf5_platform_dir = "${chip_root}/examples/platform/nrf528xx" |
| project_dir = "." |
| |
| nrf5_sdk("sdk") { |
| include_dirs = [ |
| "nrf52/include", |
| "${nrf5_platform_dir}/app/project_include", |
| "${nrf5_platform_dir}/util/include", |
| "${nrf5_platform_dir}/app/include", |
| "${chip_root}/src/app/util", |
| ] |
| |
| sources = [ |
| "${nrf5_platform_dir}/app/project_include/CHIPProjectConfig.h", |
| "${nrf5_platform_dir}/app/project_include/FreeRTOSConfig.h", |
| "${nrf5_platform_dir}/app/project_include/OpenThreadConfig.h", |
| "${nrf5_platform_dir}/app/project_include/freertos_tasks_c_additions.h", |
| "${nrf5_platform_dir}/app/project_include/nrf_log_ctrl_internal.h", |
| "${project_dir}/nrf52/include/app_config.h", |
| ] |
| |
| defines = [] |
| if (is_debug) { |
| defines += [ "BUILD_RELEASE=0" ] |
| } else { |
| defines += [ "BUILD_RELEASE=1" ] |
| } |
| |
| defines += [ |
| "USE_APP_CONFIG", |
| "OPENTHREAD_CONFIG_CLI_TRANSPORT=2", |
| "MBEDTLS_PK_WRITE_C", |
| "MBEDTLS_X509_CREATE_C", |
| "MBEDTLS_X509_CSR_WRITE_C", |
| ] |
| } |
| |
| executable("shell_nrf5") { |
| output_name = "shell-nrf52840" |
| |
| include_dirs = [ |
| "${chip_root}/src/lib/shell", |
| "${nrf5_sdk_root}/components/libraries/uart", |
| ] |
| |
| sources = [ |
| "${nrf5_platform_dir}/app/chipinit.cpp", |
| "${nrf5_platform_dir}/app/include/Server.h", |
| "${nrf5_platform_dir}/app/include/chipinit.h", |
| "${nrf5_platform_dir}/app/support/CXXExceptionStubs.cpp", |
| "${nrf5_platform_dir}/app/support/nRF5Sbrk.c", |
| "${nrf5_platform_dir}/util/LEDWidget.cpp", |
| "${nrf5_platform_dir}/util/include/LEDWidget.h", |
| "${nrf5_platform_dir}/util/streamer/streamer_nrf5.cpp", |
| "${project_dir}/main.cpp", |
| "${project_dir}/nrf52/include/CHIPProjectConfig.h", |
| "${project_dir}/test_identity.cpp", |
| ] |
| |
| public_deps += [ |
| ":sdk", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/lib/shell", |
| "${chip_root}/src/setup_payload", |
| "${chip_root}/third_party/openthread/platforms/nrf528xx:libnordicsemi_nrf52840_radio_driver_softdevice", |
| "${chip_root}/third_party/openthread/platforms/nrf528xx:libopenthread-nrf52840-softdevice-sdk", |
| "${nrf5_platform_dir}/app/support:freertos_debugging_hooks", |
| "${nrf5_platform_dir}/app/support:freertos_newlib_lock_support", |
| "${nrf5_platform_dir}/app/support:freertos_newlib_lock_support_test", |
| "${openthread_root}:libopenthread-cli-ftd", |
| "${openthread_root}:libopenthread-ftd", |
| "shell_common:shell_common", |
| ] |
| |
| output_dir = root_out_dir |
| |
| ldscript = "${nrf5_platform_dir}/app/ldscripts/chip-nrf52840-example.ld" |
| |
| ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] |
| |
| defines = [ |
| "NRF_SHELL_STREAMER", |
| "SHELL_STREAMER_APP_SPECIFIC", |
| ] |
| } |
| |
| group("nrf5") { |
| deps = [ ":shell_nrf5" ] |
| } |
| |
| group("default") { |
| deps = [ ":nrf5" ] |
| } |
| } else { |
| import("${chip_root}/gn/chip/tools.gni") |
| |
| assert(chip_build_tools) |
| |
| executable("chip-shell") { |
| sources = [ "main.cpp" ] |
| |
| public_deps = [ |
| "${chip_root}/src/lib/shell", |
| "${chip_root}/src/platform", |
| "shell_common:shell_common", |
| ] |
| |
| if (is_debug) { |
| defines = [ "BUILD_RELEASE=0" ] |
| } else { |
| defines = [ "BUILD_RELEASE=1" ] |
| } |
| |
| output_dir = root_out_dir |
| } |
| |
| group("shell") { |
| deps = [ ":chip-shell" ] |
| } |
| } |