Build: Follow the 'source_structure.rst'

This is the first patch to follow the first commit of source structure
document. The items under the 'secure_fw' folder are re-organized:

- Create/Move some folders/files to follow document.
- Rename some folders to foll, for example, 'secure_fw/services' to
  'secure_fw/partitions'.
- Update affected files to make it work.

This is a big change, to make the structure meet the basic shape of
the structure document defined, and make it easier to be understood
for users. Staging changes are not applicable so they are combined
into one - and because it is not the final shape yet, so:

- Upcoming updates on the 'secure_fw' folder would follow up soon.
- Fine-tune about the 'source_structure.rst' would come, too.

Change-Id: I5c11175e0a4579cd9b42d3e3519dbffb87334d0b
Signed-off-by: Ken Liu <ken.liu@arm.com>
diff --git a/tools/tfm_generated_file_list.yaml b/tools/tfm_generated_file_list.yaml
index dbe6042..3078ebb 100644
--- a/tools/tfm_generated_file_list.yaml
+++ b/tools/tfm_generated_file_list.yaml
@@ -18,20 +18,20 @@
     {
         "name": "Secure Partition declarations for library",
         "short_name": "tfm_partition_list_lib",
-        "template": "secure_fw/spm/tfm_spm_db_func.inc.template",
-        "output": "secure_fw/spm/tfm_spm_db_func.inc"
+        "template": "secure_fw/spm/model_func/tfm_spm_db_func.inc.template",
+        "output": "secure_fw/spm/model_func/tfm_spm_db_func.inc"
     },
     {
         "name": "Secure Partition declarations for IPC",
         "short_name": "tfm_partition_list_ipc",
-        "template": "secure_fw/spm/tfm_spm_db_ipc.inc.template",
-        "output": "secure_fw/spm/tfm_spm_db_ipc.inc"
+        "template": "secure_fw/spm/model_ipc/tfm_spm_db_ipc.inc.template",
+        "output": "secure_fw/spm/model_ipc/tfm_spm_db_ipc.inc"
     },
     {
         "name": "Secure Service list",
         "short_name": "tfm_service_list",
-        "template": "secure_fw/services/tfm_service_list.inc.template",
-        "output": "secure_fw/services/tfm_service_list.inc"
+        "template": "secure_fw/partitions/tfm_service_list.inc.template",
+        "output": "secure_fw/partitions/tfm_service_list.inc"
     },
     {
         "name": "Common secure ld file",
@@ -54,8 +54,8 @@
     {
         "name": "Secure Veneers C file",
         "short_name": "tfm_veneers_c",
-        "template": "secure_fw/ns_callable/tfm_veneers.c.template",
-        "output": "secure_fw/ns_callable/tfm_veneers.c"
+        "template": "secure_fw/spm/model_func/tfm_veneers.c.template",
+        "output": "secure_fw/spm/model_func/tfm_veneers.c"
     },
     {
         "name": "Secure Veneers H file",
@@ -66,14 +66,14 @@
     {
         "name": "Secure IRQ handlers",
         "short_name": "tfm_secure_irq_handlers",
-        "template": "secure_fw/core/tfm_secure_irq_handlers.inc.template",
-        "output": "secure_fw/core/tfm_secure_irq_handlers.inc"
+        "template": "secure_fw/spm/model_func/tfm_secure_irq_handlers.inc.template",
+        "output": "secure_fw/spm/model_func/tfm_secure_irq_handlers.inc"
     },
     {
         "name": "Secure IRQ handlers for PSA API",
         "short_name": "tfm_secure_irq_handlers_ipc",
-        "template": "secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc.template",
-        "output": "secure_fw/core/ipc/tfm_secure_irq_handlers_ipc.inc"
+        "template": "secure_fw/spm/model_ipc/tfm_secure_irq_handlers_ipc.inc.template",
+        "output": "secure_fw/spm/model_ipc/tfm_secure_irq_handlers_ipc.inc"
     },
     {
         "name": "SID H file",
diff --git a/tools/tfm_manifest_list.yaml b/tools/tfm_manifest_list.yaml
index 40ecf8c..c7cef7a 100644
--- a/tools/tfm_manifest_list.yaml
+++ b/tools/tfm_manifest_list.yaml
@@ -14,7 +14,7 @@
     {
       "name": "Secure Storage Service",
       "short_name": "TFM_SP_STORAGE",
-      "manifest": "secure_fw/services/secure_storage/tfm_secure_storage.yaml",
+      "manifest": "secure_fw/partitions/secure_storage/tfm_secure_storage.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": true,
       "conditional": "TFM_PARTITION_SECURE_STORAGE",
@@ -33,7 +33,7 @@
     {
       "name": "TF-M Internal Trusted Storage Service",
       "short_name": "TFM_SP_ITS",
-      "manifest": "secure_fw/services/internal_trusted_storage/tfm_internal_trusted_storage.yaml",
+      "manifest": "secure_fw/partitions/internal_trusted_storage/tfm_internal_trusted_storage.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": true,
       "conditional": "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE",
@@ -49,7 +49,7 @@
     {
       "name": "TFM Audit Log Service",
       "short_name": "TFM_SP_AUDIT_LOG",
-      "manifest": "secure_fw/services/audit_logging/tfm_audit_logging.yaml",
+      "manifest": "secure_fw/partitions/audit_logging/tfm_audit_logging.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": false,
       "conditional": "TFM_PARTITION_AUDIT_LOG",
@@ -65,7 +65,7 @@
     {
       "name": "TFM Crypto Service",
       "short_name": "TFM_SP_CRYPTO",
-      "manifest": "secure_fw/services/crypto/tfm_crypto.yaml",
+      "manifest": "secure_fw/partitions/crypto/tfm_crypto.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": true,
       "conditional": "TFM_PARTITION_CRYPTO",
@@ -81,7 +81,7 @@
     {
       "name": "TFM Platform Service",
       "short_name": "TFM_SP_PLATFORM",
-      "manifest": "secure_fw/services/platform/tfm_platform.yaml",
+      "manifest": "secure_fw/partitions/platform/tfm_platform.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": true,
       "conditional": "TFM_PARTITION_PLATFORM",
@@ -97,7 +97,7 @@
     {
       "name": "TFM Initial Attestation Service",
       "short_name": "TFM_SP_INITIAL_ATTESTATION",
-      "manifest": "secure_fw/services/initial_attestation/tfm_initial_attestation.yaml",
+      "manifest": "secure_fw/partitions/initial_attestation/tfm_initial_attestation.yaml",
       "tfm_extensions": true,
       "tfm_partition_ipc": true,
       "conditional": "TFM_PARTITION_INITIAL_ATTESTATION",
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 319e48b..cca2cac 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -9,7 +9,7 @@
 import io
 import sys
 import argparse
-from jinja2 import Environment, BaseLoader, select_autoescape
+from jinja2 import Environment, BaseLoader, select_autoescape, TemplateNotFound
 
 try:
     import yaml
@@ -84,7 +84,7 @@
         manifest_dic = yaml.safe_load(manifest_list_yaml_file)
         manifest_list.extend(manifest_dic["manifest_list"])
 
-    templatefile_name = 'secure_fw/services/manifestfilename.template'
+    templatefile_name = 'secure_fw/partitions/manifestfilename.template'
     template = ENV.get_template(templatefile_name)
 
     for manifest_item in manifest_list: