summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-23 17:42:58 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-23 17:42:58 +0100
commit0d31bbc7fa3bdf10a14d92bb010a5016dc6101af (patch)
treee52f414a3cb0a69d8e610a14f08cb80638d9dbc2
parented56b0baba47e4d0697fdc2d81310a9a2c34c5df (diff)
stmhal: Make pendsv variable non-static so gcc-5 doesn't opt it away.
-rw-r--r--stmhal/pendsv.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/stmhal/pendsv.c b/stmhal/pendsv.c
index 48fb79e20..5f5603f35 100644
--- a/stmhal/pendsv.c
+++ b/stmhal/pendsv.c
@@ -31,10 +31,12 @@
#include "py/runtime.h"
#include "pendsv.h"
-// Note: this can contain point to the heap but is not traced by GC.
-// This is okay because we only ever set it to mp_const_vcp_interrupt
-// which is in the root-pointer set.
-STATIC void *pendsv_object;
+// This variable is used to save the exception object between a ctrl-C and the
+// PENDSV call that actually raises the exception. It must be non-static
+// otherwise gcc-5 optimises it away. It can point to the heap but is not
+// traced by GC. This is okay because we only ever set it to
+// mp_const_vcp_interrupt which is in the root-pointer set.
+void *pendsv_object;
void pendsv_init(void) {
// set PendSV interrupt at lowest priority