From 545e849d2897ca4501fccb1c8658d0522e138e30 Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Mon, 12 Aug 2019 17:17:57 +0200 Subject: [PATCH] hack(ble): Also print stuff on USB uart --- lib/sdk/Libraries/Boards/Source/stdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sdk/Libraries/Boards/Source/stdio.c b/lib/sdk/Libraries/Boards/Source/stdio.c index 2f98aac0..ee4eeac2 100644 --- a/lib/sdk/Libraries/Boards/Source/stdio.c +++ b/lib/sdk/Libraries/Boards/Source/stdio.c @@ -170,6 +170,7 @@ int __read(int file, unsigned char *ptr, size_t len) return num; } +__attribute__((weak)) void cdcacm_write(uint8_t *data, int len); /* newlib/libc printf() will eventually call write() to get the data to the stdout */ #if defined ( __GNUC__ ) // GNUC _write function prototype @@ -190,7 +191,10 @@ int __write(int file, const unsigned char *ptr, size_t len) for (n = 0; n < len; n++) { if (*ptr == '\n') { UART_WriteByte(MXC_UARTn,'\r'); + uint8_t tmp = '\r'; + cdcacm_write(&tmp, 1); } + cdcacm_write(ptr, 1); UART_WriteByte(MXC_UARTn,*ptr++); } break; -- GitLab