SPM: Refine the output format of TF-M version

Add some macros to support TF-M version printed in decimal format.

Change-Id: I9f4195abd2ad9cb2eedcdf402ce17f5b4270d6b2
Signed-off-by: Shawn Shan <Shawn.Shan@arm.com>
diff --git a/secure_fw/spm/cmsis_func/main.c b/secure_fw/spm/cmsis_func/main.c
index bfc11cd..59b91ee 100644
--- a/secure_fw/spm/cmsis_func/main.c
+++ b/secure_fw/spm/cmsis_func/main.c
@@ -30,12 +30,6 @@
 #error Only TFM_LVL 1 is supported for library model!
 #endif
 
-#define PRINT_TFM_VERSION  SPMLOG_INFMSGVAL("Booting TFM v", VERSION_MAJOR); \
-                           SPMLOG_INFMSGVAL(".", VERSION_MINOR); \
-                           SPMLOG_INFMSG(" "); \
-                           SPMLOG_INFMSG(VERSION_STRING); \
-                           SPMLOG_INFMSG("\r\n")
-
 REGION_DECLARE(Image$$, ARM_LIB_STACK_MSP,  $$ZI$$Base);
 
 static int32_t tfm_core_init(void)
@@ -138,7 +132,7 @@
         tfm_core_panic();
     }
     /* Print the TF-M version */
-    PRINT_TFM_VERSION;
+    SPMLOG_INFMSG("\033[1;34mBooting TFM v"VERSION_FULLSTR"\033[0m\r\n");
 
     if (tfm_spm_db_init() != SPM_ERR_OK) {
         tfm_core_panic();
diff --git a/secure_fw/spm/cmsis_psa/main.c b/secure_fw/spm/cmsis_psa/main.c
index e539de6..dcb13ec 100644
--- a/secure_fw/spm/cmsis_psa/main.c
+++ b/secure_fw/spm/cmsis_psa/main.c
@@ -29,12 +29,6 @@
 #error Only TFM_LVL 1 and 2 are supported for IPC model!
 #endif
 
-#define PRINT_TFM_VERSION  SPMLOG_INFMSGVAL("Booting TFM v", VERSION_MAJOR); \
-                           SPMLOG_INFMSGVAL(".", VERSION_MINOR); \
-                           SPMLOG_INFMSG(" "); \
-                           SPMLOG_INFMSG(VERSION_STRING); \
-                           SPMLOG_INFMSG("\r\n")
-
 REGION_DECLARE(Image$$, ARM_LIB_STACK_MSP,  $$ZI$$Base);
 
 static int32_t tfm_core_init(void)
@@ -133,7 +127,7 @@
         tfm_core_panic();
     }
     /* Print the TF-M version */
-    PRINT_TFM_VERSION;
+    SPMLOG_INFMSG("\033[1;34mBooting TFM v"VERSION_FULLSTR"\033[0m\r\n");
 
     if (tfm_spm_db_init() != SPM_ERR_OK) {
         tfm_core_panic();
diff --git a/secure_fw/spm/include/tfm_version.h b/secure_fw/spm/include/tfm_version.h
index 086a377..9924146 100644
--- a/secure_fw/spm/include/tfm_version.h
+++ b/secure_fw/spm/include/tfm_version.h
@@ -15,4 +15,11 @@
 #define VERSION_MINOR    1
 #define VERSION_STRING   ""
 
+#define VERSTR(x)      #x
+#define VERCON(major, minor) VERSTR(major)"."VERSTR(minor)
+
+#define VERSION_FULLSTR VERCON(VERSION_MAJOR, VERSION_MINOR)""VERSION_STRING
+
+
+
 #endif /* __TFM_VERSION_H__ */