summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/panic.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-07-08 11:40:56 -0600
committerCommit Bot <commit-bot@chromium.org>2021-07-08 19:29:55 +0000
commitc903c31711f3b2f4370a599b251a61586b3c066e (patch)
treef008b3a880c88927a0cd30e244f3649349b7edd7 /zephyr/shim/src/panic.c
parent5f05f752509df4762ce99aab9ed46d1a37e1b76a (diff)
downloadchrome-ec-c903c31711f3b2f4370a599b251a61586b3c066e.tar.gz
zephyr: panic: Clean-up panic printing
If CONFIG_LOG is enabled we can let the default handler print the panic information. It is much more detailed. BRANCH=none BUG=b:180422087 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Idefa9992aad7d69b8aa01394a5b509e592809e8b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015239 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr/shim/src/panic.c')
-rw-r--r--zephyr/shim/src/panic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/zephyr/shim/src/panic.c b/zephyr/shim/src/panic.c
index 91d08c3bb0..7fa401c3b1 100644
--- a/zephyr/shim/src/panic.c
+++ b/zephyr/shim/src/panic.c
@@ -59,6 +59,12 @@ static uint32_t placeholder_info_reg;
#define PANIC_PRINT_REGS(esf_field, pdata_field, human_name) \
panic_printf(" %-8s = 0x%08X\n", #human_name, pdata->pdata_field);
+void panic_data_print(const struct panic_data *pdata)
+{
+ PANIC_REG_LIST(PANIC_PRINT_REGS);
+}
+
+#ifndef CONFIG_LOG
static void copy_esf_to_panic_data(const z_arch_esf_t *esf,
struct panic_data *pdata)
{
@@ -72,11 +78,6 @@ static void copy_esf_to_panic_data(const z_arch_esf_t *esf,
PANIC_REG_LIST(PANIC_COPY_REGS);
}
-void panic_data_print(const struct panic_data *pdata)
-{
- PANIC_REG_LIST(PANIC_PRINT_REGS);
-}
-
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
{
panic_printf("Fatal error: %u\n", reason);
@@ -90,6 +91,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
k_fatal_halt(reason);
CODE_UNREACHABLE;
}
+#endif /* CONFIG_LOG */
#ifdef CONFIG_PLATFORM_EC_SOFTWARE_PANIC
void panic_set_reason(uint32_t reason, uint32_t info, uint8_t exception)