Platform: Retarget: wait tx before sending

Wait pending transfers in stdio_output_string before initiating new.

Change-Id: I4897e15a798d76b920195f43572242f55993c99d
Signed-off-by: Gabor Abonyi <gabor.abonyi@arm.com>
diff --git a/platform/ext/common/uart_stdout.c b/platform/ext/common/uart_stdout.c
index ac37934..1797357 100644
--- a/platform/ext/common/uart_stdout.c
+++ b/platform/ext/common/uart_stdout.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 ARM Limited
+ * Copyright (c) 2017-2023 ARM Limited
  *
  * Licensed under the Apace License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@
 {
     int32_t ret;
 
+    /* Add a busy wait before sending. */
+    while (STDIO_DRIVER.GetStatus().tx_busy);
     ret = STDIO_DRIVER.Send(str, len);
     if (ret != ARM_DRIVER_OK) {
         return 0;