Add safety flag for debugbuild

This commit is contained in:
Mario Hüttel 2020-07-28 23:29:35 +02:00
parent 6498aaf8b8
commit 6c4b698fd7
2 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,7 @@ enum safety_flag {
ERR_FLAG_SYSTICK = (1<<10), ERR_FLAG_SYSTICK = (1<<10),
ERR_FLAG_WTCHDG_FIRED = (1<<11), ERR_FLAG_WTCHDG_FIRED = (1<<11),
ERR_FLAG_UNCAL = (1<<12), ERR_FLAG_UNCAL = (1<<12),
ERR_FLAG_DEBUG = (1<<13),
}; };
enum timing_monitor { enum timing_monitor {

View File

@ -85,6 +85,7 @@ static volatile struct error_flag flags[] = {
ERR_FLAG_ENTRY(ERR_FLAG_SYSTICK, true), ERR_FLAG_ENTRY(ERR_FLAG_SYSTICK, true),
ERR_FLAG_ENTRY(ERR_FLAG_WTCHDG_FIRED, true), ERR_FLAG_ENTRY(ERR_FLAG_WTCHDG_FIRED, true),
ERR_FLAG_ENTRY(ERR_FLAG_UNCAL, false), ERR_FLAG_ENTRY(ERR_FLAG_UNCAL, false),
ERR_FLAG_ENTRY(ERR_FLAG_DEBUG, true),
}; };
static volatile struct timing_mon timings[] = { static volatile struct timing_mon timings[] = {
@ -248,6 +249,10 @@ void safety_controller_init()
if (watchdog_check_reset_source()) if (watchdog_check_reset_source())
safety_controller_report_error(ERR_FLAG_WTCHDG_FIRED); safety_controller_report_error(ERR_FLAG_WTCHDG_FIRED);
#ifdef DEBUGBUILD
safety_controller_report_error(ERR_FLAG_DEBUG);
#endif
} }
static void safety_controller_check_stack() static void safety_controller_check_stack()