From 7962f8e5015e54a3d446069a5e33b759c53855ae Mon Sep 17 00:00:00 2001 From: rusefillc Date: Fri, 5 Feb 2021 23:41:26 -0500 Subject: [PATCH] reducing code duplication --- firmware/config/chconf_common.h | 10 ++++++++++ firmware/config/stm32f4ems/chconf.h | 10 ---------- firmware/config/stm32f7ems/chconf.h | 10 ---------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/firmware/config/chconf_common.h b/firmware/config/chconf_common.h index 69bac56ebf..a6b33e2322 100644 --- a/firmware/config/chconf_common.h +++ b/firmware/config/chconf_common.h @@ -112,4 +112,14 @@ extern "C" { irqExitHook(); \ } +/** + * declared as a macro so that this code does not use stack + * so that it would not crash the error handler in case of stack issues + */ +#if CH_DBG_SYSTEM_STATE_CHECK +#define hasOsPanicError() (ch.dbg.panic_msg != NULL) +#else +#define hasOsPanicError() (FALSE) +#endif + #endif /* CONFIG_CHCONF_COMMON_H_ */ diff --git a/firmware/config/stm32f4ems/chconf.h b/firmware/config/stm32f4ems/chconf.h index 187167d7e2..57cea7a7e2 100644 --- a/firmware/config/stm32f4ems/chconf.h +++ b/firmware/config/stm32f4ems/chconf.h @@ -758,16 +758,6 @@ extern "C" void chDbgPanic3(const char *msg, const char * file, int line); #endif -/** - * declared as a macro so that this code does not use stack - * so that it would not crash the error handler in case of stack issues - */ -#if CH_DBG_SYSTEM_STATE_CHECK -#define hasOsPanicError() (ch.dbg.panic_msg != NULL) -#else -#define hasOsPanicError() (FALSE) -#endif - #define chDbgAssert(c, remark) do { \ if (CH_DBG_ENABLE_ASSERTS != FALSE) { \ diff --git a/firmware/config/stm32f7ems/chconf.h b/firmware/config/stm32f7ems/chconf.h index be895edc55..3badf19966 100644 --- a/firmware/config/stm32f7ems/chconf.h +++ b/firmware/config/stm32f7ems/chconf.h @@ -760,16 +760,6 @@ extern "C" void chDbgPanic3(const char *msg, const char * file, int line); #endif -/** - * declared as a macro so that this code does not use stack - * so that it would not crash the error handler in case of stack issues - */ -#if CH_DBG_SYSTEM_STATE_CHECK -#define hasOsPanicError() (ch.dbg.panic_msg != NULL) -#else -#define hasOsPanicError() (FALSE) -#endif - #define chDbgAssert(c, remark) do { \ if (CH_DBG_ENABLE_ASSERTS != FALSE) { \