From 953a81a1943d916f949ac83194c9fcf2c3632524 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Wed, 14 Nov 2018 11:19:24 -0800 Subject: [PATCH] esp32: Enable an early-boot printk hook The firmware starts us with an already-initialized UART and a simple ROM hook. Use that as the default printk handler so we can log in very early boot. It will be overriden later (as it happens, by another handler based on the same firmware hooks). Signed-off-by: Andy Ross --- soc/xtensa/esp32/soc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/soc/xtensa/esp32/soc.c b/soc/xtensa/esp32/soc.c index 63ad645181a..afe5caa296f 100644 --- a/soc/xtensa/esp32/soc.c +++ b/soc/xtensa/esp32/soc.c @@ -74,3 +74,13 @@ void __attribute__((section(".iram1"))) __start(void) CODE_UNREACHABLE; } + +/* Boot-time static default printk handler, possibly to be overriden later. */ +int z_arch_printk_char_out(int c) +{ + if (c == '\n') { + esp32_rom_uart_tx_one_char('\r'); + } + esp32_rom_uart_tx_one_char(c); + return 0; +}