Merge branch 'fix/console_none_build_issues_v5.1' into 'release/v5.1'

fix(console): Fix build issues when CONFIG_ESP_CONSOLE_NONE is enabled (v5.1)

See merge request espressif/esp-idf!29339
This commit is contained in:
Marius Vikhammer 2024-03-04 18:04:10 +08:00
commit 0417eec03e
2 changed files with 20 additions and 2 deletions

View File

@ -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
*/
@ -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)
@ -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
@ -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)
@ -323,6 +327,7 @@ _exit:
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 */
@ -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;
@ -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;
@ -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)
@ -473,6 +483,7 @@ _exit:
}
#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;
@ -547,3 +558,4 @@ static void esp_console_repl_task(void *args)
ESP_LOGD(TAG, "The End");
vTaskDelete(NULL);
}
#endif // !CONFIG_ESP_CONSOLE_NONE

View File

@ -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