Lib Model: Fix the build issues for Library Model

1. config_impl.h is not for Library Model, adds #ifdef TFM_PSA_API
   for it.
2. Library Model shares the "entry_point" or "entry_init" in manifest
   It should also has checks on these attributes.

Change-Id: Ie905794ef0ab1f6a0729d0b16eabf0ec9ac2587f
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/interface/include/psa_config.h b/interface/include/psa_config.h
index 1946e52..bd2cf5b 100644
--- a/interface/include/psa_config.h
+++ b/interface/include/psa_config.h
@@ -24,8 +24,11 @@
  */
 #if defined(CONFIG_TFM_BUILDING_SPE)
 
+#ifdef TFM_PSA_API
 /* SPE has specific configurations. */
 #include "config_impl.h"
+#endif /* TFM_PSA_API */
+
 #include "psa_interface_redirect.h"
 
 #endif
diff --git a/secure_fw/spm/cmsis_func/tfm_spm_db_func.inc.template b/secure_fw/spm/cmsis_func/tfm_spm_db_func.inc.template
index ca19977..bcf558d 100644
--- a/secure_fw/spm/cmsis_func/tfm_spm_db_func.inc.template
+++ b/secure_fw/spm/cmsis_func/tfm_spm_db_func.inc.template
@@ -34,8 +34,11 @@
 /** Declarations of partition init functions */
 /**************************************************************************/
 {% for partition in partitions %}
+    {% if partition.manifest.entry_point %}
 extern void {{partition.manifest.entry_point}}(void);
-
+    {% elif partition.manifest.entry_init %}
+extern void {{partition.manifest.entry_init}}(void);
+    {% endif %}
 {% endfor %}
 /**************************************************************************/
 /** Context stacks for IRQ handling */
@@ -120,7 +123,13 @@
     {% endif %}
                               ,
         .partition_priority   = TFM_PRIORITY({{partition.manifest.priority}}),
+    {% if partition.manifest.entry_point %}
         .partition_init       = {{partition.manifest.entry_point}},
+    {% elif partition.manifest.entry_init %}
+        .partition_init       = {{partition.manifest.entry_init}},
+    {% else %}
+        .partition_init       = NULL,
+    {% endif %}
         .dependencies_num     = {{partition.manifest.dependencies | length()}},
     {% if partition.manifest.dependencies %}
         .p_dependencies       = dependencies_{{partition.manifest.name}},