summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/include/dbgcheck.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/firmware/include/dbgcheck.h b/firmware/include/dbgcheck.h
new file mode 100644
index 0000000000..e1f7aefbdb
--- /dev/null
+++ b/firmware/include/dbgcheck.h
@@ -0,0 +1,24 @@
+#ifndef __DBGCHECK_H__
+#define __DBGCHECK_H__
+
+#include <stdbool.h>
+
+#ifdef DEBUG
+ #ifndef SIMULATOR
+ /* check whether a function is inside the valid memory location */
+ #define IS_FUNCPTR(fp) ({/
+ extern char _text[];/
+ extern char _etext[];/
+ ((((char *)(fp)) >= _text) && (((char *)(fp)) < _etext)/
+ })
+ #else
+ /* check whether a function is inside the valid memory location */
+ #define IS_FUNCPTR(fp) (((char*)(fp)) != NULL)
+ #endif
+#else
+ /* check whether a function is inside the valid memory location */
+ #define IS_FUNCPRT (fp) true
+#endif
+
+
+#endif // #ifndef __DBGCHECK_H__ \ No newline at end of file