SPM: Remove SFN model partition stack in level 1

In isolation level 1, the stack of partition in SFN model
is not used.

Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: Id3f1f3f4de043b24b006cde12f0712b4acc51452
diff --git a/tools/templates/partition_intermedia.template b/tools/templates/partition_intermedia.template
index a52a2cb..ad76662 100644
--- a/tools/templates/partition_intermedia.template
+++ b/tools/templates/partition_intermedia.template
@@ -9,4 +9,6 @@
 
 #include <stdint.h>
 
+{% if config_impl['CONFIG_TFM_SPM_BACKEND_IPC'] == '1' or manifest.model == "IPC" %}
 uint8_t {{manifest.name.lower()}}_stack[{{manifest.stack_size}}] __attribute__((aligned(8)));
+{% endif %}
diff --git a/tools/templates/partition_load_info.template b/tools/templates/partition_load_info.template
index 32d6e30..77c4b43 100644
--- a/tools/templates/partition_load_info.template
+++ b/tools/templates/partition_load_info.template
@@ -41,7 +41,10 @@
 REGION_DECLARE(Image$$, PT_{{manifest.name}}_PRIVATE, _DATA_START$$Base);
 REGION_DECLARE(Image$$, PT_{{manifest.name}}_PRIVATE, _DATA_END$$Base);
 #endif
+
+{% if config_impl['CONFIG_TFM_SPM_BACKEND_IPC'] == '1' or manifest.model == "IPC" %}
 extern uint8_t {{manifest.name|lower}}_stack[];
+{% endif %}
 
 {% if manifest.model == "IPC" %}
 /* Entrypoint function declaration */
@@ -111,14 +114,22 @@
 {% endif %}
                                     | PARTITION_PRI_{{manifest.priority}},
         .entry                      = ENTRY_TO_POSITION({{manifest.entry}}),
+{% if config_impl['CONFIG_TFM_SPM_BACKEND_IPC'] == '1' or manifest.model == "IPC" %}
         .stack_size                 = {{manifest.stack_size}},
+{% else %}
+        .stack_size                 = 0,
+{% endif %}
         .heap_size                  = 0,
         .ndeps                      = {{(manifest.name|upper + "_NDEPS")}},
         .nservices                  = {{(manifest.name|upper + "_NSERVS")}},
         .nassets                    = {{(manifest.name|upper + "_NASSETS")}},
         .nirqs                      = {{(manifest.name|upper + "_NIRQS")}},
     },
+{% if config_impl['CONFIG_TFM_SPM_BACKEND_IPC'] == '1' or manifest.model == "IPC" %}
     .stack_addr                     = (uintptr_t){{manifest.name|lower}}_stack,
+{% else %}
+    .stack_addr                     = 0,
+{% endif %}
     .heap_addr                      = 0,
 {% if counter.dep_counter > 0 %}
     .deps = {
@@ -142,13 +153,14 @@
         {% else %}
             .sfn                    = 0,
         {% endif %}
-#if CONFIG_TFM_SPM_BACKEND_IPC == 1
+{% if config_impl['CONFIG_TFM_SPM_BACKEND_IPC'] == '1' %}
         {% if manifest.model == "SFN" %}
             .signal                 = {{service.signal_value}},
         {% else %}
             .signal                 = {{service.name}}_SIGNAL,
         {% endif %}
-#endif /* CONFIG_TFM_SPM_BACKEND_IPC == 1 */
+{% endif %}
+
             .sid                    = {{service.sid}},
             .flags                  = 0
         {% if service.non_secure_clients is sameas true %}
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 3a2c049..a66b210 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -379,6 +379,7 @@
 
     partition_context = {}
     partition_context['utilities'] = context['utilities']
+    partition_context['config_impl'] = context['config_impl']
 
     manifesttemplate = ENV.get_template(os.path.join(sys.path[0], 'templates/manifestfilename.template'))
     memorytemplate = ENV.get_template(os.path.join(sys.path[0], 'templates/partition_intermedia.template'))