From 140028848c2949f5e29ef969b92579f3af8ca66c Mon Sep 17 00:00:00 2001 From: Abdul Rehman <44258486+abdulrehmanee12@users.noreply.github.com> Date: Sat, 1 Apr 2023 12:30:44 +0800 Subject: [PATCH] ESP32: Enable shell command for external platform feature (#25648) * ESP32: Enable shell command for external platform feature * Restyled by gn --------- Co-authored-by: Restyled.io --- config/esp32/components/chip/CMakeLists.txt | 3 +++ src/lib/shell/BUILD.gn | 4 +++- src/lib/shell/shell_device.gni | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/lib/shell/shell_device.gni diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index e31baa2e0a6be2..94816931f29dfd 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -174,6 +174,9 @@ endif() if (CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM) chip_gn_arg_append("chip_device_platform" "\"external\"") + if (CONFIG_ENABLE_CHIP_SHELL) + chip_gn_arg_append("chip_shell_platform" "\"esp32\"") + endif() chip_gn_arg_append("chip_platform_target" "\"//${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}\"") endif() diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn index e63e51c94f89b4..43b0766a871328 100644 --- a/src/lib/shell/BUILD.gn +++ b/src/lib/shell/BUILD.gn @@ -15,6 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/lib/core/core.gni") +import("${chip_root}/src/lib/shell/shell_device.gni") import("${chip_root}/src/platform/device.gni") source_set("shell_core") { @@ -43,7 +44,8 @@ static_library("shell") { sources += [ "streamer_stdio.cpp" ] } - if (chip_device_platform == "esp32") { + if (chip_device_platform == "esp32" || + (chip_device_platform == "external" && chip_shell_platform == "esp32")) { sources += [ "MainLoopESP32.cpp", "streamer_esp32.cpp", diff --git a/src/lib/shell/shell_device.gni b/src/lib/shell/shell_device.gni new file mode 100644 index 00000000000000..10a5c9c29a8d51 --- /dev/null +++ b/src/lib/shell/shell_device.gni @@ -0,0 +1,18 @@ +# 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. + +declare_args() { + # Enable shell support + chip_shell_platform = "" +}