Platform: Refactor generic USART device usage

Add an extra config layer in cmsis_driver_config.h to platform
specifically select the UART device to be used with the required
security domain for TFM core and Non-Secure application separately.
This way the platform independent TFM core UART usage becomes
completely platform agnostic, using a generic CMSIS UART device.

Change-Id: I3e957fcc4df6d041fef2f350c2d7b329a368a220
Signed-off-by: Gabor Kertesz <gabor.kertesz@arm.com>
diff --git a/app/main_ns.c b/app/main_ns.c
index fd40820..94eebc8 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -23,10 +23,11 @@
   "test/test_services/tfm_secure_client_service/tfm_secure_client_service_svc.h"
 #endif
 
+#include "target_cfg.h"
 #include "Driver_USART.h"
 
 /* For UART the CMSIS driver is used */
-extern ARM_DRIVER_USART Driver_USART0;
+extern ARM_DRIVER_USART NS_DRIVER_STDIO;
 
 /**
  * \brief Modified table template for user defined SVC functions
@@ -64,19 +65,21 @@
 // ...
 };
 
-/* Struct FILE is implemented in stdio.h. Used to redirect printf to UART0 */
+/* Struct FILE is implemented in stdio.h. Used to redirect printf to
+ * NS_DRIVER_STDIO
+ */
 FILE __stdout;
-/* Redirects armclang printf to UART */
+/* Redirects armclang printf to NS_DRIVER_STDIO */
 int fputc(int ch, FILE *f) {
-    /* Send byte to UART0 */
-    (void)Driver_USART0.Send((const unsigned char *)&ch, 1);
+    /* Send byte to NS_DRIVER_STDIO */
+    (void)NS_DRIVER_STDIO.Send((const unsigned char *)&ch, 1);
     /* Return character written */
     return ch;
 }
-/* redirects gcc printf to uart */
+/* redirects gcc printf to NS_DRIVER_STDIO */
 int _write(int fd, char * str, int len)
 {
-    (void)Driver_USART0.Send(str, len);
+    (void)NS_DRIVER_STDIO.Send(str, len);
 
     return len;
 }
@@ -106,8 +109,8 @@
 #endif
 int main(void)
 {
-    (void)Driver_USART0.Initialize(NULL); /* Use UART0 as stdout */
-    Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS, 115200);
+    (void)NS_DRIVER_STDIO.Initialize(NULL);
+    NS_DRIVER_STDIO.Control(ARM_USART_MODE_ASYNCHRONOUS, 115200);
 
     status = osKernelInitialize();