-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Update UART selection for Boot ROM ets_putc, when debug port is selected. #6489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update UART selection for Boot ROM ets_putc, when debug port is selected. #6489
Conversation
::printf, ets_printf_P in core_esp_postmortem.cpp and others. ets_putc is a wrapper for uart_tx_one_char. uart_tx_one_char uses the element buff_uart_no in UartDev (A structure in data area of the Boot ROM) to select UART0 or UART1. uart_buff_switch is used to set that entry. The structure for UartDev can be found in uart.h from the ESP8266_NONOS_SDK. As best I can tell the Boot ROM always defaults to UART0.
Sorry - I need to rethink the placement of this call. I am now thinking it should be in function |
This addresses an issue of UART selection for ROM function ets_putc, which is used by ::printf, ets_printf_P in core_esp_postmortem.cpp and others. Currently ets_putc stays on UART0 after Serial1.setDebugOutput(true) is called. ets_putc() is not affected by calls to ets_install_putc1. Its UART selection is controlled by the ROM function uart_buff_switch. Updated uart_set_debug() to call uart_buff_switch whenever debug is enabled on an UART. For the case of disabling, a call to select UART0 is made, because there is no disable option for this print method.
Fixes debug UART selection for ets_putc This addresses an issue of UART selection for ROM function ets_putc,
Updated |
…/Arduino into pr_uart_select_for_ets_putc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and thanks for the plentiful comments explaining the logic behind things!
Replaced relevent usage of `(void *)` with `fn_putc1_t`. Correct usage of `ets_putc()`, returning 0, in libc_replacement.cpp This PR assumes PR esp8266#6489 (comment) has merged and removes `uart_buff_switch` from `umm_performance.cpp` Updated method of defining `_rom_putc1` to be more acceptable (I hope) to the new compiler.
* Add typedef for putc1, fn_putc1_t. Replaced relevant usage of `(void *)` with `fn_putc1_t`. Correct usage of `ets_putc()`, returning 0, in libc_replacement.cpp This PR assumes PR #6489 (comment) has merged and removes `uart_buff_switch` from `umm_performance.cpp` Updated method of defining `_rom_putc1` to be more acceptable (I hope) to the new compiler. * Use PROVIDE to expose ROM function entry point, ets_uart_putc1. Added comments to ets_putc() and ets_uart_putc1() to explain their differences. Change prototype of ets_putc() to conform with fp_putc_t. Updated _isr_safe_printf_P to use new definition, ets_uart_putc1.
Add code to select the UART for Boot ROM
ets_putc
which is used by::printf
,ets_printf_P
incore_esp_postmortem.cpp
and others.This only applies to a debug build where Debug Port has been selected.
ets_putc
is a wrapper foruart_tx_one_char
.uart_tx_one_char
usesthe element
buff_uart_no
inUartDev
(A structure in the data area of theBoot ROM) to select UART0 or UART1. uart_buff_switch is used to set
that entry.
The structure for
UartDev
can be found inuart.h
from theESP8266_NONOS_SDK. As best I can tell the Boot ROM always
defaults to UART0.