diff --git a/ch32v003fun/ch32v003fun.c b/ch32v003fun/ch32v003fun.c
index 72f14f2e9730d67878ed948c61f17a6d707f61ba..8de04b1bf72562abd0c32bb4b526d47456ccf556 100644
--- a/ch32v003fun/ch32v003fun.c
+++ b/ch32v003fun/ch32v003fun.c
@@ -920,7 +920,6 @@ int _write(int fd, const char *buf, int size)
 	}
 	return size;
 }
-#endif
 
 void SetupDebugPrintf()
 {
@@ -934,6 +933,8 @@ void WaitForDebuggerToAttach()
 	while( ((*DMDATA0) & 0x80) );
 }
 
+#endif
+
 void DelaySysTick( uint32_t n )
 {
     SysTick->SR &= ~(1 << 0);