diff options
-rw-r--r-- | zephyr/Makefile | 6 | ||||
-rw-r--r-- | zephyr/main.c | 2 | ||||
-rw-r--r-- | zephyr/mpconfigport.h | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/zephyr/Makefile b/zephyr/Makefile index 920336722e..09a56713f1 100644 --- a/zephyr/Makefile +++ b/zephyr/Makefile @@ -15,6 +15,10 @@ BOARD ?= qemu_x86 # Zephyr 1.6.0 OUTDIR_PREFIX = $(BOARD) +# Default heap size is 16KB, which is on conservative side, to let +# it build for smaller boards, but it won't be enough for larger +# applications, and will need to be increased. +MICROPY_HEAP_SIZE = 16384 FROZEN_DIR = scripts # Zephyr (generated) config files - must be defined before include below @@ -52,7 +56,7 @@ SRC_QSTR += $(SRC_C) OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \ - -std=gnu99 -DNDEBUG $(INC) + -std=gnu99 -DNDEBUG -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE) $(INC) include ../py/mkrules.mk diff --git a/zephyr/main.c b/zephyr/main.c index 8d319098b2..b58558f0be 100644 --- a/zephyr/main.c +++ b/zephyr/main.c @@ -58,7 +58,7 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) { } static char *stack_top; -static char heap[16 * 1024]; +static char heap[MICROPY_HEAP_SIZE]; int real_main(void) { int stack_dummy; diff --git a/zephyr/mpconfigport.h b/zephyr/mpconfigport.h index 059bd32dff..e291faf1d6 100644 --- a/zephyr/mpconfigport.h +++ b/zephyr/mpconfigport.h @@ -28,6 +28,11 @@ // Include Zephyr's autoconf.h, which should be made first by Zephyr makefiles #include "autoconf.h" +// Usually passed from Makefile +#ifndef MICROPY_HEAP_SIZE +#define MICROPY_HEAP_SIZE (16 * 1024) +#endif + #define MICROPY_STACK_CHECK (1) #define MICROPY_ENABLE_GC (1) #define MICROPY_HELPER_REPL (1) |