Config: Add stm targets in single entry point

This patch allows to group all stm targets in single cmake entry point.
The stm TARGET_PLATFORM should prefix by "STM".
stm platforms supports CoreIPC, CoreIPCTfmLevel2 and RegressionIPCTfmLevel2
Build with GNUARM toolchain.

Change-Id: I6535420b2304c18f2ab260620c38fef632eb7488
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
diff --git a/bl2/ext/mcuboot/scripts/imgtool.py b/bl2/ext/mcuboot/scripts/imgtool.py
index 2d1d97b..b524245 100644
--- a/bl2/ext/mcuboot/scripts/imgtool.py
+++ b/bl2/ext/mcuboot/scripts/imgtool.py
@@ -24,6 +24,7 @@
 from imgtool_lib import version
 import sys
 import macro_parser
+import fileinput
 
 sign_bin_size_re = re.compile(r"^\s*RE_SIGN_BIN_SIZE\s*=\s*(.*)")
 image_load_address_re = re.compile(r"^\s*RE_IMAGE_LOAD_ADDRESS\s*=\s*(.*)")
@@ -126,10 +127,30 @@
 
     img.save(args.outfile)
 
+def do_flash(args):
+    image_value_re = re.compile(r"^\s*"+args.macro+"\s*=\s*(.*)")
+    value = macro_parser.evaluate_macro(args.layout, image_value_re, 0, 1,
+                                        True)
+    if args.setting == 1:
+        begin_line="set "+args.begin
+    else:
+        begin_line=args.begin
+
+    for line in fileinput.input(args.infile, inplace=True):
+        if line.startswith(begin_line):
+            if args.division:
+                value = int(value/int(args.division))
+            if args.phexa == 0:
+                line = begin_line+"="+str(value)+"\n"
+            else:
+                line = begin_line+"="+hex(value)+"\n"
+        sys.stdout.write(line)
+
 subcmds = {
         'keygen': do_keygen,
         'getpub': do_getpub,
-        'sign': do_sign, }
+        'sign': do_sign,
+        'flash': do_flash, }
 
 
 def get_dependencies(text):
@@ -205,6 +226,23 @@
     sign.add_argument("infile")
     sign.add_argument("outfile")
 
+    flash = subs.add_parser('flash', help='modify flash script')
+    flash.add_argument("infile")
+    flash.add_argument('-l', '--layout', required=True,
+                      help='Location of the file that contains preprocessed macros')
+    flash.add_argument('-m', '--macro', required =True,
+                      help='macro symbol string to grep in preprocessed file')
+    flash.add_argument('-b', '--begin', required=True,
+                      help='begin of line to replace ')
+    flash.add_argument('-s', '--setting',type=intparse,required=False,default=0,
+                      help='search for window batch set variable')
+    flash.add_argument('-d', '--division',
+                       required=False,type=intparse,default=0,
+                      help='search for window batch set variable')
+    flash.add_argument('-p', '--phexa',
+                       required=False,type=intparse,default=1,
+                      help='print value in hexa')
+
     args = parser.parse_args()
     if args.subcmd is None:
         print('Must specify a subcommand', file=sys.stderr)
diff --git a/bl2/ext/mcuboot/scripts/macro_parser.py b/bl2/ext/mcuboot/scripts/macro_parser.py
index 3f7feb6..188c650 100644
--- a/bl2/ext/mcuboot/scripts/macro_parser.py
+++ b/bl2/ext/mcuboot/scripts/macro_parser.py
@@ -47,7 +47,7 @@
 # Opens a file that contains the macro of interest, then finds the macro with

 # a regular expression, parses the expression that is defined for the given

 # macro. Lastly it evaluates the expression with the parse_and_sum function

-def evaluate_macro(file, regexp, matchGroupKey, matchGroupData):

+def evaluate_macro(file, regexp, matchGroupKey, matchGroupData, bracketless=False):

     regexp_compiled = re.compile(regexp)

 

     if os.path.isabs(file):

@@ -59,6 +59,9 @@
     macroValue = {}

     with open(configFile, 'r') as macros_preprocessed_file:

         for line in macros_preprocessed_file:

+            if bracketless:

+                line=line.replace("(","")

+                line=line.replace(")","")

             m = regexp_compiled.match(line)

             if m is not None:

                 macroValue[m.group(matchGroupKey)] = \