Build: Add LLVM toolchain support for an521 only.

Support for other platforms will follow.

Signed-off-by: Anton Komlev <anton.komlev@arm.com>
Change-Id: Id036ecd78bf8e8909af30f78b2bfe5262b78c6b9
diff --git a/platform/ext/common/uart_stdout.c b/platform/ext/common/uart_stdout.c
index 6e9277f..fec035a 100644
--- a/platform/ext/common/uart_stdout.c
+++ b/platform/ext/common/uart_stdout.c
@@ -81,6 +81,28 @@
     /* Return character written */
     return ch;
 }
+
+/* Redirect sdtio for PicoLib in LLVM toolchain
+   as per https://github.com/picolibc/picolibc/blob/main/doc/os.md
+   'fputch()' named intentionally different from 'fputc()' from picolib */
+#elif defined(__clang_major__)
+
+int fputch(char ch, struct __file *f)
+{
+    (void)f;
+
+    /* Send byte to USART */
+    (void)stdio_output_string((const char *)&ch, 1);
+
+    /* Return character written */
+    return ch;
+}
+
+static FILE __stdio = FDEV_SETUP_STREAM(fputch, NULL, NULL, _FDEV_SETUP_WRITE);
+FILE *const stdin = &__stdio;
+__strong_reference(stdin, stdout);
+__strong_reference(stdin, stderr);
+
 #elif defined(__GNUC__)
 /* Redirects printf to STDIO_DRIVER in case of GNUARM */
 int _write(int fd, char *str, int len)