Skip to content

Commit

Permalink
stmhal: Make pendsv variable non-static so gcc-5 doesn't opt it away.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed May 23, 2015
1 parent ed56b0b commit 0d31bbc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions stmhal/pendsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d31bbc

Please sign in to comment.