added ability to check stack pointer from an ISR
diff --git a/src/part2/examples/local/runtime/utils/Stack.c b/src/part2/examples/local/runtime/utils/Stack.c
index 67a5f55..8726f07 100644
--- a/src/part2/examples/local/runtime/utils/Stack.c
+++ b/src/part2/examples/local/runtime/utils/Stack.c
@@ -35,6 +35,14 @@
}
/*
+ * ======== Stack_check ========
+ */
+Bool Stack_check(void)
+{
+ Int sp;
+ return (&sp > &_stack);
+}
+/*
* ======== Stack_fill ========
*/
Void Stack_fill(void)
diff --git a/src/part2/examples/local/runtime/utils/Stack.xdc b/src/part2/examples/local/runtime/utils/Stack.xdc
index 386553c..0df5e86 100644
--- a/src/part2/examples/local/runtime/utils/Stack.xdc
+++ b/src/part2/examples/local/runtime/utils/Stack.xdc
@@ -28,6 +28,16 @@
};
/*!
+ * ======== check ========
+ * Return non-zero is stack pointer is within allocated stack
+ *
+ * If this function returns 0, the current stack pointer is pointing
+ * to a location _outside_ the caller's allocated stack.
+ */
+ @DirectCall
+ Bool check();
+
+ /*!
* ======== fill ========
* Fill unused stack with initial value
*