Commit 9336a054 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

check_stack: use assert, now that we have it

This also allows to see how assert behaves (and verify it works):

    wrc# devmem 1d800 0
    Assertion failed (check_stack:18): Stack overflow! (0)
    Assertion failed (check_stack:18): Stack overflow! (0)
    [...]
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent c0c7f85c
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Released according to the GNU GPL, version 2 or any later version. * Released according to the GNU GPL, version 2 or any later version.
*/ */
#include <wrc.h> #include <wrc.h>
#include <assert.h>
#include "system_checks.h" #include "system_checks.h"
...@@ -14,11 +15,7 @@ extern void _reset_handler(void); /* user to reset again */ ...@@ -14,11 +15,7 @@ extern void _reset_handler(void); /* user to reset again */
void check_stack(void) void check_stack(void)
{ {
/* print "Stack overflow!" forever if stack corrupted */ assert(_endram == ENDRAM_MAGIC, "Stack overflow! (%x)\n", _endram);
while (_endram != ENDRAM_MAGIC) {
pp_printf("Stack overflow!\n");
timer_delay_ms(1000);
}
} }
#ifdef CONFIG_CHECK_RESET #ifdef CONFIG_CHECK_RESET
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment