Merge branch 'contrib/github_pr_18677_v5.3' into 'release/v5.3'

fix(uart): fix threshold configuration loss when interrupts are disabled (v5.3)

See merge request espressif/esp-idf!50527
This commit is contained in:
morris
2026-07-15 11:59:15 +08:00
4 changed files with 10 additions and 9 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -54,8 +54,9 @@ void bootloader_console_init(void)
const int uart_tx_gpio = CONFIG_ESP_CONSOLE_UART_TX_GPIO;
const int uart_rx_gpio = CONFIG_ESP_CONSOLE_UART_RX_GPIO;
// 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);
// Switch to the new UART
esp_rom_output_set_as_console(uart_num); // changes UART number used for esp_rom_printf in ROM code
esp_rom_output_switch_buffer(uart_num);
// If console is attached to UART1 or if non-default pins are used,
// need to reconfigure pins using GPIO matrix
+2 -6
View File
@@ -2074,9 +2074,7 @@ esp_err_t uart_set_rx_full_threshold(uart_port_t uart_num, int threshold)
return ESP_ERR_INVALID_STATE;
}
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
if (uart_hal_get_intr_ena_status(&(uart_context[uart_num].hal)) & UART_INTR_RXFIFO_FULL) {
uart_hal_set_rxfifo_full_thr(&(uart_context[uart_num].hal), threshold);
}
uart_hal_set_rxfifo_full_thr(&(uart_context[uart_num].hal), threshold);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
@@ -2091,9 +2089,7 @@ esp_err_t uart_set_tx_empty_threshold(uart_port_t uart_num, int threshold)
return ESP_ERR_INVALID_STATE;
}
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
if (uart_hal_get_intr_ena_status(&(uart_context[uart_num].hal)) & UART_INTR_TXFIFO_EMPTY) {
uart_hal_set_txfifo_empty_thr(&(uart_context[uart_num].hal), threshold);
}
uart_hal_set_txfifo_empty_thr(&(uart_context[uart_num].hal), threshold);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
+3
View File
@@ -233,6 +233,9 @@ void IRAM_ATTR call_start_cpu1(void)
#elif !CONFIG_ESP_CONSOLE_USB_CDC
esp_rom_install_uart_printf();
esp_rom_output_set_as_console(CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM);
#if CONFIG_ESP_CONSOLE_UART_CUSTOM
esp_rom_output_switch_buffer(CONFIG_ESP_CONSOLE_UART_NUM);
#endif
#endif
#if CONFIG_IDF_TARGET_ESP32