summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-12-06 14:24:20 -0800
committerScott Shawcroft <scott@tannewt.org>2018-12-06 14:24:20 -0800
commit6ef863997186e1893cdf19c0e04d0a8a3f33ad9d (patch)
tree461360ed76e39ca0a534a0dee040fc1cf6848d70 /py
parent7ad2e6ace34a6d417ec1b84472fa409d5451137b (diff)
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share. As a result, the nRF52 now has safe mode support as well. The common safe mode adds a 700ms delay at startup where a reset during that window will cause a reset into safe mode. This window is designated by a yellow status pixel and flashing the single led three times. A couple NeoPixel fixes are included for the nRF52 as well. Fixes #1034. Fixes #990. Fixes #615.
Diffstat (limited to 'py')
-rw-r--r--py/obj.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/obj.c b/py/obj.c
index c20b549a3..fb59eec82 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -488,6 +488,8 @@ mp_obj_t mp_obj_subscr(mp_obj_t base, mp_obj_t index, mp_obj_t value) {
mp_obj_type_t *type = mp_obj_get_type(base);
if (type->subscr != NULL) {
mp_obj_t ret = type->subscr(base, index, value);
+ // May have called port specific C code. Make sure it didn't mess up the heap.
+ assert_heap_ok();
if (ret != MP_OBJ_NULL) {
return ret;
}