From 7af4a1cf9a38dd3d144d473b6a4ce05fa2e43e99 Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Thu, 6 Jan 2022 14:08:14 -0700 Subject: zephyr: Add new config to log console msgs Add new config CONFIG_PLATFORM_EC_CONSOLE_DEBUG, which if enabled will log all zephyr_print() messages (generally console logs), to printk also. Enable CONFIG_PLATFORM_EC_CONSOLE_DEBUG in drivers test. BRANCH=None BUG=None TEST=zmake -l DEBUG -j 1 configure --test zephyr/test/drivers Signed-off-by: Jeremy Bettis Change-Id: I18c179ecdb90998a57c67ff71ef7369015de623c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3370950 Tested-by: Jeremy Bettis Auto-Submit: Jeremy Bettis Reviewed-by: Abe Levkoy Commit-Queue: Abe Levkoy --- zephyr/Kconfig.console | 9 +++++++++ zephyr/shim/src/console.c | 2 ++ zephyr/test/drivers/prj.conf | 1 + 3 files changed, 12 insertions(+) (limited to 'zephyr') diff --git a/zephyr/Kconfig.console b/zephyr/Kconfig.console index 809c03c1e0..a8c2a9c22a 100644 --- a/zephyr/Kconfig.console +++ b/zephyr/Kconfig.console @@ -53,3 +53,12 @@ config PLATFORM_EC_HOSTCMD_CONSOLE_BUF_SIZE modular arithmetic is used. endif # PLATFORM_EC_HOSTCMD_CONSOLE + +menuconfig PLATFORM_EC_CONSOLE_DEBUG + bool "Console Debug" + depends on CONSOLE + default n + help + Write all zephyr_print() messages to printk() also. Not recommended + outside of tests. + diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index f8b2af8125..6b8267935a 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -278,6 +278,8 @@ static void zephyr_print(const char *buff, size_t size) shell_fprintf(shell_zephyr, SHELL_NORMAL, "%s", buff); if (IS_ENABLED(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE)) console_buf_notify_chars(buff, size); + if (IS_ENABLED(CONFIG_PLATFORM_EC_CONSOLE_DEBUG)) + printk("%s", buff); } } diff --git a/zephyr/test/drivers/prj.conf b/zephyr/test/drivers/prj.conf index fbfaac9171..2b069499a8 100644 --- a/zephyr/test/drivers/prj.conf +++ b/zephyr/test/drivers/prj.conf @@ -18,6 +18,7 @@ CONFIG_EXCEPTION_STACK_TRACE=y CONFIG_DEBUG=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_OPTIMIZATIONS=y +CONFIG_PLATFORM_EC_CONSOLE_DEBUG=y CONFIG_PLATFORM_EC=y CONFIG_CROS_EC=y -- cgit v1.2.1