summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2017-12-01 11:16:58 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-11 15:16:23 -0800
commit0037fb8dfcd7136d40e608ad9973331bd82d9a80 (patch)
tree15677d4993958e2b173675411933f565fead2ff7 /common/system.c
parent665ee232999ab22a9e0a53ddba020e0b1f387fcf (diff)
downloadchrome-ec-0037fb8dfcd7136d40e608ad9973331bd82d9a80.tar.gz
system: Log PC and task id on watchdog
For debug, in common code let's log the watchdog PC and task id as our SW panic params. BUG=chromium:790006 BRANCH=none TEST=manually test scarlet rev2 from a1-a3, b1-b2: (a1) Add 'while(1);' in button ISR (a2) Boot and press the button (a3) When watchdog is triggeried, check with 'panicinfo' that saved R5 is the PC for button ISR. (b1) 'crash watchdog' in EC console (b2) Check with 'panicinfo' that CONSOLE task id is saved in EXCEPTION and PC is saved in R5. Change-Id: I64d2fcf594dd24b0951e002ab8e80ebcac2d1def Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/803618 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/system.c b/common/system.c
index fcd7e0d795..48c26776b9 100644
--- a/common/system.c
+++ b/common/system.c
@@ -788,12 +788,19 @@ void system_common_pre_init(void)
#ifdef CONFIG_SOFTWARE_PANIC
/*
- * Log panic cause if watchdog caused reset. This
- * must happen before calculating jump_data address
- * because it might change panic pointer.
+ * Log panic cause if watchdog caused reset and panic cause
+ * was not already logged. This must happen before calculating
+ * jump_data address because it might change panic pointer.
*/
- if (system_get_reset_flags() & RESET_FLAG_WATCHDOG)
- panic_set_reason(PANIC_SW_WATCHDOG, 0, 0);
+ if (system_get_reset_flags() & RESET_FLAG_WATCHDOG) {
+ uint32_t reason;
+ uint32_t info;
+ uint8_t exception;
+
+ panic_get_reason(&reason, &info, &exception);
+ if (reason != PANIC_SW_WATCHDOG)
+ panic_set_reason(PANIC_SW_WATCHDOG, 0, 0);
+ }
#endif
/*