Build: IAR build fix

Signed-off-by: Dávid Házi <david.hazi@arm.com>
Change-Id: Ibbf190245cfe0682f01aebe028a7c7e63130a157
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
index 897d4c1..3e3273d 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
@@ -26,7 +26,10 @@
 /* IAR Specific */
 #if defined(__ICCARM__)
 
+#if CONFIG_TFM_SPM_BACKEND_IPC == 1
 #pragma required = ipc_schedule
+#endif
+
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
index ac089bd..1a91d81 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
@@ -28,7 +28,10 @@
 /* IAR Specific */
 #if defined(__ICCARM__)
 
+#if CONFIG_TFM_SPM_BACKEND_IPC == 1
 #pragma required = ipc_schedule
+#endif
+
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
index ff69b39..13c0cd7 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
@@ -31,7 +31,10 @@
 /* IAR Specific */
 #if defined(__ICCARM__)
 
+#if CONFIG_TFM_SPM_BACKEND_IPC == 1
 #pragma required = ipc_schedule
+#endif
+
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
@@ -100,7 +103,7 @@
         "   ands    r0, lr                              \n" /* NS interrupted */
         "   beq     v8m_pendsv_exit                     \n" /* No schedule */
         "   push    {r0, lr}                            \n" /* Save R0, LR */
-        "   bl      ipc_schedule                         \n"
+        "   bl      ipc_schedule                        \n"
         "   pop     {r2, lr}                            \n"
         "   cmp     r0, r1                              \n" /* curr, next ctx */
         "   beq     v8m_pendsv_exit                     \n" /* No schedule */
@@ -124,15 +127,12 @@
 }
 #endif
 
-#if defined(__ICCARM__)
-uint32_t tfm_core_svc_handler(uint32_t *msp, uint32_t exc_return,
-                              uint32_t *psp);
-#pragma required = tfm_core_svc_handler
-#endif
-
 __attribute__((naked)) void SVC_Handler(void)
 {
     __ASM volatile(
+#if !defined(__ICCARM__)
+    ".syntax unified                        \n"
+#endif
     "MRS     r0, MSP                        \n"
     "MOV     r1, lr                         \n"
     "MRS     r2, PSP                        \n"
diff --git a/toolchain_IARARM.cmake b/toolchain_IARARM.cmake
index 2c10b21..ea0a67f 100644
--- a/toolchain_IARARM.cmake
+++ b/toolchain_IARARM.cmake
@@ -26,6 +26,8 @@
 set(LINKER_VENEER_OUTPUT_FLAG --import_cmse_lib_out= )
 set(COMPILER_CMSE_FLAG --cmse)
 
+set(CMAKE_C_FLAGS_DEBUG "-r -On")
+
 # This variable name is a bit of a misnomer. The file it is set to is included
 # at a particular step in the compiler initialisation. It is used here to
 # configure the extensions for object files. Despite the name, it also works