From 136f67523b10d24dd65cb25e49e07a7e4e5341a1 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Tue, 7 Jan 2014 14:54:15 +0000
Subject: [PATCH] Factor and simplify Makefile's and mpconfig.

---
 py/mpconfig.h           |  70 +++++++++++++++----
 py/py.mk                | 100 +++++++++++++++++++++++++++
 py/repl.c               |   5 ++
 py/repl.h               |   2 +
 stm/mpconfigport.h      |   5 +-
 unix-cpy/Makefile       |  94 +++++--------------------
 unix-cpy/main.c         |   1 -
 unix-cpy/mpconfigport.h |   3 -
 unix/Makefile           |  99 +++++---------------------
 unix/main.c             | 149 ++++++++++++++++++++--------------------
 unix/mpconfigport.h     |   5 +-
 11 files changed, 276 insertions(+), 257 deletions(-)
 create mode 100644 py/py.mk

diff --git a/py/mpconfig.h b/py/mpconfig.h
index 56495d915..8ce432a61 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -4,26 +4,52 @@
 
 #include <mpconfigport.h>
 
-#ifndef INT_FMT
-// printf format spec to use for machine_int_t and friends
-#ifdef __LP64__
-// Archs where machine_int_t == long, long != int
-#define UINT_FMT "%lu"
-#define INT_FMT "%ld"
-#else
-// Archs where machine_int_t == int
-#define UINT_FMT "%u"
-#define INT_FMT "%d"
+// Any options not explicitly set in mpconfigport.h will get default
+// values below.
+
+/*****************************************************************************/
+/* Micro Python emitters                                                     */
+
+// Whether to emit CPython byte codes (for debugging/testing)
+// Enabling this overrides all other emitters
+#ifndef MICROPY_EMIT_CPYTHON
+#define MICROPY_EMIT_CPYTHON (0)
+#endif
+
+// Whether to emit x64 native code
+#ifndef MICROPY_EMIT_X64
+#define MICROPY_EMIT_X64 (0)
 #endif
-#endif //INT_FMT
 
+// Whether to emit thumb native code
+#ifndef MICROPY_EMIT_THUMB
+#define MICROPY_EMIT_THUMB (0)
+#endif
 
-// Any options not explicitly set in mpconfigport.h will get default
-// values below.
+// Whether to enable the thumb inline assembler
+#ifndef MICROPY_EMIT_INLINE_THUMB
+#define MICROPY_EMIT_INLINE_THUMB (0)
+#endif
+
+/*****************************************************************************/
+/* Internal debugging stuff                                                  */
 
 // Whether to collect memory allocation stats
 #ifndef MICROPY_MEM_STATS
-#define MICROPY_MEM_STATS (1)
+#define MICROPY_MEM_STATS (0)
+#endif
+
+/*****************************************************************************/
+/* Fine control over Python features                                         */
+
+// Whether to include REPL helper function
+#ifndef MICROPY_ENABLE_REPL_HELPERS
+#define MICROPY_ENABLE_REPL_HELPERS (0)
+#endif
+
+// Whether to support float and complex types
+#ifndef MICROPY_ENABLE_FLOAT
+#define MICROPY_ENABLE_FLOAT (0)
 #endif
 
 // Whether to support slice object and correspondingly
@@ -31,3 +57,19 @@
 #ifndef MICROPY_ENABLE_SLICE
 #define MICROPY_ENABLE_SLICE (1)
 #endif
+
+/*****************************************************************************/
+/* Miscellaneous settings                                                    */
+
+// printf format spec to use for machine_int_t and friends
+#ifndef INT_FMT
+#ifdef __LP64__
+// Archs where machine_int_t == long, long != int
+#define UINT_FMT "%lu"
+#define INT_FMT "%ld"
+#else
+// Archs where machine_int_t == int
+#define UINT_FMT "%u"
+#define INT_FMT "%d"
+#endif
+#endif //INT_FMT
diff --git a/py/py.mk b/py/py.mk
new file mode 100644
index 000000000..e673c713c
--- /dev/null
+++ b/py/py.mk
@@ -0,0 +1,100 @@
+# default settings; can be overriden in main Makefile
+
+ifndef PY_SRC
+PY_SRC = ../py
+endif
+
+ifndef BUILD
+BUILD = build
+endif
+
+# to create the build directory
+
+$(BUILD):
+	mkdir -p $@
+
+# where py object files go (they have a name prefix to prevent filename clashes)
+
+PY_BUILD = $(BUILD)/py.
+
+# py object files
+
+PY_O_BASENAME = \
+	nlrx86.o \
+	nlrx64.o \
+	nlrthumb.o \
+	malloc.o \
+	qstr.o \
+	vstr.o \
+	unicode.o \
+	lexer.o \
+	lexerunix.o \
+	parse.o \
+	scope.o \
+	compile.o \
+	emitcommon.o \
+	emitpass1.o \
+	emitcpy.o \
+	emitbc.o \
+	asmx64.o \
+	emitnx64.o \
+	asmthumb.o \
+	emitnthumb.o \
+	emitinlinethumb.o \
+	runtime.o \
+	map.o \
+	obj.o \
+	objbool.o \
+	objboundmeth.o \
+	objcell.o \
+	objclass.o \
+	objclosure.o \
+	objcomplex.o \
+	objdict.o \
+	objexcept.o \
+	objfloat.o \
+	objfun.o \
+	objgenerator.o \
+	objinstance.o \
+	objint.o \
+	objlist.o \
+	objmodule.o \
+	objnone.o \
+	objrange.o \
+	objset.o \
+	objslice.o \
+	objstr.o \
+	objtuple.o \
+	objtype.o \
+	builtin.o \
+	builtinimport.o \
+	vm.o \
+	showbc.o \
+	repl.o \
+
+# prepend the build destination prefix to the py object files
+
+PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME))
+
+$(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
+	$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
+
+$(PY_BUILD)emitnthumb.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h
+	$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
+
+$(PY_BUILD)%.o: $(PY_SRC)/%.S
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+$(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
+$(PY_BUILD)vm.o: $(PY_SRC)/vm.c
+	$(CC) $(CFLAGS) -O3 -c -o $@ $<
+
+# header dependencies
+
+$(PY_BUILD)parse.o: $(PY_SRC)/grammar.h
+$(PY_BUILD)compile.o: $(PY_SRC)/grammar.h
+$(PY_BUILD)/emitcpy.o: $(PY_SRC)/emit.h
+$(PY_BUILD)emitbc.o: $(PY_SRC)/emit.h
diff --git a/py/repl.c b/py/repl.c
index 4241ef0e4..473313c1e 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -1,6 +1,9 @@
 #include "misc.h"
+#include "mpconfig.h"
 #include "repl.h"
 
+#if MICROPY_ENABLE_REPL_HELPERS
+
 bool str_startswith_word(const char *str, const char *head) {
     int i;
     for (i = 0; str[i] && head[i]; i++) {
@@ -42,3 +45,5 @@ bool mp_repl_is_compound_stmt(const char *line) {
     }
     return n_paren > 0 || n_brack > 0 || n_brace > 0;
 }
+
+#endif // MICROPY_ENABLE_REPL_HELPERS
diff --git a/py/repl.h b/py/repl.h
index 02fe523ed..23259fa90 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -1 +1,3 @@
+#if MICROPY_ENABLE_REPL_HELPERS
 bool mp_repl_is_compound_stmt(const char *line);
+#endif
diff --git a/stm/mpconfigport.h b/stm/mpconfigport.h
index 4cea332f3..ee90db321 100644
--- a/stm/mpconfigport.h
+++ b/stm/mpconfigport.h
@@ -2,11 +2,10 @@
 
 // options to control how Micro Python is built
 
-#define MICROPY_ENABLE_FLOAT        (1)
-#define MICROPY_EMIT_CPYTHON        (0)
-#define MICROPY_EMIT_X64            (0)
 #define MICROPY_EMIT_THUMB          (1)
 #define MICROPY_EMIT_INLINE_THUMB   (1)
+#define MICROPY_ENABLE_REPL_HELPERS (1)
+#define MICROPY_ENABLE_FLOAT        (1)
 
 // type definitions for the specific machine
 
diff --git a/unix-cpy/Makefile b/unix-cpy/Makefile
index a1eb9b77e..d2d698713 100644
--- a/unix-cpy/Makefile
+++ b/unix-cpy/Makefile
@@ -1,95 +1,37 @@
-PYSRC=../py
-BUILD=build
+# define main target
+PROG = cpy
+all: $(PROG)
+
+# include py core make definitions
+include ../py/py.mk
 
+# program for deletion
+RM = /bin/rm
+
+# compiler settings
 CC = gcc
-CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG
+CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG
 LDFLAGS = -lm
 
+# source files
 SRC_C = \
 	main.c \
 
-PY_O = \
-	nlrx86.o \
-	nlrx64.o \
-	malloc.o \
-	qstr.o \
-	vstr.o \
-	unicode.o \
-	lexer.o \
-	lexerunix.o \
-	parse.o \
-	scope.o \
-	compile.o \
-	emitcommon.o \
-	emitpass1.o \
-	emitcpy.o \
-	runtime.o \
-	map.o \
-	obj.o \
-	objbool.o \
-	objboundmeth.o \
-	objcell.o \
-	objclass.o \
-	objclosure.o \
-	objcomplex.o \
-	objdict.o \
-	objexcept.o \
-	objfloat.o \
-	objfun.o \
-	objgenerator.o \
-	objinstance.o \
-	objint.o \
-	objlist.o \
-	objmodule.o \
-	objnone.o \
-	objrange.o \
-	objset.o \
-	objslice.o \
-	objstr.o \
-	objtuple.o \
-	objtype.o \
-	builtin.o \
-	builtinimport.o \
-	vm.o \
-	showbc.o \
-	repl.o \
-
-OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(PY_O))
+OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) $(PY_O)
 LIB =
-PROG = cpy
 
 $(PROG): $(BUILD) $(OBJ)
 	$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
-
-$(BUILD):
-	mkdir -p $@
+	strip $(PROG)
+	size $(PROG)
 
 $(BUILD)/%.o: %.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
-$(BUILD)/%.o: $(PYSRC)/%.S
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-$(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h
-	$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
-
-$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h
-	$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
-
-# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
-$(BUILD)/vm.o: $(PYSRC)/vm.c
-	$(CC) $(CFLAGS) -O3 -c -o $@ $<
-
 $(BUILD)/main.o: mpconfigport.h
-$(BUILD)/parse.o: $(PYSRC)/grammar.h
-$(BUILD)/compile.o: $(PYSRC)/grammar.h
-$(BUILD)/emitcpy.o: $(PYSRC)/emit.h
-$(BUILD)/emitbc.o: $(PYSRC)/emit.h
 
 clean:
-	/bin/rm -rf $(BUILD)
+	$(RM) -f $(PROG)
+	$(RM) -rf $(BUILD)
 
-.PHONY: clean
+.PHONY: all clean
diff --git a/unix-cpy/main.c b/unix-cpy/main.c
index eba97f527..ea85e3275 100644
--- a/unix-cpy/main.c
+++ b/unix-cpy/main.c
@@ -11,7 +11,6 @@
 #include "obj.h"
 #include "compile.h"
 #include "runtime0.h"
-#include "runtime.h"
 
 void do_file(const char *file) {
     mp_lexer_t *lex = mp_lexer_new_from_file(file);
diff --git a/unix-cpy/mpconfigport.h b/unix-cpy/mpconfigport.h
index 983b166a5..9e3e32bb4 100644
--- a/unix-cpy/mpconfigport.h
+++ b/unix-cpy/mpconfigport.h
@@ -2,9 +2,6 @@
 
 #define MICROPY_ENABLE_FLOAT        (1)
 #define MICROPY_EMIT_CPYTHON        (1)
-#define MICROPY_EMIT_X64            (0)
-#define MICROPY_EMIT_THUMB          (0)
-#define MICROPY_EMIT_INLINE_THUMB   (0)
 
 // type definitions for the specific machine
 
diff --git a/unix/Makefile b/unix/Makefile
index 984f1c3bf..a3faea290 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -1,106 +1,39 @@
-PYSRC=../py
-BUILD=build
+# define main target
+PROG = py
+all: $(PROG)
+
+# include py core make definitions
+include ../py/py.mk
 
+# program for deletion
+RM = /bin/rm
+
+# compiler settings
 CC = gcc
-CFLAGS = -I. -I$(PYSRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG
+CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -Os #-DNDEBUG
 LDFLAGS = -lm
 
+# source files
 SRC_C = \
 	main.c \
 
-PY_O = \
-	nlrx86.o \
-	nlrx64.o \
-	nlrthumb.o \
-	malloc.o \
-	qstr.o \
-	vstr.o \
-	unicode.o \
-	lexer.o \
-	lexerunix.o \
-	parse.o \
-	scope.o \
-	compile.o \
-	emitcommon.o \
-	emitpass1.o \
-	emitcpy.o \
-	emitbc.o \
-	asmx64.o \
-	emitnx64.o \
-	asmthumb.o \
-	emitnthumb.o \
-	emitinlinethumb.o \
-	runtime.o \
-	map.o \
-	obj.o \
-	objbool.o \
-	objboundmeth.o \
-	objcell.o \
-	objclass.o \
-	objclosure.o \
-	objcomplex.o \
-	objdict.o \
-	objexcept.o \
-	objfloat.o \
-	objfun.o \
-	objgenerator.o \
-	objinstance.o \
-	objint.o \
-	objlist.o \
-	objmodule.o \
-	objnone.o \
-	objrange.o \
-	objset.o \
-	objslice.o \
-	objstr.o \
-	objtuple.o \
-	objtype.o \
-	builtin.o \
-	builtinimport.o \
-	vm.o \
-	showbc.o \
-	repl.o \
-
-OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(PY_O))
+OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) $(PY_O)
 LIB = -lreadline
 # the following is needed for BSD
 #LIB += -ltermcap
-PROG = py
 
 $(PROG): $(BUILD) $(OBJ)
 	$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
 	strip $(PROG)
 	size $(PROG)
 
-$(BUILD):
-	mkdir -p $@
-
 $(BUILD)/%.o: %.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
-$(BUILD)/%.o: $(PYSRC)/%.S
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-$(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-$(BUILD)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h
-	$(CC) $(CFLAGS) -DN_X64 -c -o $@ $<
-
-$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h mpconfigport.h
-	$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $<
-
-# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
-$(BUILD)/vm.o: $(PYSRC)/vm.c
-	$(CC) $(CFLAGS) -O3 -c -o $@ $<
-
 $(BUILD)/main.o: mpconfigport.h
-$(BUILD)/parse.o: $(PYSRC)/grammar.h
-$(BUILD)/compile.o: $(PYSRC)/grammar.h
-$(BUILD)/emitcpy.o: $(PYSRC)/emit.h
-$(BUILD)/emitbc.o: $(PYSRC)/emit.h
 
 clean:
-	/bin/rm -rf $(BUILD)
+	$(RM) -f $(PROG)
+	$(RM) -rf $(BUILD)
 
-.PHONY: clean
+.PHONY: all clean
diff --git a/unix/main.c b/unix/main.c
index a06dc3679..f7277b960 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -20,6 +20,52 @@
 #include <readline/history.h>
 #endif
 
+static void execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bool is_repl) {
+    if (lex == NULL) {
+        return;
+    }
+
+    if (0) {
+        // just tokenise
+        while (!mp_lexer_is_kind(lex, MP_TOKEN_END)) {
+            mp_token_show(mp_lexer_cur(lex));
+            mp_lexer_to_next(lex);
+        }
+        mp_lexer_free(lex);
+        return;
+    }
+
+    mp_parse_node_t pn = mp_parse(lex, input_kind);
+    mp_lexer_free(lex);
+
+    if (pn == MP_PARSE_NODE_NULL) {
+        // parse error
+        return;
+    }
+
+    //printf("----------------\n");
+    //parse_node_show(pn, 0);
+    //printf("----------------\n");
+
+    mp_obj_t module_fun = mp_compile(pn, is_repl);
+
+    if (module_fun == mp_const_none) {
+        // compile error
+        return;
+    }
+
+    // execute it
+    nlr_buf_t nlr;
+    if (nlr_push(&nlr) == 0) {
+        rt_call_function_0(module_fun);
+        nlr_pop();
+    } else {
+        // uncaught exception
+        mp_obj_print((mp_obj_t)nlr.ret_val);
+        printf("\n");
+    }
+}
+
 static char *str_join(const char *s1, int sep_char, const char *s2) {
     int l1 = strlen(s1);
     int l2 = strlen(s2);
@@ -80,28 +126,11 @@ static void do_repl(void) {
         }
 
         mp_lexer_t *lex = mp_lexer_new_from_str_len("<stdin>", line, strlen(line), false);
-        mp_parse_node_t pn = mp_parse(lex, MP_PARSE_SINGLE_INPUT);
-        mp_lexer_free(lex);
-
-        if (pn != MP_PARSE_NODE_NULL) {
-            //mp_parse_node_show(pn, 0);
-            mp_obj_t module_fun = mp_compile(pn, true);
-            if (module_fun != mp_const_none) {
-                nlr_buf_t nlr;
-                if (nlr_push(&nlr) == 0) {
-                    rt_call_function_0(module_fun);
-                    nlr_pop();
-                } else {
-                    // uncaught exception
-                    mp_obj_print((mp_obj_t)nlr.ret_val);
-                    printf("\n");
-                }
-            }
-        }
+        execute_from_lexer(lex, MP_PARSE_SINGLE_INPUT, true);
     }
 }
 
-void do_file(const char *file) {
+static void do_file(const char *file) {
     // hack: set dir for import based on where this file is
     {
         const char * s = strrchr(file, '/');
@@ -115,53 +144,12 @@ void do_file(const char *file) {
     }
 
     mp_lexer_t *lex = mp_lexer_new_from_file(file);
-    //const char *pysrc = "def f():\n  x=x+1\n  print(42)\n";
-    //mp_lexer_t *lex = mp_lexer_from_str_len("<>", pysrc, strlen(pysrc), false);
-    if (lex == NULL) {
-        return;
-    }
-
-    if (0) {
-        // just tokenise
-        while (!mp_lexer_is_kind(lex, MP_TOKEN_END)) {
-            mp_token_show(mp_lexer_cur(lex));
-            mp_lexer_to_next(lex);
-        }
-        mp_lexer_free(lex);
-
-    } else {
-        // compile
-
-        mp_parse_node_t pn = mp_parse(lex, MP_PARSE_FILE_INPUT);
-        mp_lexer_free(lex);
-
-        if (pn != MP_PARSE_NODE_NULL) {
-            //printf("----------------\n");
-            //parse_node_show(pn, 0);
-            //printf("----------------\n");
-            mp_obj_t module_fun = mp_compile(pn, false);
-            //printf("----------------\n");
+    execute_from_lexer(lex, MP_PARSE_FILE_INPUT, false);
+}
 
-#if MICROPY_EMIT_CPYTHON
-            if (!comp_ok) {
-                printf("compile error\n");
-            }
-#else
-            if (1 && module_fun != mp_const_none) {
-                // execute it
-                nlr_buf_t nlr;
-                if (nlr_push(&nlr) == 0) {
-                    rt_call_function_0(module_fun);
-                    nlr_pop();
-                } else {
-                    // uncaught exception
-                    mp_obj_print((mp_obj_t)nlr.ret_val);
-                    printf("\n");
-                }
-            }
-#endif
-        }
-    }
+static void do_str(const char *str) {
+    mp_lexer_t *lex = mp_lexer_new_from_str_len("<stdin>", str, strlen(str), false);
+    execute_from_lexer(lex, MP_PARSE_SINGLE_INPUT, false);
 }
 
 typedef struct _test_obj_t {
@@ -192,12 +180,6 @@ static const mp_obj_type_t test_type = {
     { &mp_const_type },
     "Test",
     .print = test_print,
-    .make_new = NULL,
-    .call_n = NULL,
-    .unary_op = NULL,
-    .binary_op = NULL,
-    .getiter = NULL,
-    .iternext = NULL,
     .methods = {
         { "get", &test_get_obj },
         { "set", &test_set_obj },
@@ -212,6 +194,11 @@ mp_obj_t test_obj_new(int value) {
     return o;
 }
 
+int usage(void) {
+    printf("usage: py [-c <command>] [<filename>]\n");
+    return 1;
+}
+
 int main(int argc, char **argv) {
     qstr_init();
     rt_init();
@@ -227,12 +214,24 @@ int main(int argc, char **argv) {
 
     if (argc == 1) {
         do_repl();
-    } else if (argc == 2) {
-        do_file(argv[1]);
     } else {
-        printf("usage: py [<file>]\n");
-        return 1;
+        for (int a = 1; a < argc; a++) {
+            if (argv[a][0] == '-') {
+                if (strcmp(argv[a], "-c") == 0) {
+                    if (a + 1 >= argc) {
+                        return usage();
+                    }
+                    do_str(argv[a + 1]);
+                    a += 1;
+                } else {
+                    return usage();
+                }
+            } else {
+                do_file(argv[a]);
+            }
+        }
     }
+
     rt_deinit();
 
     //printf("total bytes = %d\n", m_get_total_bytes_allocated());
diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h
index 7a4622b8b..b7901069a 100644
--- a/unix/mpconfigport.h
+++ b/unix/mpconfigport.h
@@ -5,11 +5,12 @@
 #define MICROPY_USE_READLINE        (1)
 #endif
 
-#define MICROPY_ENABLE_FLOAT        (1)
-#define MICROPY_EMIT_CPYTHON        (0)
 #define MICROPY_EMIT_X64            (1)
 #define MICROPY_EMIT_THUMB          (0)
 #define MICROPY_EMIT_INLINE_THUMB   (0)
+#define MICROPY_MEM_STATS           (1)
+#define MICROPY_ENABLE_REPL_HELPERS (1)
+#define MICROPY_ENABLE_FLOAT        (1)
 
 // type definitions for the specific machine
 
-- 
GitLab