SPM: Use SPMLOG_ERRMSG instead of ERROR_MSG macro

The ERROR_MSG() macro is still used through the code
although is not defined anymore. Use the SPMLOG_ERRMSG
macro instead to provide error message prints.

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: If23455e6f008b0ecc471579591c5d1e2e95cdccb
diff --git a/secure_fw/spm/cmsis_func/spm_func.c b/secure_fw/spm/cmsis_func/spm_func.c
index 0967844..1c8edbc 100644
--- a/secure_fw/spm/cmsis_func/spm_func.c
+++ b/secure_fw/spm/cmsis_func/spm_func.c
@@ -762,7 +762,7 @@
 
         if ((id != TFM_SP_CORE_ID) || (tfm_secure_lock != 0)) {
             /* Invalid request during system initialization */
-            ERROR_MSG("Invalid service request during initialization!");
+            SPMLOG_ERRMSG("Invalid service request during initialization!\r\n");
             return TFM_ERROR_NOT_INITIALIZED;
         }
     }
@@ -806,7 +806,7 @@
 
     res = tfm_check_sfn_req_integrity(desc_ptr);
     if (res != TFM_SUCCESS) {
-        ERROR_MSG("Invalid service request!");
+        SPMLOG_ERRMSG("Invalid service request!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -827,7 +827,7 @@
         tfm_spm_partition_set_state(
             desc_ptr->caller_part_idx, SPM_PARTITION_STATE_CLOSED);
         __enable_irq();
-        ERROR_MSG("Unauthorized service request!");
+        SPMLOG_ERRMSG("Unauthorized service request!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -835,7 +835,7 @@
     if (res != TFM_SUCCESS) {
         /* FixMe: consider possible fault scenarios */
         __enable_irq();
-        ERROR_MSG("Failed to process service request!");
+        SPMLOG_ERRMSG("Failed to process service request!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -877,7 +877,7 @@
         /* Unlock errors indicate ctx database corruption or unknown
          * anomalies. Halt execution
          */
-        ERROR_MSG("Secure API error during unlock!");
+        SPMLOG_ERRMSG("Secure API error during unlock!\r\n");
         tfm_secure_api_error_handler();
     }
     return (int32_t)res;
@@ -963,7 +963,7 @@
          * from Handler mode, which is not supported.
          * FixMe: error severity TBD
          */
-        ERROR_MSG("Service request SVC called with MSP active!");
+        SPMLOG_ERRMSG("Service request SVC called with MSP active!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -988,7 +988,7 @@
 
     if (excReturn & EXC_RETURN_STACK_PROCESS) {
         /* FixMe: error severity TBD */
-        ERROR_MSG("Partition request SVC called with PSP active!");
+        SPMLOG_ERRMSG("Partition request SVC called with PSP active!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -1048,7 +1048,7 @@
         /* Partition request SVC called with MSP active.
          * FixMe: error severity TBD
          */
-        ERROR_MSG("Partition request SVC called with MSP active!");
+        SPMLOG_ERRMSG("Partition request SVC called with MSP active!\r\n");
         tfm_secure_api_error_handler();
     }
 
@@ -1057,7 +1057,7 @@
         /* Unlock errors indicate ctx database corruption or unknown anomalies
          * Halt execution
          */
-        ERROR_MSG("Secure API error during unlock!");
+        SPMLOG_ERRMSG("Secure API error during unlock!\r\n");
         tfm_secure_api_error_handler();
     }
 
diff --git a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
index 879f991..aeec327 100644
--- a/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
+++ b/secure_fw/spm/cmsis_func/tfm_core_svcalls_func.c
@@ -102,6 +102,8 @@
     default:
 #ifdef PLATFORM_SVC_HANDLERS
         svc_args[0] = platform_svc_handlers(svc_num, svc_args, exc_return);
+#else
+        SPMLOG_ERRMSG("Unknown SVC number requested!\r\n");
 #endif
         break;
     }
diff --git a/secure_fw/spm/cmsis_func/tfm_secure_api.c b/secure_fw/spm/cmsis_func/tfm_secure_api.c
index d2647f8..cede704 100644
--- a/secure_fw/spm/cmsis_func/tfm_secure_api.c
+++ b/secure_fw/spm/cmsis_func/tfm_secure_api.c
@@ -11,7 +11,7 @@
 
 void tfm_secure_api_error_handler(void)
 {
-    ERROR_MSG("Security violation when calling secure API");
+    SPMLOG_ERRMSG("Security violation when calling secure API\r\n");
     tfm_core_panic();
 }
 
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 51adfc3..e1ea32c 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -115,7 +115,7 @@
 #ifdef PLATFORM_SVC_HANDLERS
         return (platform_svc_handlers(svc_num, ctx, lr));
 #else
-        ERROR_MSG("Unknown SVC number requested!");
+        SPMLOG_ERRMSG("Unknown SVC number requested!\r\n");
         return PSA_ERROR_GENERIC_ERROR;
 #endif
     }
diff --git a/secure_fw/spm/include/utilities.h b/secure_fw/spm/include/utilities.h
index 847e406..1a21a8a 100644
--- a/secure_fw/spm/include/utilities.h
+++ b/secure_fw/spm/include/utilities.h
@@ -33,6 +33,7 @@
 #define TO_CONTAINER(ptr, type, member) \
     (type *)((unsigned long)(ptr) - offsetof(type, member))
 
-#define ERROR_MSG(msg)
+/* FixMe: Replace ERROR_MSG() in platform code with a suitable API */
+#define ERROR_MSG(msg) SPMLOG_ERRMSG(msg "\r\n")
 
 #endif /* __TFM_UTILS_H__ */