8000 unix: Add support for using the Python stack. · lvgl/lv_micropython@357486d · GitHub
[go: up one dir, main page]

Skip to content

Commit 357486d

Browse files
committed
unix: Add support for using the Python stack.
1 parent ab750ee commit 357486d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ports/unix/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ MP_NOINLINE int main_(int argc, char **argv) {
440440
gc_init(heap, heap + heap_size);
441441
#endif
442442

443+
#if MICROPY_ENABLE_PYSTACK
444+
static mp_obj_t pystack[1024];
445+
mp_pystack_init(pystack, &pystack[MP_ARRAY_SIZE(pystack)]);
446+
#endif
447+
443448
mp_init();
444449

445450
char *home = getenv("HOME");

ports/unix/mpthreadport.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ STATIC void mp_thread_gc(int signo, siginfo_t *info, void *context) {
6666
// that we don't need the extra information, enough is captured by the
6767
// gc_collect_regs_and_stack function above
6868
//gc_collect_root((void**)context, sizeof(ucontext_t) / sizeof(uintptr_t));
69+
#if MICROPY_ENABLE_PYSTACK
70+
void **ptrs = (void**)(void*)MP_STATE_THREAD(pystack_start);
71+
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void*));
72+
#endif
6973
thread_signal_done = 1;
7074
}
7175
}

0 commit comments

Comments
 (0)
0