Skip to content

Commit 8160743

Browse files
committed
nrf/main: Replace mp_stack_set calls with mp_cstack_init_with_top.
Signed-off-by: Damien George <[email protected]>
1 parent af22318 commit 8160743

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

ports/nrf/main.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "py/parse.h"
3737
#include "py/obj.h"
3838
#include "py/runtime.h"
39-
#include "py/stackctrl.h"
4039
#include "py/gc.h"
4140
#include "py/compile.h"
4241
#include "py/persistentcode.h"
@@ -126,11 +125,7 @@ void MP_NORETURN _start(void) {
126125

127126
led_state(1, 1); // MICROPY_HW_LED_1 aka MICROPY_HW_LED_RED
128127

129-
mp_stack_set_top(&_ram_end);
130-
131-
// Stack limit should be less than real stack size, so we have a chance
132-
// to recover from limit hit. (Limit is measured in bytes.)
133-
mp_stack_set_limit((char *)&_ram_end - (char *)&_heap_end - 400);
128+
mp_cstack_init_with_top(&_ram_end, (char *)&_ram_end - (char *)&_heap_end);
134129

135130
machine_init();
136131

ports/nrf/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
#define MICROPY_ENABLE_GC (1)
121121
#define MICROPY_ENABLE_FINALISER (1)
122122
#define MICROPY_STACK_CHECK (1)
123+
#define MICROPY_STACK_CHECK_MARGIN (400)
123124
#define MICROPY_HELPER_REPL (1)
124125
#define MICROPY_REPL_INFO (1)
125126
#define MICROPY_REPL_AUTO_INDENT (1)

0 commit comments

Comments
 (0)