diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-03-08 15:29:14 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-03-12 11:18:26 -0700 |
| commit | 03be42ab847f04a89d207d98fdb28048cfedf72d (patch) | |
| tree | 918df321648fc6715eee60ddf926d5dc7ee58bfe /supervisor | |
| parent | ef4a74e201e852a32e2e1be73ed9ba85c88fb3f4 (diff) | |
Enter safe mode when an allocation is attempted on an uninitialized heap.
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/safe_mode.c | 4 | ||||
| -rw-r--r-- | supervisor/shared/safe_mode.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index c1ce1fc9c..3bb75b897 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -105,7 +105,7 @@ void print_safe_mode_message(safe_mode_t reason) { if (reason != NO_SAFE_MODE) { serial_write("\r\n"); serial_write_compressed(translate("You are running in safe mode which means something unanticipated happened.\n")); - if (reason == HARD_CRASH || reason == MICROPY_NLR_JUMP_FAIL || reason == MICROPY_FATAL_ERROR) { + if (reason == HARD_CRASH || reason == MICROPY_NLR_JUMP_FAIL || reason == MICROPY_FATAL_ERROR || reason == GC_ALLOC_OUTSIDE_VM) { serial_write_compressed(translate("Looks like our core CircuitPython code crashed hard. Whoops!\nPlease file an issue at https://github.com/adafruit/circuitpython/issues\n with the contents of your CIRCUITPY drive and this message:\n")); if (reason == HARD_CRASH) { serial_write_compressed(translate("Crash into the HardFault_Handler.\n")); @@ -113,6 +113,8 @@ void print_safe_mode_message(safe_mode_t reason) { serial_write_compressed(translate("MicroPython NLR jump failed. Likely memory corruption.\n")); } else if (reason == MICROPY_FATAL_ERROR) { serial_write_compressed(translate("MicroPython fatal error.\n")); + } else if (reason == GC_ALLOC_OUTSIDE_VM) { + serial_write_compressed(translate("Attempted heap allocation when MicroPython VM not running.\n")); } } else if (reason == BROWNOUT) { serial_write_compressed(translate("The microcontroller's power dipped. Please make sure your power supply provides\nenough power for the whole circuit and press reset (after ejecting CIRCUITPY).\n")); diff --git a/supervisor/shared/safe_mode.h b/supervisor/shared/safe_mode.h index eba2668ac..59480b55b 100644 --- a/supervisor/shared/safe_mode.h +++ b/supervisor/shared/safe_mode.h @@ -35,7 +35,8 @@ typedef enum { HEAP_OVERWRITTEN, MANUAL_SAFE_MODE, MICROPY_NLR_JUMP_FAIL, - MICROPY_FATAL_ERROR + MICROPY_FATAL_ERROR, + GC_ALLOC_OUTSIDE_VM } safe_mode_t; safe_mode_t wait_for_safe_mode_reset(void); |
