Skip to content

Commit b3a6579

Browse files
committed
zephyr: Enable stack checking and micropython.mem_info().
1 parent ac70119 commit b3a6579

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

zephyr/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "py/runtime.h"
88
#include "py/repl.h"
99
#include "py/gc.h"
10+
#include "py/stackctrl.h"
1011
#include "lib/utils/pyexec.h"
1112

1213
void do_str(const char *src, mp_parse_input_kind_t input_kind) {
@@ -35,6 +36,9 @@ static char heap[16 * 1024];
3536
int real_main(void) {
3637
int stack_dummy;
3738
stack_top = (char*)&stack_dummy;
39+
mp_stack_set_top(stack_top);
40+
// Should be set to stack size in prj.mdef minus fuzz factor
41+
mp_stack_set_limit(3584);
3842

3943
#if MICROPY_ENABLE_GC
4044
gc_init(heap, heap + sizeof(heap));

zephyr/mpconfigport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define MICROPY_COMP_CONST (0)
66
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0)
77

8+
#define MICROPY_STACK_CHECK (1)
89
#define MICROPY_ENABLE_GC (1)
910
#define MICROPY_HELPER_REPL (1)
1011
#define MICROPY_REPL_AUTO_INDENT (1)
@@ -23,6 +24,7 @@
2324
#define MICROPY_PY_COLLECTIONS (0)
2425
#define MICROPY_PY_CMATH (0)
2526
#define MICROPY_PY_IO (0)
27+
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
2628
#define MICROPY_PY_STRUCT (0)
2729
#define MICROPY_PY_SYS_MODULES (0)
2830
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)

0 commit comments

Comments
 (0)