mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
feat(esp8266): Add config to choose console UART none
This commit is contained in:
@ -568,7 +568,7 @@ static void update_flash_config(const esp_image_header_t* pfhdr);
|
|||||||
|
|
||||||
static void uart_console_configure(void)
|
static void uart_console_configure(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_CONSOLE_UART_SWAP_IO
|
#if CONFIG_UART0_SWAP_IO
|
||||||
while (READ_PERI_REG(UART_STATUS(0)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S));
|
while (READ_PERI_REG(UART_STATUS(0)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S));
|
||||||
|
|
||||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_UART0_CTS);
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_UART0_CTS);
|
||||||
@ -595,7 +595,9 @@ static void uart_console_configure(void)
|
|||||||
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
CLEAR_PERI_REG_MASK(UART_CONF0(CONFIG_CONSOLE_UART_NUM), UART_RXFIFO_RST | UART_TXFIFO_RST);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CONSOLE_UART_BAUDRATE
|
||||||
uart_div_modify(CONFIG_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_CONSOLE_UART_BAUDRATE);
|
uart_div_modify(CONFIG_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_CONSOLE_UART_BAUDRATE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t bootloader_init()
|
esp_err_t bootloader_init()
|
||||||
|
@ -81,8 +81,27 @@ config SOC_IRAM_SIZE
|
|||||||
default 0x8000 if SOC_FULL_ICACHE
|
default 0x8000 if SOC_FULL_ICACHE
|
||||||
default 0xC000 if !SOC_FULL_ICACHE
|
default 0xC000 if !SOC_FULL_ICACHE
|
||||||
|
|
||||||
|
choice CONSOLE_UART
|
||||||
|
prompt "UART for console output"
|
||||||
|
default CONSOLE_UART_DEFAULT
|
||||||
|
help
|
||||||
|
Select whether to use UART for console output (through stdout and stderr).
|
||||||
|
|
||||||
|
- Default is to use UART0.
|
||||||
|
- If "Custom" is selected, UART0 or UART1 can be chosen.
|
||||||
|
- If "None" is selected, there will be no console output on any UART.
|
||||||
|
|
||||||
|
config CONSOLE_UART_DEFAULT
|
||||||
|
bool "Default: UART0"
|
||||||
|
config CONSOLE_UART_CUSTOM
|
||||||
|
bool "Custom"
|
||||||
|
config CONSOLE_UART_NONE
|
||||||
|
bool "None"
|
||||||
|
endchoice
|
||||||
|
|
||||||
choice CONSOLE_UART_NUM
|
choice CONSOLE_UART_NUM
|
||||||
prompt "UART peripheral to use for console output (0-1)"
|
prompt "UART peripheral to use for console output (0-1)"
|
||||||
|
depends on CONSOLE_UART_CUSTOM
|
||||||
default CONSOLE_UART_CUSTOM_NUM_0
|
default CONSOLE_UART_CUSTOM_NUM_0
|
||||||
help
|
help
|
||||||
Configrate output console UART for "ets_printf", "printf", "ESP_LOGX" and so on.
|
Configrate output console UART for "ets_printf", "printf", "ESP_LOGX" and so on.
|
||||||
@ -95,15 +114,17 @@ endchoice
|
|||||||
|
|
||||||
config CONSOLE_UART_NUM
|
config CONSOLE_UART_NUM
|
||||||
int
|
int
|
||||||
|
default 0 if CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE
|
||||||
default 0 if CONSOLE_UART_CUSTOM_NUM_0
|
default 0 if CONSOLE_UART_CUSTOM_NUM_0
|
||||||
default 1 if CONSOLE_UART_CUSTOM_NUM_1
|
default 1 if CONSOLE_UART_CUSTOM_NUM_1
|
||||||
|
|
||||||
config CONSOLE_UART_BAUDRATE
|
config CONSOLE_UART_BAUDRATE
|
||||||
int "UART console baud rate"
|
int "UART console baud rate"
|
||||||
|
depends on CONSOLE_UART_DEFAULT || CONSOLE_UART_NONE
|
||||||
default 74880
|
default 74880
|
||||||
range 1200 4000000
|
range 1200 4000000
|
||||||
|
|
||||||
config CONSOLE_UART_SWAP_IO
|
config UART0_SWAP_IO
|
||||||
bool "Swap UART0 I/O pins"
|
bool "Swap UART0 I/O pins"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "esp8266/uart_register.h"
|
#include "esp8266/uart_register.h"
|
||||||
#include "esp8266/rom_functions.h"
|
#include "esp8266/rom_functions.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_CONSOLE_UART_NONE
|
||||||
static void uart_putc(int c)
|
static void uart_putc(int c)
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -34,8 +35,11 @@ static void uart_putc(int c)
|
|||||||
|
|
||||||
WRITE_PERI_REG(UART_FIFO(CONFIG_CONSOLE_UART_NUM) , c);
|
WRITE_PERI_REG(UART_FIFO(CONFIG_CONSOLE_UART_NUM) , c);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define uart_putc(_c) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
int ets_putc(int c)
|
int __attribute__ ((weak)) ets_putc(int c)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
#ifdef CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
|
@ -69,6 +69,11 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t *init_data, esp_phy_calibrat
|
|||||||
esp_err_t status = ESP_OK;
|
esp_err_t status = ESP_OK;
|
||||||
uint8_t sta_mac[6];
|
uint8_t sta_mac[6];
|
||||||
uint8_t *local_init_data = calloc(1, 256);
|
uint8_t *local_init_data = calloc(1, 256);
|
||||||
|
#ifdef CONFIG_CONSOLE_UART_BAUDRATE
|
||||||
|
const uint32_t uart_baudrate = CONFIG_CONSOLE_UART_BAUDRATE;
|
||||||
|
#else
|
||||||
|
const uint32_t uart_baudrate = 74880; // ROM default baudrate
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpy(local_init_data, init_data->params, 128);
|
memcpy(local_init_data, init_data->params, 128);
|
||||||
|
|
||||||
@ -84,7 +89,7 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t *init_data, esp_phy_calibrat
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp_efuse_mac_get_default(sta_mac);
|
esp_efuse_mac_get_default(sta_mac);
|
||||||
chip_init(local_init_data, sta_mac, CONFIG_CONSOLE_UART_BAUDRATE);
|
chip_init(local_init_data, sta_mac, uart_baudrate);
|
||||||
get_data_from_rtc((uint8_t *)calibration_data);
|
get_data_from_rtc((uint8_t *)calibration_data);
|
||||||
|
|
||||||
memcpy(rx_gain_dc_table, calibration_data->rx_gain_dc_table, 4 * 125);
|
memcpy(rx_gain_dc_table, calibration_data->rx_gain_dc_table, 4 * 125);
|
||||||
|
Reference in New Issue
Block a user