summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-11-12 10:45:57 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-17 17:48:23 +0000
commit82b5f48862b5d40752cd664890bb7a6e69ab2237 (patch)
treef5bb5b24173721dae4d86d1c70ce13c259244480
parenteacad86212f022cebd52bf68710fc6d2c5ca0680 (diff)
downloadchrome-ec-82b5f48862b5d40752cd664890bb7a6e69ab2237.tar.gz
zephyr: use uart_poll_out() instead of printk
For raw character output, use uart_poll_out() instead of printk(). printk() replaces newline characters with carriage-return and newline, corrupting EFS2 packets. BUG=b:206030442 BRANCH=none TEST=Verify cr50 does not report 0xec03 error (bad CRC) if the current EC RW hash contains 0x0A. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Iecfdff63848a40aaeb5fcba82587320790d73d37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3279841 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/uart_printf.c6
-rw-r--r--zephyr/shim/src/console.c2
2 files changed, 3 insertions, 5 deletions
diff --git a/common/uart_printf.c b/common/uart_printf.c
index ae6f79bf79..198d076971 100644
--- a/common/uart_printf.c
+++ b/common/uart_printf.c
@@ -12,11 +12,9 @@
static int __tx_char(void *context, int c)
{
/*
- * Translate '\n' to '\r\n', bypass on Zephyr because printk also
- * does this translation.
+ * Translate '\n' to '\r\n'.
*/
- if (!IS_ENABLED(CONFIG_ZEPHYR) && c == '\n' &&
- uart_tx_char_raw(context, '\r'))
+ if (c == '\n' && uart_tx_char_raw(context, '\r'))
return 1;
return uart_tx_char_raw(context, c);
}
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index 41e138b50c..5a465b2fd4 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -217,7 +217,7 @@ int uart_tx_char_raw(void *context, int c)
void uart_write_char(char c)
{
- printk("%c", c);
+ uart_poll_out(uart_shell_dev, c);
if (IS_ENABLED(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE))
console_buf_notify_chars(&c, 1);