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 <commits@restyled.io>
diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt
index e31baa2..9481693 100644
--- a/config/esp32/components/chip/CMakeLists.txt
+++ b/config/esp32/components/chip/CMakeLists.txt
@@ -174,6 +174,9 @@
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 e63e51c..43b0766 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 @@
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 0000000..10a5c9c
--- /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 = ""
+}