diff --git a/examples/natmod/btree/btree_c.c b/examples/natmod/btree/btree_c.c index c8c5cef471..f3e4790ed2 100644 --- a/examples/natmod/btree/btree_c.c +++ b/examples/natmod/btree/btree_c.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_PY_BTREE (1) #include "py/dynruntime.h" diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c index 8f322c204a..8d488cffd6 100644 --- a/examples/natmod/framebuf/framebuf.c +++ b/examples/natmod/framebuf/framebuf.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_PY_FRAMEBUF (1) #include "py/dynruntime.h" diff --git a/examples/natmod/uheapq/uheapq.c b/examples/natmod/uheapq/uheapq.c index df880bd382..9da6bb4ada 100644 --- a/examples/natmod/uheapq/uheapq.c +++ b/examples/natmod/uheapq/uheapq.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_PY_UHEAPQ (1) #include "py/dynruntime.h" diff --git a/examples/natmod/urandom/urandom.c b/examples/natmod/urandom/urandom.c index 732e439eea..e1fed6a554 100644 --- a/examples/natmod/urandom/urandom.c +++ b/examples/natmod/urandom/urandom.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_PY_URANDOM (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) diff --git a/examples/natmod/ure/ure.c b/examples/natmod/ure/ure.c index 6c9e9e307e..ca1383583a 100644 --- a/examples/natmod/ure/ure.c +++ b/examples/natmod/ure/ure.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_STACK_CHECK (1) #define MICROPY_PY_URE (1) #define MICROPY_PY_URE_MATCH_GROUPS (1) diff --git a/examples/natmod/uzlib/uzlib.c b/examples/natmod/uzlib/uzlib.c index 4873171e5e..99b3691761 100644 --- a/examples/natmod/uzlib/uzlib.c +++ b/examples/natmod/uzlib/uzlib.c @@ -1,4 +1,3 @@ -#define MICROPY_ENABLE_DYNRUNTIME (1) #define MICROPY_PY_UZLIB (1) #include "py/dynruntime.h" diff --git a/py/dynruntime.h b/py/dynruntime.h index 494ad772df..9f2803c535 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -33,6 +33,10 @@ #include "py/objstr.h" #include "py/objtype.h" +#if !MICROPY_ENABLE_DYNRUNTIME +#error "dynruntime.h included in non-dynamic-module build." +#endif + #undef MP_ROM_QSTR #undef MP_OBJ_QSTR_VALUE #undef MP_OBJ_NEW_QSTR diff --git a/py/dynruntime.mk b/py/dynruntime.mk index 8b65745afd..cb5ab845eb 100644 --- a/py/dynruntime.mk +++ b/py/dynruntime.mk @@ -27,6 +27,7 @@ CFLAGS += -std=c99 CFLAGS += -Os CFLAGS += -Wall -Werror -DNDEBUG CFLAGS += -DNO_QSTR +CFLAGS += -DMICROPY_ENABLE_DYNRUNTIME CFLAGS += -DMP_CONFIGFILE='<$(CONFIG_H)>' CFLAGS += -fpic -fno-common CFLAGS += -U _FORTIFY_SOURCE # prevent use of __*_chk libc functions