mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(uart): make custom console uart pins same to the default console uart pins
This commit is contained in:
parent
d3631b3afa
commit
8e53e91ec9
@ -48,8 +48,8 @@ void bootloader_console_init(void)
|
|||||||
|
|
||||||
#if CONFIG_ESP_CONSOLE_UART_CUSTOM
|
#if CONFIG_ESP_CONSOLE_UART_CUSTOM
|
||||||
// Some constants to make the following code less upper-case
|
// Some constants to make the following code less upper-case
|
||||||
const int uart_tx_gpio = CONFIG_ESP_CONSOLE_UART_TX_GPIO;
|
const int uart_tx_gpio = (CONFIG_ESP_CONSOLE_UART_TX_GPIO >= 0) ? CONFIG_ESP_CONSOLE_UART_TX_GPIO : UART_NUM_0_TXD_DIRECT_GPIO_NUM;
|
||||||
const int uart_rx_gpio = CONFIG_ESP_CONSOLE_UART_RX_GPIO;
|
const int uart_rx_gpio = (CONFIG_ESP_CONSOLE_UART_RX_GPIO >= 0) ? CONFIG_ESP_CONSOLE_UART_RX_GPIO : UART_NUM_0_RXD_DIRECT_GPIO_NUM;
|
||||||
|
|
||||||
// Switch to the new UART (this just changes UART number used for esp_rom_printf in ROM code).
|
// Switch to the new UART (this just changes UART number used for esp_rom_printf in ROM code).
|
||||||
esp_rom_output_set_as_console(uart_num);
|
esp_rom_output_set_as_console(uart_num);
|
||||||
|
@ -14,6 +14,7 @@ extern "C" {
|
|||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "soc/uart_channel.h"
|
||||||
|
|
||||||
// Forward declaration. Definition in linenoise/linenoise.h.
|
// Forward declaration. Definition in linenoise/linenoise.h.
|
||||||
typedef struct linenoiseCompletions linenoiseCompletions;
|
typedef struct linenoiseCompletions linenoiseCompletions;
|
||||||
@ -88,8 +89,8 @@ typedef struct {
|
|||||||
{ \
|
{ \
|
||||||
.channel = CONFIG_ESP_CONSOLE_UART_NUM, \
|
.channel = CONFIG_ESP_CONSOLE_UART_NUM, \
|
||||||
.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE, \
|
.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE, \
|
||||||
.tx_gpio_num = CONFIG_ESP_CONSOLE_UART_TX_GPIO, \
|
.tx_gpio_num = (CONFIG_ESP_CONSOLE_UART_TX_GPIO >= 0) ? CONFIG_ESP_CONSOLE_UART_TX_GPIO : UART_NUM_0_TXD_DIRECT_GPIO_NUM, \
|
||||||
.rx_gpio_num = CONFIG_ESP_CONSOLE_UART_RX_GPIO, \
|
.rx_gpio_num = (CONFIG_ESP_CONSOLE_UART_RX_GPIO >= 0) ? CONFIG_ESP_CONSOLE_UART_RX_GPIO : UART_NUM_0_RXD_DIRECT_GPIO_NUM, \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT() \
|
#define ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT() \
|
||||||
|
@ -317,19 +317,20 @@ menu "ESP System Settings"
|
|||||||
config ESP_CONSOLE_UART_TX_GPIO
|
config ESP_CONSOLE_UART_TX_GPIO
|
||||||
int "UART TX on GPIO<num>"
|
int "UART TX on GPIO<num>"
|
||||||
depends on ESP_CONSOLE_UART_CUSTOM
|
depends on ESP_CONSOLE_UART_CUSTOM
|
||||||
range 0 SOC_GPIO_OUT_RANGE_MAX
|
range -1 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
# Specific value for old targets for compatibility. No need to add for new targets.
|
||||||
default 1 if IDF_TARGET_ESP32
|
default 1 if IDF_TARGET_ESP32
|
||||||
|
default 43 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||||
default 20 if IDF_TARGET_ESP32C2
|
default 20 if IDF_TARGET_ESP32C2
|
||||||
default 21 if IDF_TARGET_ESP32C3
|
default 21 if IDF_TARGET_ESP32C3
|
||||||
default 10 if IDF_TARGET_ESP32C5
|
|
||||||
default 16 if IDF_TARGET_ESP32C6
|
default 16 if IDF_TARGET_ESP32C6
|
||||||
default 5 if IDF_TARGET_ESP32C61
|
|
||||||
default 37 if IDF_TARGET_ESP32P4
|
default 37 if IDF_TARGET_ESP32P4
|
||||||
default 24 if IDF_TARGET_ESP32H2
|
default 24 if IDF_TARGET_ESP32H2
|
||||||
default 43
|
default -1
|
||||||
help
|
help
|
||||||
This GPIO is used for console UART TX output in the ESP-IDF Bootloader and the app (including
|
This GPIO is used for console UART TX output in the ESP-IDF Bootloader and the app (including
|
||||||
boot log output and default standard output and standard error of the app).
|
boot log output and default standard output and standard error of the app). Value -1 means to
|
||||||
|
continue using the default console UART TX pin.
|
||||||
|
|
||||||
If the configuration is different in the Bootloader binary compared to the app binary, UART
|
If the configuration is different in the Bootloader binary compared to the app binary, UART
|
||||||
is reconfigured after the bootloader exits and the app starts.
|
is reconfigured after the bootloader exits and the app starts.
|
||||||
@ -337,19 +338,20 @@ menu "ESP System Settings"
|
|||||||
config ESP_CONSOLE_UART_RX_GPIO
|
config ESP_CONSOLE_UART_RX_GPIO
|
||||||
int "UART RX on GPIO<num>"
|
int "UART RX on GPIO<num>"
|
||||||
depends on ESP_CONSOLE_UART_CUSTOM
|
depends on ESP_CONSOLE_UART_CUSTOM
|
||||||
range 0 SOC_GPIO_IN_RANGE_MAX
|
range -1 SOC_GPIO_IN_RANGE_MAX
|
||||||
|
# Specific value for old targets for compatibility. No need to add for new targets.
|
||||||
default 3 if IDF_TARGET_ESP32
|
default 3 if IDF_TARGET_ESP32
|
||||||
|
default 44 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||||
default 19 if IDF_TARGET_ESP32C2
|
default 19 if IDF_TARGET_ESP32C2
|
||||||
default 20 if IDF_TARGET_ESP32C3
|
default 20 if IDF_TARGET_ESP32C3
|
||||||
default 11 if IDF_TARGET_ESP32C5
|
|
||||||
default 17 if IDF_TARGET_ESP32C6
|
default 17 if IDF_TARGET_ESP32C6
|
||||||
default 4 if IDF_TARGET_ESP32C61
|
|
||||||
default 38 if IDF_TARGET_ESP32P4
|
default 38 if IDF_TARGET_ESP32P4
|
||||||
default 23 if IDF_TARGET_ESP32H2
|
default 23 if IDF_TARGET_ESP32H2
|
||||||
default 44
|
default -1
|
||||||
help
|
help
|
||||||
This GPIO is used for UART RX input in the ESP-IDF Bootloader and the app (including
|
This GPIO is used for console UART RX input in the ESP-IDF Bootloader and the app (including
|
||||||
default default standard input of the app).
|
default standard input of the app). Value -1 means to continue using the default console UART
|
||||||
|
RX pin.
|
||||||
|
|
||||||
Note: The default ESP-IDF Bootloader configures this pin but doesn't read anything from the UART.
|
Note: The default ESP-IDF Bootloader configures this pin but doesn't read anything from the UART.
|
||||||
|
|
||||||
|
9
components/soc/linux/include/soc/uart_channel.h
Normal file
9
components/soc/linux/include/soc/uart_channel.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTE: this is a stripped-down copy to support building on host when using mocking (CMock).
|
||||||
|
*/
|
@ -1,9 +1,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# This check script is used to ensure the public APIs won't expose the unstable soc files like register files
|
# This check script is used to ensure the public APIs won't expose the unstable soc files like register files
|
||||||
# public API header files are those taken by doxygen and have full documented docs
|
# public API header files are those taken by doxygen and have full documented docs
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -18,6 +16,7 @@ allowed_soc_headers = (
|
|||||||
'soc/reset_reasons.h',
|
'soc/reset_reasons.h',
|
||||||
'soc/reg_base.h',
|
'soc/reg_base.h',
|
||||||
'soc/clk_tree_defs.h',
|
'soc/clk_tree_defs.h',
|
||||||
|
'soc/uart_channel.h',
|
||||||
)
|
)
|
||||||
|
|
||||||
include_header_pattern = re.compile(r'[\s]*#[\s]*include ["<](.*)[">].*')
|
include_header_pattern = re.compile(r'[\s]*#[\s]*include ["<](.*)[">].*')
|
||||||
|
Loading…
Reference in New Issue
Block a user