summaryrefslogtreecommitdiff
path: root/atmel-samd/main.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2017-07-23 15:32:05 -0400
committerScott Shawcroft <scott@tannewt.org>2017-07-23 15:32:05 -0400
commitf91493c97e20eef1d39a9cdc6c42a25cfd511734 (patch)
tree7e7062c9c12220d798cfa154e0729b7cf3e6447b /atmel-samd/main.c
parentaf1ede930ba643d68850c541ef4075d5f7fd4f02 (diff)
Measure and report maximum stack usage. (#175)
Add max stack usage tracking, visible via debug module ustack. Add separate cpp flag for enabling modules: MICROPY_DEBUG_MODULES
Diffstat (limited to 'atmel-samd/main.c')
-rw-r--r--atmel-samd/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index 64b7d8c7f..842dae451 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -581,6 +581,13 @@ int main(void) {
mp_stack_ctrl_init();
mp_stack_set_limit((char*)&_estack - (char*)&_ebss - 1024);
+
+#if MICROPY_MAX_STACK_USAGE
+ // _ezero (same as _ebss) is an int, so start 4 bytes above it.
+ mp_stack_set_bottom(&_ezero + 1);
+ mp_stack_fill_with_sentinel();
+#endif
+
init_flash_fs();
// Reset everything and prep MicroPython to run boot.py.