From d47905ce270b5934a2e8952a64bcc316fd27fda0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 3 Jun 2012 11:03:57 -0700 Subject: Make ASSERT() report assertion failures Rather than just reset the board, report assertion failures to aid debugging. To enable this, use CONFIG_ASSERT_HELP. BUG=chrome-os-partner:10149 TEST=manual Enable the option for snow, add a failing ASSERT() to the rw command and see the a nice message is printed now. ASSERTION FAILURE 'address' in command_read_word() at common/memory_commands.c:00000037 Change-Id: Ice59434c5daf610832dd0e1fcfa5630dc847bb67 Signed-off-by: Simon Glass Reviewed-on: https://gerrit.chromium.org/gerrit/25411 --- core/cortex-m/panic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/cortex-m/panic.c') diff --git a/core/cortex-m/panic.c b/core/cortex-m/panic.c index d249974b06..1c9629eff3 100644 --- a/core/cortex-m/panic.c +++ b/core/cortex-m/panic.c @@ -360,3 +360,15 @@ void exception_panic(void) [save_area] "r" (save_area.saved_regs) ); } + + +#ifdef CONFIG_ASSERT_HELP +void panic_assert_fail(const char *msg, const char *func, const char *fname, + int linenum) +{ + panic_printf("\nASSERTION FAILURE '%s' in %s() at %s:%d\n", msg, func, + fname, linenum); + + panic_reboot(); +} +#endif -- cgit v1.2.1