Merge pull request #903 from jepler/stack-overflow-crash

main: Explicitly set the stack top based on _estack
This commit is contained in:
Scott Shawcroft 2018-06-05 22:05:13 -07:00 committed by GitHub
commit aa636841a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

2
main.c
View File

@ -241,7 +241,7 @@ int __attribute__((used)) 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_top((char*)&_estack);
mp_stack_set_limit((char*)&_estack - (char*)&_ebss - 1024);
#if MICROPY_MAX_STACK_USAGE