Skip to content

Commit 0d31bbc

Browse files
committed
stmhal: Make pendsv variable non-static so gcc-5 doesn't opt it away.
1 parent ed56b0b commit 0d31bbc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

stmhal/pendsv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
#include "py/runtime.h"
3232
#include "pendsv.h"
3333

34-
// Note: this can contain point to the heap but is not traced by GC.
35-
// This is okay because we only ever set it to mp_const_vcp_interrupt
36-
// which is in the root-pointer set.
37-
STATIC void *pendsv_object;
34+
// This variable is used to save the exception object between a ctrl-C and the
35+
// PENDSV call that actually raises the exception. It must be non-static
36+
// otherwise gcc-5 optimises it away. It can point to the heap but is not
37+
// traced by GC. This is okay because we only ever set it to
38+
// mp_const_vcp_interrupt which is in the root-pointer set.
39+
void *pendsv_object;
3840

3941
void pendsv_init(void) {
4042
// set PendSV interrupt at lowest priority

0 commit comments

Comments
 (0)