mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
console: Fix building issue when serial JTAG is set
Closes https://github.com/espressif/esp-idf/issues/10707
This commit is contained in:
parent
0241b95b71
commit
f47d9432a0
@ -65,6 +65,7 @@ typedef struct {
|
|||||||
.max_cmdline_length = 0, \
|
.max_cmdline_length = 0, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
/**
|
/**
|
||||||
* @brief Parameters for console device: UART
|
* @brief Parameters for console device: UART
|
||||||
*
|
*
|
||||||
@ -76,7 +77,7 @@ typedef struct {
|
|||||||
int rx_gpio_num; //!< GPIO number for RX path, -1 means using default one
|
int rx_gpio_num; //!< GPIO number for RX path, -1 means using default one
|
||||||
} esp_console_dev_uart_config_t;
|
} esp_console_dev_uart_config_t;
|
||||||
|
|
||||||
#ifdef CONFIG_ESP_CONSOLE_UART_CUSTOM
|
#if CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
#define ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT() \
|
#define ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT() \
|
||||||
{ \
|
{ \
|
||||||
.channel = CONFIG_ESP_CONSOLE_UART_NUM, \
|
.channel = CONFIG_ESP_CONSOLE_UART_NUM, \
|
||||||
@ -92,8 +93,10 @@ typedef struct {
|
|||||||
.tx_gpio_num = -1, \
|
.tx_gpio_num = -1, \
|
||||||
.rx_gpio_num = -1, \
|
.rx_gpio_num = -1, \
|
||||||
}
|
}
|
||||||
#endif
|
#endif // CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_USB_CDC || (defined __DOXYGEN__ && SOC_USB_OTG_SUPPORTED)
|
||||||
/**
|
/**
|
||||||
* @brief Parameters for console device: USB CDC
|
* @brief Parameters for console device: USB CDC
|
||||||
*
|
*
|
||||||
@ -104,11 +107,10 @@ typedef struct {
|
|||||||
|
|
||||||
} esp_console_dev_usb_cdc_config_t;
|
} esp_console_dev_usb_cdc_config_t;
|
||||||
|
|
||||||
#define ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT() \
|
#define ESP_CONSOLE_DEV_CDC_CONFIG_DEFAULT() {}
|
||||||
{ \
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC || (defined __DOXYGEN__ && SOC_USB_OTG_SUPPORTED)
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || (defined __DOXYGEN__ && SOC_USB_SERIAL_JTAG_SUPPORTED)
|
||||||
/**
|
/**
|
||||||
* @brief Parameters for console device: USB-SERIAL-JTAG
|
* @brief Parameters for console device: USB-SERIAL-JTAG
|
||||||
*
|
*
|
||||||
@ -120,8 +122,7 @@ typedef struct {
|
|||||||
} esp_console_dev_usb_serial_jtag_config_t;
|
} esp_console_dev_usb_serial_jtag_config_t;
|
||||||
|
|
||||||
#define ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT() {}
|
#define ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT() {}
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || (defined __DOXYGEN__ && SOC_USB_SERIAL_JTAG_SUPPORTED)
|
||||||
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief initialize console module
|
* @brief initialize console module
|
||||||
@ -304,6 +305,7 @@ struct esp_console_repl_s {
|
|||||||
esp_err_t (*del)(esp_console_repl_t *repl);
|
esp_err_t (*del)(esp_console_repl_t *repl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
/**
|
/**
|
||||||
* @brief Establish a console REPL environment over UART driver
|
* @brief Establish a console REPL environment over UART driver
|
||||||
*
|
*
|
||||||
@ -326,7 +328,9 @@ struct esp_console_repl_s {
|
|||||||
* - ESP_FAIL Parameter error
|
* - ESP_FAIL Parameter error
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl);
|
esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl);
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_USB_CDC || (defined __DOXYGEN__ && SOC_USB_OTG_SUPPORTED)
|
||||||
/**
|
/**
|
||||||
* @brief Establish a console REPL environment over USB CDC
|
* @brief Establish a console REPL environment over USB CDC
|
||||||
*
|
*
|
||||||
@ -347,8 +351,9 @@ esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_con
|
|||||||
* - ESP_FAIL Parameter error
|
* - ESP_FAIL Parameter error
|
||||||
*/
|
*/
|
||||||
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);
|
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);
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC || (defined __DOXYGEN__ && SOC_USB_OTG_SUPPORTED)
|
||||||
|
|
||||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || (defined __DOXYGEN__ && SOC_USB_SERIAL_JTAG_SUPPORTED)
|
||||||
/**
|
/**
|
||||||
* @brief Establish a console REPL (Read-eval-print loop) environment over USB-SERIAL-JTAG
|
* @brief Establish a console REPL (Read-eval-print loop) environment over USB-SERIAL-JTAG
|
||||||
*
|
*
|
||||||
@ -369,7 +374,7 @@ esp_err_t esp_console_new_repl_usb_cdc(const esp_console_dev_usb_cdc_config_t *d
|
|||||||
* - ESP_FAIL Parameter error
|
* - ESP_FAIL Parameter error
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_console_new_repl_usb_serial_jtag(const esp_console_dev_usb_serial_jtag_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl);
|
esp_err_t esp_console_new_repl_usb_serial_jtag(const esp_console_dev_usb_serial_jtag_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl);
|
||||||
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || (defined __DOXYGEN__ && SOC_USB_SERIAL_JTAG_SUPPORTED)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start REPL environment
|
* @brief Start REPL environment
|
||||||
|
@ -47,8 +47,12 @@ typedef struct {
|
|||||||
} esp_console_repl_universal_t;
|
} esp_console_repl_universal_t;
|
||||||
|
|
||||||
static void esp_console_repl_task(void *args);
|
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);
|
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
|
||||||
|
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl);
|
static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl);
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *repl);
|
static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *repl);
|
||||||
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#endif //CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
@ -56,6 +60,7 @@ static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_
|
|||||||
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_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);
|
static esp_err_t esp_console_setup_history(const char *history_path, uint32_t max_history_len, esp_console_repl_com_t *repl_com);
|
||||||
|
|
||||||
|
#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)
|
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)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
@ -119,6 +124,7 @@ _exit:
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
|
|
||||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
esp_err_t esp_console_new_repl_usb_serial_jtag(const esp_console_dev_usb_serial_jtag_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl)
|
esp_err_t esp_console_new_repl_usb_serial_jtag(const esp_console_dev_usb_serial_jtag_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl)
|
||||||
@ -198,6 +204,7 @@ _exit:
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl)
|
esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_config, const esp_console_repl_config_t *repl_config, esp_console_repl_t **ret_repl)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
@ -290,6 +297,7 @@ _exit:
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
|
|
||||||
esp_err_t esp_console_start_repl(esp_console_repl_t *repl)
|
esp_err_t esp_console_start_repl(esp_console_repl_t *repl)
|
||||||
{
|
{
|
||||||
@ -394,6 +402,7 @@ _exit:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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)
|
static esp_err_t esp_console_repl_uart_delete(esp_console_repl_t *repl)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
@ -413,7 +422,9 @@ static esp_err_t esp_console_repl_uart_delete(esp_console_repl_t *repl)
|
|||||||
_exit:
|
_exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
|
|
||||||
|
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl)
|
static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
@ -431,6 +442,7 @@ static esp_err_t esp_console_repl_usb_cdc_delete(esp_console_repl_t *repl)
|
|||||||
_exit:
|
_exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
|
|
||||||
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *repl)
|
static esp_err_t esp_console_repl_usb_serial_jtag_delete(esp_console_repl_t *repl)
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
#error This example is incompatible with USB CDC console. Please try "console_usb" example instead.
|
#error This example is incompatible with USB CDC console. Please try "console_usb" example instead.
|
||||||
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
#endif // CONFIG_ESP_CONSOLE_USB_CDC
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
|
#error This example is incompatible with USB serial JTAG console.
|
||||||
|
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
|
||||||
|
|
||||||
static const char* TAG = "example";
|
static const char* TAG = "example";
|
||||||
#define PROMPT_STR CONFIG_IDF_TARGET
|
#define PROMPT_STR CONFIG_IDF_TARGET
|
||||||
|
|
||||||
|
@ -660,10 +660,24 @@ void app_main(void)
|
|||||||
|
|
||||||
esp_console_repl_t *repl = NULL;
|
esp_console_repl_t *repl = NULL;
|
||||||
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
|
esp_console_repl_config_t repl_config = ESP_CONSOLE_REPL_CONFIG_DEFAULT();
|
||||||
esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
|
|
||||||
repl_config.prompt = "ftm>";
|
repl_config.prompt = "ftm>";
|
||||||
// init console REPL environment
|
|
||||||
|
#if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) || defined(CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||||
|
esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT();
|
||||||
ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl));
|
ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl));
|
||||||
|
|
||||||
|
#elif defined(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));
|
||||||
|
|
||||||
|
#elif defined(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));
|
||||||
|
#else
|
||||||
|
#error Unsupported console type
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Register commands */
|
/* Register commands */
|
||||||
register_system();
|
register_system();
|
||||||
register_wifi();
|
register_wifi();
|
||||||
|
Loading…
Reference in New Issue
Block a user