diff options
| author | Damien George <damien@micropython.org> | 2021-06-05 10:36:15 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-06-05 11:03:09 +1000 |
| commit | 36cb365cadfc9597d10a60c0581268fa47305b69 (patch) | |
| tree | a542226dc165e4ed2907f6dcae3043c3fab12c6b | |
| parent | 5e1d3c8b5dff212ced531497a37651571991ddc0 (diff) | |
unix/main: Increase stack limit on ARM architectures.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/unix/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c index e33c1742d..a5db0869d 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -451,7 +451,13 @@ MP_NOINLINE int main_(int argc, char **argv) { signal(SIGPIPE, SIG_IGN); #endif - mp_stack_set_limit(40000 * (sizeof(void *) / 4)); + // Define a reasonable stack limit to detect stack overflow. + mp_uint_t stack_limit = 40000 * (sizeof(void *) / 4); + #if defined(__arm__) && !defined(__thumb2__) + // ARM (non-Thumb) architectures require more stack. + stack_limit *= 2; + #endif + mp_stack_set_limit(stack_limit); pre_process_options(argc, argv); |
