]> begriffs open source - cmsis/blob - CMSIS/CoreValidation/Examples/IAR-EWARM8/build.py
CoreValidation: Fixed Validation test for Cortex-M33 without DSP on GCC.
[cmsis] / CMSIS / CoreValidation / Examples / IAR-EWARM8 / build.py
1 #! python
2
3 import sys
4 from argparse import ArgumentParser
5 from datetime import datetime
6
7 sys.path.append('../../../Utilities/buildutils') 
8
9 from iarcmd import IarCmd 
10 from fvpcmd import FvpCmd 
11 from testresult import TestResult
12
13 DEVICE_CM0  = 'Cortex-M0'
14 DEVICE_CM3  = 'Cortex-M3'
15 DEVICE_CM4  = 'Cortex-M4'
16 DEVICE_CM7  = 'Cortex-M7'
17 DEVICE_CM23 = 'Cortex-M23'
18 DEVICE_CM33 = 'Cortex-M33'
19
20 DEVICES = [ DEVICE_CM0, DEVICE_CM3, DEVICE_CM4, DEVICE_CM7, DEVICE_CM23, DEVICE_CM33 ]
21
22 SKIP = [ 
23   ]
24   
25 FVP_MODELS = { 
26     DEVICE_CM0  : { 'cmd': "fvp_mps2_cortex-m0.exe",  'args': { 'limit': "2000000" } },
27     DEVICE_CM3  : { 'cmd': "fvp_mps2_cortex-m3.exe",  'args': { 'limit': "2000000" } },
28     DEVICE_CM4  : { 'cmd': "fvp_mps2_cortex-m4.exe",  'args': { 'limit': "5000000" } },
29     DEVICE_CM7  : { 'cmd': "fvp_mps2_cortex-m7.exe",  'args': { 'limit': "5000000" } },
30     DEVICE_CM23 : { 'cmd': "fvp_mps2_cortex-m23.exe", 'args': { 'limit': "5000000", 'config': "ARMCM23_TZ_config.txt",        'target': "cpu0" } },
31     DEVICE_CM33 : { 'cmd': "fvp_mps2_cortex-m33.exe", 'args': { 'limit': "5000000", 'config': "ARMCM33_DSP_FP_TZ_config.txt", 'target': "cpu0" } }
32   }
33
34 def isSkipped(dev):
35   for skip in SKIP:
36     skipDev = (skip[0] == None or skip[0] == dev)
37     if skipDev and skipCc and skipTarget:
38       return True
39   return False
40
41 def prepare(steps, args):
42   for dev in args.devices:
43     if not isSkipped(dev):
44       if args.execute_only:
45         build = None
46       else:
47         build = IarCmd(dev+"/CMSIS_CV.ewp", "Debug")
48       if args.build_only:
49         test = None
50       else:
51         test = FvpCmd(FVP_MODELS[dev]['cmd'], dev+"/Debug/Exe/CMSIS_CV.out", **FVP_MODELS[dev]['args'])
52       steps += [ { 'name': dev, 'prefix': dev, 'build': build, 'test': test } ]
53
54 def execute(steps):
55   for step in steps:
56     print step['name']
57     if step['build']:
58       step['build'].run()
59     else:
60       print "Skipping build"
61       
62     if (not step['build']) or step['build'].isSuccess():
63       step['test'].run()
64       step['result'] = TestResult(step['test'].getOutput())
65       step['result'].saveXml("result_{0}_{1}.xml".format(step['prefix'], datetime.now().strftime("%Y%m%d%H%M%S")))
66     else:
67       print "Skipping test"
68       
69 def printSummary(steps):
70   print ""
71   print "Test Summary"
72   print "============"
73   print
74   print "Test run                       Total Exec  Pass  Fail  "
75   print "-------------------------------------------------------"
76   for step in steps:
77     try:
78       print "{0:30} {1:>4}  {2:>4}  {3:>4}  {4:>4}".format(step['name'], *step['result'].getSummary())
79     except:
80       print "{0:30} ------ NO RESULTS ------".format(step['name'])
81
82 def main(argv):
83   parser = ArgumentParser()
84   parser.add_argument('-b', '--build-only', action='store_true')
85   parser.add_argument('-e', '--execute-only', action='store_true')
86   parser.add_argument('-d', '--devices', nargs='*', choices=DEVICES, default=DEVICES, help = 'Devices to be considered.')
87   args = parser.parse_args()
88     
89   steps = []
90
91   prepare(steps, args)
92   
93   execute(steps)
94   
95   printSummary(steps)
96   
97 if __name__ == "__main__":
98   main(sys.argv[1:])