Core: separate IPC and veneer fn-based code

Improve separation of IPC and veneer function-based code in the
source tree for memory optimization and better readability of source:
- Do not compile unused SVC handler functions if using IPC messaging
- Avoid activation of MPU regions not needed in selected build
  configuration
- Flag error if a service veneer function is called when running IPC
  messaging
- Do not include memory bounds for partitions in SPM database if
  level 1 isolation and veneer functions are used to save memory

Signed-off-by: Miklos Balint <miklos.balint@arm.com>
Change-Id: Iaef91e69061b639a71ec8cb638b6393762d10761
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index b8827b4..6e6e25c 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -57,7 +57,9 @@
     struct spm_partition_static_data_t static_data;
     struct spm_partition_runtime_data_t runtime_data;
     struct tfm_spm_partition_platform_data_t *platform_data;
+#if (TFM_LVL != 1) || defined(TFM_PSA_API)
     struct tfm_spm_partition_memory_data_t memory_data;
+#endif
 #ifdef TFM_PSA_API
     struct tfm_thrd_ctx sp_thrd;
 #endif
@@ -66,8 +68,12 @@
 /* Macros to pick linker symbols and allow to form the partition data base */
 #define REGION(a, b, c) a##b##c
 #define REGION_NAME(a, b, c) REGION(a, b, c)
+#if (TFM_LVL == 1) && !defined(TFM_PSA_API)
+#define REGION_DECLARE(a, b, c)
+#else
 #define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
 #define PART_REGION_ADDR(partition, region) \
     (uint32_t)&REGION_NAME(Image$$, partition, region)
+#endif
 
 #endif /* __SPM_DB_H__ */