Skip to content

Commit f3e6c46

Browse files
committed
bricks/_common/micropython: Use embedded stack when enabled.
Otherwise use mp_cstack for unix-like builds.
1 parent 07a9ca4 commit f3e6c46

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bricks/_common/micropython.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ const char *pbsys_main_get_application_version_hash(void) {
348348
// Runs MicroPython with the given program data.
349349
void pbsys_main_run_program(pbsys_main_program_t *program) {
350350

351+
#if PBDRV_CONFIG_STACK_EMBEDDED
351352
// Stack limit should be less than real stack size, so we have a chance
352353
// to recover from limit hit. (Limit is measured in bytes.)
353-
// Note: stack control relies on main thread being initialised above
354354
char *stack_start;
355355
char *stack_end;
356356
pbdrv_stack_get_info(&stack_start, &stack_end);
@@ -361,6 +361,9 @@ void pbsys_main_run_program(pbsys_main_program_t *program) {
361361
mp_stack_ctrl_init();
362362
#endif
363363
mp_stack_set_limit(MP_STATE_THREAD(stack_top) - stack_start - 1024);
364+
#else
365+
mp_cstack_init_with_sp_here(1024 * 1024);
366+
#endif
364367

365368
// MicroPython heap is the free RAM after program data.
366369
gc_init(program->user_ram_start, program->user_ram_end);

0 commit comments

Comments
 (0)