From 4e4278477d5e01becef51269a746d98a8f32835a Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Tue, 27 Feb 2024 19:38:21 +0800 Subject: [PATCH 1/2] fix(console): Fix build issues when CONFIG_ESP_CONSOLE_NONE is enabled This commit fixes the following build issues when CONFIG_ESP_CONSOLE_NONE is enabled: - vfs_console.c will attempt to register a VFS entry for STDIO console even if CONFIG_ESP_CONSOLE_NONE is enabled. This results in "undeclared `primary_path`" error. - esp_console_repl_chpi.c does not use "TAG" when CONFIG_ESP_CONSOLE_NONE is enabled, leading to a "defined by not used" warning. Closes https://github.com/espressif/esp-idf/issues/12984 --- components/console/esp_console_repl_chip.c | 2 ++ components/vfs/vfs_console.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/console/esp_console_repl_chip.c b/components/console/esp_console_repl_chip.c index 199669ae7c..2bc79bbf54 100644 --- a/components/console/esp_console_repl_chip.c +++ b/components/console/esp_console_repl_chip.c @@ -22,7 +22,9 @@ #include "console_private.h" +#if !CONFIG_ESP_CONSOLE_NONE static const char *TAG = "console.repl"; +#endif // !CONFIG_ESP_CONSOLE_NONE #if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM static esp_err_t esp_console_repl_uart_delete(esp_console_repl_t *repl); diff --git a/components/vfs/vfs_console.c b/components/vfs/vfs_console.c index 37d2c42098..eb65baf88d 100644 --- a/components/vfs/vfs_console.c +++ b/components/vfs/vfs_console.c @@ -207,10 +207,12 @@ esp_err_t esp_vfs_console_register(void) return err; } #endif +#if !CONFIG_ESP_CONSOLE_NONE err = esp_vfs_register_common(primary_path, strlen(primary_path), primary_vfs, NULL, &primary_vfs_index); if (err != ESP_OK) { return err; } +#endif // !CONFIG_ESP_CONSOLE_NONE // Secondary register part. #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG From 87e2d842abb3f4ece8170ffc05aa797e1431cc38 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Wed, 28 Feb 2024 20:39:52 +0800 Subject: [PATCH 2/2] change(console): Add build test for no console output This commit adds a build test to test the scenario where both the primary and secondary console outputs are disabled by Kconfig. --- .../system/build_test/sdkconfig.ci.console_none_esp32c3 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tools/test_apps/system/build_test/sdkconfig.ci.console_none_esp32c3 diff --git a/tools/test_apps/system/build_test/sdkconfig.ci.console_none_esp32c3 b/tools/test_apps/system/build_test/sdkconfig.ci.console_none_esp32c3 new file mode 100644 index 0000000000..772d6b4f30 --- /dev/null +++ b/tools/test_apps/system/build_test/sdkconfig.ci.console_none_esp32c3 @@ -0,0 +1,6 @@ +# Config to test that console can build with all outputs set to none (both primary and secondary) + +# Using ESP32-C3 because it supports a secondary console output (i.e., USJ) +CONFIG_IDF_TARGET="esp32c3" +CONFIG_ESP_CONSOLE_NONE=y +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y