From 6a378f71a0199784e1808bf4808c9e49a2d62474 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sat, 17 Aug 2019 11:34:20 +0200 Subject: [PATCH] cpu/esp32: fixes printf and puts printf and puts used ets_printf before. Unfortunately, ets_printf adds an additional \r for each \n which is not consistent with other RIOT platforms. As a result some automatic tests failed. Therefore, both functions write now character-wise directly to the UART interface. --- cpu/esp32/syscalls.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cpu/esp32/syscalls.c b/cpu/esp32/syscalls.c index 09d16eafbc..99850fa964 100644 --- a/cpu/esp32/syscalls.c +++ b/cpu/esp32/syscalls.c @@ -91,8 +91,12 @@ int IRAM puts(const char *s) if (!s) { return EOF; } - ets_printf("%s\n", s); - return strlen(s); + int len = strlen(s); + for (int i = 0; i < len; i++) { + __wrap_putchar(s[i]); + } + __wrap_putchar('\n'); + return len; } char _printf_buf[PRINTF_BUFSIZ]; @@ -105,7 +109,9 @@ int IRAM printf(const char* format, ...) int ret = vsnprintf(_printf_buf, PRINTF_BUFSIZ, format, arglist); if (ret > 0) { - ets_printf (_printf_buf); + for (int i = 0; i < ret; i++) { + __wrap_putchar(_printf_buf[i]); + } } va_end(arglist);