Platform: Map priority levels when parsing manifest list

The current partition priority categories used for naming sections are
lowest, low, normal, high and highest. The following statements are
used in the linker file.
   *(.part_load_priority_lowest)
   *(.part_load_priority_low)
   *(.part_load_priority_normal)
   *(.part_load_priority_high)
But the operation using this naming method can not put sections into
flash by the statement order.
Map priority levels by using numbers as follows so that .part_load_priority_00,
.part_load_priority_01 etc. can be sorted as expected.
   lowest: 00
   low: 01
   normal: 02
   high: 03
   higest: 04

Signed-off-by: Chendi Sun <chendi.sun@arm.com>
Change-Id: Ibc523fd5c813b0781fbea4a4eab974bfa43465c4
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 97c8e0c..9d3ce77 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -273,6 +273,13 @@
         'CONFIG_TFM_FLIH_API'                     : '0',
         'CONFIG_TFM_SLIH_API'                     : '0'
     }
+    priority_map = {
+        'LOWEST'              : '00',
+        'LOW'                 : '01',
+        'NORMAL'              : '02',
+        'HIGH'                : '03',
+        'HIGHEST'             : '04'
+    }
 
     isolation_level = int(configs['TFM_ISOLATION_LEVEL'], base = 10)
     backend = configs['CONFIG_TFM_SPM_BACKEND']
@@ -340,7 +347,7 @@
         manifest_path = manifest_item['manifest']
         with open(manifest_path) as manifest_file:
             manifest = yaml.safe_load(manifest_file)
-            # check manifest attribute validity
+            # Check manifest attribute validity
             manifest_attribute_check(manifest, manifest_item)
 
             if manifest.get('model', None) == 'dual':
@@ -349,6 +356,9 @@
                 manifest['model'] = backend
             manifest = manifest_validation(manifest, pid)
 
+            # Priority mapping
+            numbered_priority = priority_map[manifest['priority']]
+
         if pid == None or pid >= TFM_PID_BASE:
             # Count the number of IPC/SFN partitions
             if manifest['model'] == 'IPC':
@@ -413,7 +423,8 @@
                                'header_file': manifest_head_file,
                                'intermedia_file': intermedia_file,
                                'loadinfo_file': load_info_file,
-                               'output_dir':output_dir})
+                               'output_dir': output_dir,
+                               'numbered_priority': numbered_priority})
 
     logging.info("------------ Display partition configuration - end ------------")
 
@@ -482,6 +493,7 @@
         partition_context['manifest'] = one_partition['manifest']
         partition_context['attr'] = one_partition['attr']
         partition_context['manifest_out_basename'] = one_partition['manifest_out_basename']
+        partition_context['numbered_priority'] = one_partition['numbered_priority']
 
         logging.info ('Generating {} in {}'.format(one_partition['attr']['description'],
                                             one_partition['output_dir']))