Skip to content

Commit d6c673f

Browse files
pi-anldpgeorge
authored andcommitted
stm32/main: Replace mp_stack_set calls with new mp_cstack_init_with_top.
Required in MICROPY_PREVIEW_VERSION_2. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 569d472 commit d6c673f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

ports/stm32/main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,8 @@ void stm32_main(uint32_t reset_mode) {
515515
mp_thread_init();
516516
#endif
517517

518-
// Stack limit should be less than real stack size, so we have a chance
519-
// to recover from limit hit. (Limit is measured in bytes.)
520-
// Note: stack control relies on main thread being initialised above
521-
mp_stack_set_top(&_estack);
522-
mp_stack_set_limit((char *)&_estack - (char *)&_sstack - 1024);
518+
// Stack limit init.
519+
mp_cstack_init_with_top(&_estack, (char *)&_estack - (char *)&_sstack);
523520

524521
// GC init
525522
gc_init(MICROPY_HEAP_START, MICROPY_HEAP_END);

ports/stm32/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define MICROPY_GC_STACK_ENTRY_TYPE uint16_t
4444
#endif
4545
#endif
46+
#define MICROPY_STACK_CHECK_MARGIN (1024)
4647
#define MICROPY_ALLOC_PATH_MAX (128)
4748

4849
// optimisations

0 commit comments

Comments
 (0)