Skip to content

Commit

Permalink
Merge branch 'fix/console_none_build_issues_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
fix(console): Fix build issues when CONFIG_ESP_CONSOLE_NONE is enabled (v5.1)

See merge request espressif/esp-idf!29339
  • Loading branch information
ESP-Marius committed Mar 4, 2024
2 parents 975a86b + 0807963 commit 0417eec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/console/esp_console_repl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -21,7 +21,9 @@
#include "driver/usb_serial_jtag.h"
#include "linenoise/linenoise.h"

#if !CONFIG_ESP_CONSOLE_NONE
static const char *TAG = "console.repl";
#endif // !CONFIG_ESP_CONSOLE_NONE

#define CONSOLE_PROMPT_MAX_LEN (32)
#define CONSOLE_PATH_MAX_LEN (ESP_VFS_PATH_MAX)
Expand All @@ -46,7 +48,6 @@ typedef struct {
int uart_channel; // uart channel number
} esp_console_repl_universal_t;

static void esp_console_repl_task(void *args);
#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);
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
Expand All @@ -56,9 +57,12 @@ static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl);
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *repl);
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
#if !CONFIG_ESP_CONSOLE_NONE
static void esp_console_repl_task(void *args);
static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_repl_com_t *repl_com);
static esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_com_t *repl_com);
static esp_err_t esp_console_setup_history(const char *history_path, uint32_t max_history_len, esp_console_repl_com_t *repl_com);
#endif // !CONFIG_ESP_CONSOLE_NONE

#if CONFIG_ESP_CONSOLE_USB_CDC
esp_err_t esp_console_new_repl_usb_cdc(const esp_console_dev_usb_cdc_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl)
Expand Down Expand Up @@ -323,6 +327,7 @@ esp_err_t esp_console_start_repl(esp_console_repl_t *repl)
return ret;
}

#if !CONFIG_ESP_CONSOLE_NONE
static esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_com_t *repl_com)
{
/* set command line prompt */
Expand All @@ -347,7 +352,9 @@ static esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_c

return ESP_OK;
}
#endif // !CONFIG_ESP_CONSOLE_NONE

#if !CONFIG_ESP_CONSOLE_NONE
static esp_err_t esp_console_setup_history(const char *history_path, uint32_t max_history_len, esp_console_repl_com_t *repl_com)
{
esp_err_t ret = ESP_OK;
Expand All @@ -368,7 +375,9 @@ static esp_err_t esp_console_setup_history(const char *history_path, uint32_t ma
_exit:
return ret;
}
#endif // !CONFIG_ESP_CONSOLE_NONE

#if !CONFIG_ESP_CONSOLE_NONE
static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_repl_com_t *repl_com)
{
esp_err_t ret = ESP_OK;
Expand Down Expand Up @@ -408,6 +417,7 @@ static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_
_exit:
return ret;
}
#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)
Expand Down Expand Up @@ -473,6 +483,7 @@ static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *rep
}
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG

#if !CONFIG_ESP_CONSOLE_NONE
static void esp_console_repl_task(void *args)
{
esp_console_repl_universal_t *repl_conf = (esp_console_repl_universal_t *) args;
Expand Down Expand Up @@ -547,3 +558,4 @@ static void esp_console_repl_task(void *args)
ESP_LOGD(TAG, "The End");
vTaskDelete(NULL);
}
#endif // !CONFIG_ESP_CONSOLE_NONE
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0417eec

Please sign in to comment.