From 7c51d75ec83f95ccace2afbbdb41d52600641f4f Mon Sep 17 00:00:00 2001
From: Eric Brombaugh <ebrombaugh1@cox.net>
Date: Wed, 26 Jul 2023 12:04:26 -0700
Subject: [PATCH] Disable DEBUGPRINTF I/O when FUNCONF_USE_DEBUGPRINTF = 0

---
 ch32v003fun/ch32v003fun.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c
index ae83a41..9a718df 100644
--- a/ch32v003fun/ch32v003fun.c
+++ b/ch32v003fun/ch32v003fun.c
@@ -1003,6 +1003,19 @@ void WaitForDebuggerToAttach()
 
 #endif
 
+#if defined( FUNCONF_USE_DEBUGPRINTF ) && !FUNCONF_USE_DEBUGPRINTF
+int _write(int fd, const char *buf, int size)
+{
+	return size;
+}
+
+// single to debug intf
+int putchar(int c)
+{
+	return 1;
+}
+#endif
+
 void DelaySysTick( uint32_t n )
 {
 	uint32_t targend = SysTick->CNT + n;
-- 
GitLab