diff --git a/py/mpconfig.h b/py/mpconfig.h
index 08dd497c5fbb36d82dbd6b2834f30e78627f52da..5e717ad0f68b18b65661983d6986a6216dbc27af 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -819,12 +819,6 @@ typedef double mp_float_t;
 #define MICROPY_PORT_ROOT_POINTERS
 #endif
 
-#if MICROPY_PY_OS_DUPTERM
-#define MP_ROOT_PTR_DUPTERM_OBJ mp_obj_t term_obj
-#else
-#define MP_ROOT_PTR_DUPTERM_OBJ
-#endif
-
 /*****************************************************************************/
 /* Miscellaneous settings                                                    */
 
diff --git a/py/mpstate.h b/py/mpstate.h
index 012b0ef189a20b8d4f477a130f01447d8e2f2cb8..a990713f76c6e398527510767f7f66a31fa94b48 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -127,6 +127,11 @@ typedef struct _mp_state_vm_t {
     MICROPY_PORT_ROOT_POINTERS
 
     // root pointers for extmod
+
+    #if MICROPY_PY_OS_DUPTERM
+    mp_obj_t term_obj;
+    #endif
+
     #if MICROPY_PY_LWIP_SLIP
     mp_obj_t lwip_slip_stream;
     #endif
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 483c7537747c68c9887b60de1ed2440c89bcd400..3be6168a8f22ca1f2d9d4ef2eca1a3853b4fb1a1 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -665,3 +665,7 @@ Q(writeblocks)
 Q(sync)
 Q(count)
 #endif
+
+#if MICROPY_PY_OS_DUPTERM
+Q(dupterm)
+#endif
diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h
index a5f32a081278a542f19b8738e6cf17adfb375995..b5f1a4587120492d2809a8ac8e65559e657c74f7 100644
--- a/unix/mpconfigport.h
+++ b/unix/mpconfigport.h
@@ -253,7 +253,6 @@ void mp_hal_dupterm_tx_strn(const char *str, size_t len);
 #define MICROPY_PORT_ROOT_POINTERS \
     const char *readline_hist[50]; \
     mp_obj_t keyboard_interrupt_obj; \
-    MP_ROOT_PTR_DUPTERM_OBJ; \
     void *mmap_region_head; \
 
 // We need to provide a declaration/definition of alloca()