Subject: [PATCH] debug_uart: Try not to use stack in printch
From: Tim Chick <[email-masked]>
To: [email-masked]
Cc: Masahiro Yamada <[email-masked]>, Tim Chick <[email-masked]>
Date: Thu, 6 Apr 2017 16:32:41 +0100

Previous change to create _printch causes the stack to be used,
breaking printch before stack is available. Inline _printch to
prevent this happening.

Signed-off-by: Tim Chick <[email-masked]>
---

 include/debug_uart.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/debug_uart.h b/include/debug_uart.h
index 0d640b9..2980ae6 100644
--- a/include/debug_uart.h
+++ b/include/debug_uart.h
@@ -115,17 +115,23 @@ void printhex8(uint value);
  * Now define some functions - this should be inserted into the serial driver
  */
 #define DEBUG_UART_FUNCS \
-	void printch(int ch) \
+\
+	static inline void _printch(int ch) \
 	{ \
 		if (ch == '\n') \
 			_debug_uart_putc('\r'); \
 		_debug_uart_putc(ch); \
 	} \
 \
+	void printch(int ch) \
+	{ \
+		_printch(ch); \
+	} \
+\
 	void printascii(const char *str) \
 	{ \
 		while (*str) \
-			printch(*str++); \
+			_printch(*str++); \
 	} \
 \
 	static inline void printhex1(uint digit) \
-- 
2.1.4