From 3d5500b437c706819075c0f91cbcd981bd5a153a Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Mon, 10 May 2021 16:23:02 +0200 Subject: LF -> CRLF on stdout --- fw/fe310/bsp/gloss/sys_write.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fw/fe310/bsp/gloss') diff --git a/fw/fe310/bsp/gloss/sys_write.c b/fw/fe310/bsp/gloss/sys_write.c index 2095940..458f9a4 100644 --- a/fw/fe310/bsp/gloss/sys_write.c +++ b/fw/fe310/bsp/gloss/sys_write.c @@ -4,6 +4,8 @@ #include "platform.h" +#define PUTC(c) { while (UART0_REG(UART_REG_TXFIFO) & 0x80000000); UART0_REG(UART_REG_TXFIFO) = (c); } + /* Write to a file. */ ssize_t _write(int fd, const void *ptr, size_t len) @@ -15,8 +17,8 @@ _write(int fd, const void *ptr, size_t len) const char *current = ptr; for (size_t i = 0; i < len; i++) { - while (UART0_REG(UART_REG_TXFIFO) & 0x80000000); - UART0_REG(UART_REG_TXFIFO) = current[i]; + if (current[i] == '\n') PUTC('\r'); + PUTC(current[i]); } return len; } -- cgit v1.2.3