diff --git a/pycardium/mphalport.c b/pycardium/mphalport.c
index 38d778e43f50bc2edea78dfdbf36af2356ca0aa8..9852fd85751feec7eadac27e59530039420f8b8a 100644
--- a/pycardium/mphalport.c
+++ b/pycardium/mphalport.c
@@ -1,4 +1,6 @@
 #include <stdint.h>
+#include <stdarg.h>
+#include <stdio.h>
 
 #include "py/lexer.h"
 #include "py/mpconfig.h"
@@ -29,6 +31,16 @@ void mp_hal_stdout_tx_strn(const char* str, mp_uint_t len)
 	epic_uart_write_str(str, len);
 }
 
+/* Used by MicroPython for debug output */
+int DEBUG_printf(const char *fmt, ...)
+{
+	va_list args;
+	va_start(args, fmt);
+	int ret = vprintf(fmt, args);
+	va_end(args);
+	return ret;
+}
+
 bool do_interrupt = false;
 
 /* Timer Interrupt used for control char notification */