summaryrefslogtreecommitdiff
path: root/stmhal/main.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-01-29 01:05:53 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-01-29 02:13:42 +0200
commitd3b1f0b627ccc6705d9fe958549badb87a74ded1 (patch)
treeccc7d03e2f5cd00bb022f70093ca99915715ba42 /stmhal/main.c
parent850212203a97754bdaf1844b71c8fe8ee905236f (diff)
py/runtime: mp_stack_ctrl_init() should be called immediately on startup.
Calling it from mp_init() is too late for some ports (like Unix), and leads to incomplete stack frame being captured, with following GC issues. So, now each port should call mp_stack_ctrl_init() on its own, ASAP after startup, and taking special precautions so it really was called before stack variables get allocated (because if such variable with a pointer is missed, it may lead to over-collecting (typical symptom is segfaulting)).
Diffstat (limited to 'stmhal/main.c')
-rw-r--r--stmhal/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index cce114605..0e5fc44af 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -335,6 +335,7 @@ int main(void) {
// Stack limit should be less than real stack size, so we have a chance
// to recover from limit hit. (Limit is measured in bytes.)
+ mp_stack_ctrl_init();
mp_stack_set_limit((char*)&_ram_end - (char*)&_heap_end - 1024);
/* STM32F4xx HAL library initialization: