4 from argparse import ArgumentParser
5 from datetime import datetime
7 sys.path.append('../../../Utilities/buildutils')
9 from uv4cmd import Uv4Cmd
10 from fvpcmd import FvpCmd
11 from testresult import TestResult
13 DEVICE_CM0 = 'Cortex-M0'
14 DEVICE_CM3 = 'Cortex-M3'
15 DEVICE_CM4f = 'Cortex-M4f'
16 DEVICE_CM7 = 'Cortex-M7'
17 DEVICE_CM23 = 'Cortex-M23'
18 DEVICE_CM33 = 'Cortex-M33'
26 DEVICES = [ DEVICE_CM0, DEVICE_CM3, DEVICE_CM4f, DEVICE_CM7 ]
27 COMPILERS = [ CC_AC5, CC_AC6, CC_GCC ]
28 TARGETS = [ TARGET_FVP ]
31 [ DEVICE_CM23, CC_GCC, None ],
32 [ DEVICE_CM33, CC_GCC, None ]
42 DEVICE_CM0 : { 'cmd': "fvp_mps2_cortex-m0.exe", 'args': { 'limit': "2000000" } },
43 DEVICE_CM3 : { 'cmd': "fvp_mps2_cortex-m3.exe", 'args': { 'limit': "2000000" } },
44 DEVICE_CM4f : { 'cmd': "fvp_mps2_cortex-m4.exe", 'args': { 'limit': "5000000" } },
45 DEVICE_CM7 : { 'cmd': "fvp_mps2_cortex-m7.exe", 'args': { 'limit': "5000000" } },
46 DEVICE_CM23 : { 'cmd': "fvp_mps2_cortex-m23.exe", 'args': { 'limit': "5000000", 'config': "ARMCM23_TZ_config.txt", 'target': "cpu0" } },
47 DEVICE_CM33 : { 'cmd': "fvp_mps2_cortex-m33.exe", 'args': { 'limit': "5000000", 'config': "ARMCM33_DSP_FP_TZ_config.txt", 'target': "cpu0" } }
50 def isSkipped(dev, cc, target):
52 skipDev = (skip[0] == None or skip[0] == dev)
53 skipCc = (skip[1] == None or skip[1] == cc)
54 skipTarget = (skip[2] == None or skip[2] == target)
55 if skipDev and skipCc and skipTarget:
59 def prepare(steps, args):
60 for dev in args.devices:
61 for cc in args.compilers:
62 for target in args.targets:
63 if not isSkipped(dev, cc, target):
64 config = "{dev} ({cc}, {target})".format(dev = dev, cc = cc, target = target)
65 prefix = "{dev}_{cc}_{target}".format(dev = dev, cc = cc, target = target)
69 build = Uv4Cmd("CMSIS_CV.uvprojx", config)
73 test = FvpCmd(FVP_MODELS[dev]['cmd'], "Objects\CMSIS_CV."+APP_FORMAT[cc], **FVP_MODELS[dev]['args'])
74 steps += [ { 'name': config, 'prefix': prefix, 'build': build, 'test': test } ]
82 print "Skipping build"
84 if (not step['build']) or step['build'].isSuccess():
86 step['result'] = TestResult(step['test'].getOutput())
87 step['result'].saveXml("result_{0}_{1}.xml".format(step['prefix'], datetime.now().strftime("%Y%m%d%H%M%S")))
91 def printSummary(steps):
96 print "Test run Total Exec Pass Fail "
97 print "-------------------------------------------------------"
100 print "{0:30} {1:>4} {2:>4} {3:>4} {4:>4}".format(step['name'], *step['result'].getSummary())
102 print "{0:30} ------ NO RESULTS ------".format(step['name'])
105 parser = ArgumentParser()
106 parser.add_argument('-b', '--build-only', action='store_true')
107 parser.add_argument('-e', '--execute-only', action='store_true')
108 parser.add_argument('-d', '--devices', nargs='*', choices=DEVICES, default=DEVICES, help = 'Devices to be considered.')
109 parser.add_argument('-c', '--compilers', nargs='*', choices=COMPILERS, default=COMPILERS, help = 'Compilers to be considered.')
110 parser.add_argument('-t', '--targets', nargs='*', choices=TARGETS, default=TARGETS, help = 'Targets to be considered.')
111 args = parser.parse_args()
121 if __name__ == "__main__":