summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--lib/utils/printf.c6
-rw-r--r--ports/esp8266/main.c2
-rw-r--r--ports/esp8266/mpconfigport.h5
-rw-r--r--ports/unix/mpconfigport.h2
-rw-r--r--ports/windows/mpconfigport.h2
-rw-r--r--py/mpconfig.h5
6 files changed, 13 insertions, 9 deletions
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index 117efff42c..1ceeea39ff 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -41,11 +41,7 @@
int DEBUG_printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
- #ifndef MICROPY_DEBUG_PRINTER_DEST
- #define MICROPY_DEBUG_PRINTER_DEST mp_plat_print
- #endif
- extern const mp_print_t MICROPY_DEBUG_PRINTER_DEST;
- int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap);
+ int ret = mp_vprintf(MICROPY_DEBUG_PRINTER, fmt, ap);
va_end(ap);
return ret;
}
diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c
index 55fd0e3a05..839d6f2873 100644
--- a/ports/esp8266/main.c
+++ b/ports/esp8266/main.c
@@ -172,7 +172,7 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
int DEBUG_printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
- int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap);
+ int ret = mp_vprintf(MICROPY_DEBUG_PRINTER, fmt, ap);
va_end(ap);
return ret;
}
diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h
index 78967c31df..890c4069ec 100644
--- a/ports/esp8266/mpconfigport.h
+++ b/ports/esp8266/mpconfigport.h
@@ -13,8 +13,8 @@
#define MICROPY_EMIT_XTENSA (1)
#define MICROPY_EMIT_INLINE_XTENSA (1)
#define MICROPY_MEM_STATS (0)
+#define MICROPY_DEBUG_PRINTER (&mp_debug_print)
#define MICROPY_DEBUG_PRINTERS (1)
-#define MICROPY_DEBUG_PRINTER_DEST mp_debug_print
#define MICROPY_READER_VFS (MICROPY_VFS)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_ENABLE_FINALISER (1)
@@ -145,6 +145,9 @@ typedef uint32_t sys_prot_t; // for modlwip
void *esp_native_code_commit(void*, size_t);
#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
+// printer for debugging output, goes to UART only
+extern const struct _mp_print_t mp_debug_print;
+
#define mp_type_fileio mp_type_vfs_fat_fileio
#define mp_type_textio mp_type_vfs_fat_textio
diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h
index 4f71a9ef5a..68be462399 100644
--- a/ports/unix/mpconfigport.h
+++ b/ports/unix/mpconfigport.h
@@ -54,7 +54,7 @@
#define MICROPY_DEBUG_PRINTERS (1)
// Printing debug to stderr may give tests which
// check stdout a chance to pass, etc.
-#define MICROPY_DEBUG_PRINTER_DEST mp_stderr_print
+#define MICROPY_DEBUG_PRINTER (&mp_stderr_print)
#define MICROPY_READER_POSIX (1)
#define MICROPY_USE_READLINE_HISTORY (1)
#define MICROPY_HELPER_REPL (1)
diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h
index 1107a538e0..03af97b950 100644
--- a/ports/windows/mpconfigport.h
+++ b/ports/windows/mpconfigport.h
@@ -45,8 +45,8 @@
#define MICROPY_STACK_CHECK (1)
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
#define MICROPY_MEM_STATS (1)
+#define MICROPY_DEBUG_PRINTER (&mp_stderr_print)
#define MICROPY_DEBUG_PRINTERS (1)
-#define MICROPY_DEBUG_PRINTER_DEST mp_stderr_print
#define MICROPY_READER_POSIX (1)
#define MICROPY_USE_READLINE_HISTORY (1)
#define MICROPY_HELPER_REPL (1)
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 8b0f291cb0..6396850b38 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -366,6 +366,11 @@
#define MICROPY_MEM_STATS (0)
#endif
+// The mp_print_t printer used for debugging output
+#ifndef MICROPY_DEBUG_PRINTER
+#define MICROPY_DEBUG_PRINTER (&mp_plat_print)
+#endif
+
// Whether to build functions that print debugging info:
// mp_bytecode_print
// mp_parse_node_print