diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2023-10-16 10:35:22 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-24 17:05:24 -0400 |
commit | 35dc728a3cd14338b5fa0b6f231aa555077c98a1 (patch) | |
tree | 59ad3b6c3df52508641f485591d5af5029b02d9a /common/Kconfig | |
parent | 1000e2f96b582a69366f61a71d747c8ee9eb1cab (diff) | |
download | u-boot-35dc728a3cd14338b5fa0b6f231aa555077c98a1.tar.gz u-boot-35dc728a3cd14338b5fa0b6f231aa555077c98a1.tar.bz2 u-boot-35dc728a3cd14338b5fa0b6f231aa555077c98a1.zip |
serial: introduce CONFIG_CONSOLE_FLUSH_ON_NEWLINE
When debugging, one sometimes only gets partial output lines or
nothing at all from the last printf, because the uart has a largish
buffer, and the code after the printf() may cause the CPU to hang
before the uart IP has time to actually emit all the characters. That
can be very confusing, because one doesn't then know exactly where the
hang happens.
Introduce a config knob allowing one to wait for the uart fifo to
drain whenever a newline character is printed, roughly corresponding
to the effect of setvbuf(..., _IOLBF, ...) in ordinary C programs.
Since this uses IS_ENABLED() instead of cpp ifdef, we can remove the
ifdef around the _serial_flush() definition - if neither
CONSOLE_FLUSH_SUPPORT or CONSOLE_FLUSH_ON_NEWLINE are enabled, the
compiler elides _serial_flush(), but it won't warn about it being
unused.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/Kconfig')
-rw-r--r-- | common/Kconfig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/Kconfig b/common/Kconfig index 93c96f23b0..43701fe9e8 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -224,6 +224,16 @@ config CONSOLE_FLUSH_SUPPORT help This enables compilation of flush() function for console flush support. +config CONSOLE_FLUSH_ON_NEWLINE + bool "Flush console buffer on every newline character" + depends on DM_SERIAL + help + This makes the serial core code flush the console device + whenever a newline (\n) character has been emitted. This can + be especially useful when "printf debugging", as otherwise + lots of output could still be in the UART's FIFO by the time + one hits the code which causes the CPU to hang or reset. + config CONSOLE_MUX bool "Enable console multiplexing" default y if VIDEO || LCD |