LIB: Add with_marker argument to tfm_vprintf

The underlying tfm_vprintf function can now be called
tfm_vprintf_unpriv, which is called from the runtime FW vprintf
implementation. This function will be called without a marker character
at the beginning of the string and therefore will cause an assertion to
be triggered within the vprintf implementation. Add a new argument which
specifies whether or not there is a marker character.

Change-Id: I58bc8cfa44f348766408d6e1fcf3fa995c3f6131
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
diff --git a/lib/tfm_vprintf/inc/tfm_vprintf_priv.h b/lib/tfm_vprintf/inc/tfm_vprintf_priv.h
index fa7d24d..b15ac03 100644
--- a/lib/tfm_vprintf/inc/tfm_vprintf_priv.h
+++ b/lib/tfm_vprintf/inc/tfm_vprintf_priv.h
@@ -10,6 +10,7 @@
 
 #include <stdint.h>
 #include <stdarg.h>
+#include <stdbool.h>
 
 /**
  * \typedef tfm_log_output_str
@@ -35,10 +36,12 @@
   *
   * \param[in] output_func  Pointer to the output function that handles the formatted string.
   * \param[in] priv         Pointer to user-defined context, passed to the output function.
-  * \param[in] fmt          Format string specifying how to format the output. This is expected
-  *                         to begin with a MARKER character.
+  * \param[in] fmt          Format string specifying how to format the output.
   * \param[in] args         Variable argument list to match the format string.
+  * \param[in] with_marker  Whether or not the fmt string starts with a MARKER character.
+  *                         This is expected to be used for standard logging use cases.
   */
-void tfm_vprintf(tfm_log_output_str output_func, void *priv, const char *fmt, va_list args);
+void tfm_vprintf(tfm_log_output_str output_func, void *priv, const char *fmt, va_list args,
+                 bool with_marker);
 
 #endif /* __TF_M_VPRINTF_PRIV_H__ */
diff --git a/lib/tfm_vprintf/src/tfm_vprintf.c b/lib/tfm_vprintf/src/tfm_vprintf.c
index 5999dab..ed57e58 100644
--- a/lib/tfm_vprintf/src/tfm_vprintf.c
+++ b/lib/tfm_vprintf/src/tfm_vprintf.c
@@ -214,18 +214,19 @@
     }
 }
 
-void tfm_vprintf(tfm_log_output_str output_func, void *priv, const char *fmt, va_list args)
+void tfm_vprintf(tfm_log_output_str output_func, void *priv, const char *fmt, va_list args,
+                 bool with_marker)
 {
     uint8_t log_marker;
     const char spacer = ' ';
 
-    /* We expect the LOG_MARKER_* macro as the first character */
-    log_marker = fmt[0];
-    fmt++;
-
-    if (log_marker != LOG_RAW_VALUE) {
-        output_str_not_formatted(output_func, priv, get_log_prefix(log_marker));
-        output_char(output_func, priv, spacer);
+    if (with_marker) {
+        log_marker = fmt[0];
+        fmt++;
+        if (log_marker != LOG_RAW_VALUE) {
+            output_str_not_formatted(output_func, priv, get_log_prefix(log_marker));
+            output_char(output_func, priv, spacer);
+        }
     }
 
     tfm_vprintf_internal(output_func, priv, fmt, args);