fix: select console repl backend by enabled sdkconfig

Signed-off-by: Bo <boironic@gmail.com>
This commit is contained in:
Bo
2026-02-19 17:55:00 +08:00
parent f0a2741e0c
commit 08e59f8216

View File

@@ -552,11 +552,20 @@ esp_err_t serial_cli_init(void)
repl_config.prompt = "mimi> ";
repl_config.max_cmdline_length = 256;
/* UART console (primary), USB Serial/JTAG available as secondary */
esp_console_dev_uart_config_t hw_config =
ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
esp_console_dev_uart_config_t hw_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_console_new_repl_uart(&hw_config, &repl_config, &repl));
#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
esp_console_dev_usb_serial_jtag_config_t hw_config =
ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_console_new_repl_usb_serial_jtag(&hw_config, &repl_config, &repl));
#elif CONFIG_ESP_CONSOLE_USB_CDC
esp_console_dev_usb_cdc_config_t hw_config = ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_console_new_repl_usb_cdc(&hw_config, &repl_config, &repl));
#else
ESP_LOGE(TAG, "No supported console backend is enabled");
return ESP_ERR_NOT_SUPPORTED;
#endif
/* Register commands */
esp_console_register_help_command();