-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
704 lines (638 loc) · 24.1 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
project('parrot', 'cpp',
default_options : ['warning_level=3',
'cpp_std=c++17',
'buildtype=debugoptimized'],
meson_version: '>=1.4.0',
)
# There is no way to check this in a meson script:
warning('installation of parrot is not supported. Do not invoke "meson install" or "ninja install".')
fs = import('fs')
## llvm dependency. We support version 15 only. By making a dependency here, we force that version for the rest of PARROT.
llvm_version = ['>=14', '<16']
llvm_dep = dependency('llvm', method: 'config-tool', version: llvm_version, include_type: 'system')
# Python
py3_mod = import('python')
py3_inst = py3_mod.find_installation('python3', modules: 'pyserial')
if py3_inst.language_version().version_compare('<3.10')
error('At least Python 3.10 is required.')
endif
nop = [py3_inst, '-c', 'pass']
toolchains = subproject('toolchains')
arm_enabled = toolchains.get_variable('arm_enabled')
posix_enabled = toolchains.get_variable('posix_enabled')
# ara
ara_proj = subproject('ara')
ara = find_program('ara', required: false)
if not ara.found()
ara = ara_proj.get_variable('ara_py')
endif
build_autosar_apps = get_option('build_autosar_apps')
build_gpslogger = get_option('build_gpslogger')
build_i4copter = get_option('build_i4copter')
build_infinitime = get_option('build_infinitime')
build_intel_ecfw = get_option('build_intel_ecfw')
build_ironos = get_option('build_ironos')
build_libmicrohttpd = get_option('build_libmicrohttpd')
build_librepilot = get_option('build_librepilot')
build_posix_apps = get_option('build_posix_apps')
build_synthetic_apps = get_option('build_synthetic_apps')
build_zephyr = get_option('build_zephyr')
summary({
'LibrePilot (build_librepilot)': build_librepilot,
'GPSLogger (build_gpslogger)': build_gpslogger,
'InfiniTime (build_infinitime)': build_infinitime,
'i4copter (build_i4copter)': build_i4copter,
'AUTOSAR applications (build_autosar_apps)': build_autosar_apps,
'sys_kernel/app_kernel (build_zephyr)': build_zephyr,
'Intel ECFW Zephyr (build_intel_ecfw)': build_intel_ecfw,
'POSIX applications (build_posix_apps)': build_posix_apps,
'Including libmicrohttpd (build_libmicrohttpd)': build_libmicrohttpd,
'IronOS (build_ironos)': build_ironos,
'Synthetic apps (build_synthetic_apps)': build_synthetic_apps,
}, bool_yn: true, section: 'Wanted applications')
subdir('tools')
# # experiment scripts use elsewhere
subdir('experiments')
# settings for freertos synthesis
freertos_gen_passthrough = files('settings' / 'freertos_gen_passthrough.json')[0]
freertos_gen_vanilla = files('settings' / 'freertos_gen_vanilla.json')[0]
freertos_gen_instances_full_static = files('settings' / 'freertos_gen_instances_full_static.json')[0]
freertos_gen_instances_full_initialized = files('settings' / 'freertos_gen_instances_full_initialized.json')[0]
# collect apps
arm_freertos_apps = []
sia_targets = []
ina_targets = []
all_lls = []
all_apps = []
if arm_enabled
foreach app : ara_proj.get_variable('arm_freertos_apps')
parrot_app = {
'name': app['name'],
'os': 'FreeRTOS',
'll': app['ll'],
'additional_libs': app['additional_libs'],
'freertos_config': app['freertos_config'],
'summary_section': 'ARA FreeRTOS apps',
'sia_settings': files('settings' / 'sia_freertos_generic.json')[0],
'ina_settings': files('settings' / 'ina_freertos_generic.json')[0],
}
arm_freertos_apps += [parrot_app]
all_lls += [app['ll']]
sia_targets += [parrot_app]
ina_targets += [parrot_app]
all_apps += [parrot_app]
endforeach
endif
if build_gpslogger
gpslogger_proj = subproject('GPSLogger')
gpslogger = {
'name': 'GPSLogger',
'os': 'FreeRTOS',
'll': gpslogger_proj.get_variable('gpslogger_application'),
'cflags': gpslogger_proj.get_variable('gpslogger_cflags'),
'includes': gpslogger_proj.get_variable('gpslogger_includes'),
'sia_settings': files('settings' / 'sia_gpslogger.json')[0],
'ina_settings': files('settings' / 'ina_gpslogger.json')[0],
'freertos_config': gpslogger_proj.get_variable('freertos_config'),
'cloc_app': gpslogger_proj.get_variable('cloc_app'),
'cloc_lib': gpslogger_proj.get_variable('cloc_lib'),
'summary_section': 'GPSLogger (FreeRTOS)',
}
all_lls += [gpslogger['ll']]
arm_freertos_apps += [gpslogger]
sia_targets += [gpslogger]
ina_targets += [gpslogger]
all_apps += [gpslogger]
endif
if build_librepilot
librepilot_proj = subproject('librepilot')
librepilot_translation_map = librepilot_proj.get_variable('translation_map')
librepilot_corrections = librepilot_proj.get_variable('instance_corrections')
conf_data = configuration_data()
conf_data.set('translation_map', librepilot_translation_map.full_path())
sia_settings = configure_file(input : files('settings' / 'sia_librepilot.json.in'),
output : 'sia_librepilot.json',
configuration : conf_data)
ina_settings = configure_file(input : files('settings' / 'ina_librepilot.json.in'),
output : 'ina_librepilot.json',
configuration : conf_data)
extra_settings = configure_file(input : files('settings' / 'synthesis_librepilot.json.in'),
output : 'synthesis_librepilot.json',
configuration : conf_data)
librepilot = {
'name': 'LibrePilot',
'os': 'FreeRTOS',
'll': librepilot_proj.get_variable('librepilot_mock_application'),
'cflags': librepilot_proj.get_variable('librepilot_cflags'),
'opt_flags': librepilot_proj.get_variable('librepilot_opt_flags'),
'ldflags': librepilot_proj.get_variable('librepilot_ldflags'),
'linkerscripts': librepilot_proj.get_variable('librepilot_linkerscripts'),
'asm_files': librepilot_proj.get_variable('librepilot_asm_files'),
'sia_settings': sia_settings,
'ina_settings': ina_settings,
'corrections': librepilot_proj.get_variable('instance_corrections'),
'extra_settings': extra_settings,
'freertos_config': librepilot_proj.get_variable('freertos_config'),
'cloc_app': librepilot_proj.get_variable('cloc_app'),
'summary_section': 'LibrePilot (FreeRTOS)',
}
all_lls += [librepilot['ll']]
arm_freertos_apps += [librepilot]
sia_targets += [librepilot]
ina_targets += [librepilot]
all_apps += [librepilot]
endif
if build_infinitime
infinitime_gllvm = subproject('infinitime-gllvm')
conf_data = configuration_data()
conf_data.set('translation_map', infinitime_gllvm.get_variable('translation_map').full_path())
sia_settings = configure_file(input : files('settings' / 'sia_infinitime.json.in'),
output : 'sia_infinitime.json',
configuration : conf_data)
ina_settings = configure_file(input : files('settings' / 'ina_infinitime.json.in'),
output : 'ina_infinitime.json',
configuration : conf_data)
infinitime = {
'name': 'InfiniTime',
'os': 'FreeRTOS',
'll': infinitime_gllvm.get_variable('infinitime_app'),
'sia_settings': sia_settings,
# 'ina_settings': ina_settings, # runs too long currently
'freertos_config': infinitime_gllvm.get_variable('freertos_config'),
'cloc_app': infinitime_gllvm.get_variable('cloc_app'),
'cloc_lib': infinitime_gllvm.get_variable('cloc_lib'),
'summary_section': 'InfiniTime (FreeRTOS)',
}
all_lls += [infinitime['ll']]
sia_targets += [infinitime]
# ina_targets += [infinitime]
all_apps += [infinitime]
endif
if build_ironos
ironos_source = subproject('IronOS')
ironos = {
'name': 'IronOS',
'os': 'FreeRTOS',
'll': ironos_source.get_variable('ironos_bc'),
'sia_settings': files('settings' / 'sia_ironos.json')[0],
'ina_settings': files('settings' / 'ina_ironos.json')[0],
'freertos_config': ironos_source.get_variable('freertos_config'),
'cloc_app': ironos_source.get_variable('cloc_app'),
'summary_section': 'IronOS (FreeRTOS)',
'va_corrections': ironos_source.get_variable('va_corrections'),
}
all_lls += [ironos['ll']]
sia_targets += [ironos]
ina_targets += [ironos]
all_apps += [ironos]
endif
if build_autosar_apps
autosar_targets = ara_proj.get_variable('autosar_targets')
foreach app : autosar_targets
if not (app.has_key('use_in_parrot') and app['use_in_parrot'])
continue
endif
conf_data = configuration_data()
conf_data.set('oil_file', app['oil'].full_path())
p_app = {
'name': 'autosar_app_' + app['name'],
'os': 'AUTOSAR',
'll': app['ll'],
'summary_section': 'AUTOSAR apps',
}
if app.has_key('sys_timings')
p_app = p_app + {
'sys_timings': app['sys_timings']
}
endif
if app['core'] == 'singlecore'
sse_settings = configure_file(input : files('settings' / 'sse_autosar_apps.json.in'),
output : 'sse_' + p_app['name'].underscorify() + '.json',
configuration : conf_data)
p_app = p_app + {'sse_settings': sse_settings}
endif
ina_settings = configure_file(input : files('settings' / 'ina_autosar_apps.json.in'),
output : 'ina_' + p_app['name'].underscorify() + '.json',
configuration : conf_data)
multisse_settings = configure_file(input : files('settings' / 'multisse_autosar_apps.json.in'),
output : 'multisse_' + p_app['name'].underscorify() + '.json',
configuration : conf_data)
p_app = p_app + {
'ina_settings': ina_settings,
'multisse_settings': multisse_settings,
}
all_lls += [p_app['ll']]
ina_targets += [p_app]
all_apps += [p_app]
endforeach
endif
if build_i4copter
copters = [
{'name': 'i4copter', 'code': ara_proj.get_variable('autosar_singlecore_complex_isorc')},
{'name': 'i4copter_mc', 'code': ara_proj.get_variable('autosar_multicore_complex_copter_autostart')},
{'name': 'i4copter_mco', 'code': ara_proj.get_variable('autosar_multicore_complex_copter_single_alarm')},
]
foreach copter : copters
conf_data = configuration_data()
conf_data.set('oil_file', copter['code']['oil'].full_path())
app = {
'name': copter['name'],
'os': 'AUTOSAR',
'll': copter['code']['ll'],
'summary_section': 'i4copter (AUTOSAR)',
}
if copter['code'].has_key('sys_timings')
app = app + {
'sys_timings': copter['code']['sys_timings']
}
endif
if copter['code']['core'] == 'singlecore'
conf_data.set('zero_round_limit', 30000)
sse_settings = configure_file(input : files('settings' / 'sse_i4copter.json.in'),
output : 'sse_' + copter['name'].underscorify() + '.json',
configuration : conf_data)
run_sse = 'sse-' + app['name'].to_lower()
run_target(run_sse,
command: [
py3_inst, ara, app['ll'],
'--os', app['os'],
'--log-level', 'info',
'--step-settings', sse_settings])
summary('Run SSE on ' + app['name'], 'meson compile ' + run_sse, section: app['summary_section'])
app = app + {'sse_settings': sse_settings}
else
conf_data.set('zero_round_limit', -1)
multisse_settings = configure_file(input : files('settings' / 'multisse_i4copter.json.in'),
output : 'multisse_' + copter['name'].underscorify() + '.json',
configuration : conf_data)
app = app + {'multisse_settings': multisse_settings}
endif
ina_settings = configure_file(input : files('settings' / 'ina_i4copter.json.in'),
output : 'ina_' + copter['name'].underscorify() + '.json',
configuration : conf_data)
app = app + {
'ina_settings': ina_settings,
}
run_multisse = 'multisse-' + app['name'].to_lower()
run_target(run_multisse,
command: [
py3_inst, ara, app['ll'],
'--os', app['os'],
'--log-level', 'info',
'--step-settings', multisse_settings])
summary('Run MultiSSE on ' + app['name'], 'meson compile ' + run_multisse, section: app['summary_section'])
all_lls += [app['ll']]
ina_targets += [app]
all_apps += [app]
endforeach
endif
zephyr_targets = []
zephyr_test_apps = []
if build_intel_ecfw
intel_ecfw_zephyr = subproject('intel-ecfw-zephyr')
zephyr_targets += intel_ecfw_zephyr.get_variable('zephyr_targets')
endif
if build_zephyr
ara_zephyr_apps = subproject('ara-zephyr-apps')
zephyr_targets += ara_zephyr_apps.get_variable('zephyr_targets')
endif
if build_intel_ecfw or build_zephyr
foreach tgt : zephyr_targets
ll = tgt['ll']
config = tgt['config']
name = fs.stem(ll.full_path())
conf_data = configuration_data()
conf_data.set('kconfig_file', config.full_path())
sia_settings = configure_file(input : files('settings' / f'sia_zephyr.json.in'),
output : f'sia_@[email protected]',
configuration : conf_data)
ina_settings = configure_file(input : files('settings' / f'ina_zephyr.json.in'),
output : f'ina_@[email protected]',
configuration : conf_data)
zephyr_app = {
'name': name,
'os': 'Zephyr',
'll': ll,
'sia_settings': sia_settings,
'ina_settings': ina_settings,
'cloc_app': tgt['cloc_app'],
'summary_section': 'ARA Zephyr Apps',
}
all_lls += [ll]
sia_targets += [zephyr_app]
ina_targets += [zephyr_app]
all_apps += [zephyr_app]
zephyr_test_apps += [zephyr_app]
endforeach
if get_option('execute_ara')
subdir('test/Zephyr')
endif
endif
if build_posix_apps
ara_posix_apps = subproject('ara-posix-apps')
posix_apps = ara_posix_apps.get_variable('posix_apps')
foreach app : posix_apps
posix_app = {
'name': app['name'],
'os': 'POSIX',
'll': app['ll'],
'sia_settings': files('settings' / 'sia_posix.json')[0],
'ina_settings': files('settings' / 'ina_posix.json')[0],
'summary_section': 'ARA POSIX Apps',
}
all_lls += [app['ll']]
sia_targets += [posix_app]
ina_targets += [posix_app]
all_apps += [posix_app]
endforeach
# Tests
if get_option('execute_ara')
subdir('test/POSIX')
endif
endif
if build_posix_apps and build_libmicrohttpd
# libmicrohttpd
libmicrohttpd_adapted = ara_posix_apps.get_variable('libmicrohttpd_app')
libmicrohttpd_orig = ara_posix_apps.get_variable('libmicrohttpd_orig_app')
# TODO make also libmicrohttpd_orig available
libmicrohttpd_apps = [libmicrohttpd_adapted] #, libmicrohttpd_orig]
foreach app : libmicrohttpd_apps
corrs = []
foreach corr : app['fp_corrections']
corrs += ['"' + corr + '"']
endforeach
conf_data = configuration_data()
conf_data.set('translation_map', ', '.join(corrs))
sia_settings = configure_file(input : files('settings' / 'sia_libmicrohttpd.json.in'),
output : 'sia_' + app['name'] + '.json',
configuration : conf_data)
ina_settings = configure_file(input : files('settings' / 'ina_libmicrohttpd.json.in'),
output : 'ina_' + app['name'] + '.json',
configuration : conf_data)
lmhd_app = {
'name': app['name'],
'os': 'POSIX',
'll': app['ll'],
'sia_settings': sia_settings,
'ina_settings': ina_settings,
'cloc_app': app['cloc_app'],
'summary_section': 'libmicrohttpd (POSIX)',
}
all_lls += [app['ll']]
sia_targets += [lmhd_app]
ina_targets += [lmhd_app]
all_apps += [lmhd_app]
endforeach
endif
# actual processing
if arm_freertos_apps.length() > 0
subdir('arm_freertos_synthesis')
endif
# sia targets
foreach app : sia_targets
corrections = files('settings' / 'no_corrections.json')[0]
if 'va_corrections' in app
corrections = app['va_corrections']
endif
run_sia = 'sia-' + app['name'].to_lower()
run_target(run_sia,
command: [
py3_inst, ara, app['ll'],
'--os', app['os'],
'--log-level', 'info',
'--with-stubs',
'--va-corrections', corrections.full_path(),
'--step-settings', app['sia_settings']])
summary('Run SIA on ' + app['name'], 'meson compile ' + run_sia, section: app['summary_section'])
endforeach
# ina targets
foreach app : ina_targets
corrections = files('settings' / 'no_corrections.json')[0]
if 'va_corrections' in app
corrections = app['va_corrections']
endif
run_ina = 'ina-' + app['name'].to_lower()
run_target(run_ina,
command: [
py3_inst, ara, app['ll'],
'--os', app['os'],
'--log-level', 'info',
'--va-corrections', corrections.full_path(),
'--step-settings', app['ina_settings']])
summary('Run INA on ' + app['name'], 'meson compile ' + run_ina, section: app['summary_section'])
endforeach
# TODO: add SSE and MultiSSE
build_all_lls = 'build-all-lls'
run_target(build_all_lls,
command: nop,
depends: all_lls,
)
summary('Build all application to LLVM IR', 'meson compile ' + build_all_lls, section: 'generic')
# experiments
apps_in_json = []
deps_for_apps = []
all_app_names = []
foreach app : all_apps
if app['name'] in all_app_names
error('Duplicated app @0@'.format(app['name']))
endif
all_app_names += [app['name']]
corrections = files('settings' / 'no_corrections.json')[0].full_path()
if 'va_corrections' in app
corrections = app['va_corrections'].full_path()
endif
app_settings = ''
if 'sia_settings' in app
app_settings += ', "sia_settings": "@0@"'.format(app['sia_settings'].full_path())
endif
if 'ina_settings' in app
app_settings += ', "ina_settings": "@0@"'.format(app['ina_settings'].full_path())
endif
if 'sse_settings' in app
app_settings += ', "sse_settings": "@0@"'.format(app['sse_settings'].full_path())
endif
if 'multisse_settings' in app
app_settings += ', "multisse_settings": "@0@"'.format(app['multisse_settings'].full_path())
endif
if 'sys_timings' in app
timings = app['sys_timings']
if timings == 'BB'
app_settings += ', "timings": "BB"'
else
app_settings += ', "timings": "@0@"'.format(timings.full_path())
endif
endif
if 'cloc_app' in app
paths = []
foreach file : app['cloc_app']
paths += ['"' + file + '"']
endforeach
app_settings += ', "cloc_app": [@0@]'.format(', '.join(paths))
endif
if 'cloc_lib' in app
paths = []
foreach file : app['cloc_lib']
paths += ['"' + file + '"']
endforeach
app_settings += ', "cloc_lib": [@0@]'.format(', '.join(paths))
endif
apps_in_json += [
'--applications',
'{"name": "@0@", "ll": "@1@", "os": "@2@", "va_corrections": "@3@"@4@}'.format(
app['name'],
app['ll'].full_path(),
app['os'],
corrections,
app_settings,
)
]
deps_for_apps += [app['ll']]
summary(app['name'], 'OS: @0@, SIA: @1@, INA: @2@, SSE: @3@, MultiSSE: @4@, LL: @5@'.format(
app['os'],
'sia_settings' in app,
'ina_settings' in app,
'sse_settings' in app,
'multisse_settings' in app,
app['ll'].full_path()), section: 'Enabled Apps')
endforeach
run_sia_runtime = 'run-sia-runtime'
run_target(run_sia_runtime,
command: [
py3_inst, sia_runtime_experiment,
'--work-dir', meson.current_build_dir() / 'sia-runtime',
'--title', run_sia_runtime,
'--python', py3_inst,
'--exclude', 'InfiniTime',
'--exclude', 'intel-ecfw-zephyr',
'--iterations', '10',
'--ara', ara.full_path()] + apps_in_json,
depends: [ara] + deps_for_apps)
summary('Measure SIA runtime in all modes', 'meson compile ' + run_sia_runtime, section: 'experiments')
instance_graph_stats = 'run-app-stats'
cloc = find_program('cloc')
run_target(instance_graph_stats,
command: [
py3_inst, instance_graph_experiment,
'--work-dir', meson.current_build_dir() / 'app-stats',
'--title', instance_graph_stats,
'--python', py3_inst,
'--cloc', cloc,
'--include', 'i4copter',
'--include', 'i4copter_mc',
'--include', 'GPSLogger',
'--include', 'LibrePilot',
'--include', 'IronOS',
'--include', 'libmicrohttpd',
'--include', 'InfiniTime',
'--include', 'native_sim-sys_kernel',
'--include', 'native_sim-app_kernel',
'--ara', ara.full_path()] + apps_in_json,
depends: [ara] + deps_for_apps)
summary('Get app statistics', 'meson compile ' + instance_graph_stats, section: 'experiments')
# TODO, give targets with Meson and not automagically
ninja = find_program('ninja')
ssh = find_program('ssh')
multisse_synthesis_exp = 'run-multisse-synthesis'
run_target(multisse_synthesis_exp,
command: [
py3_inst, multisse_synthesis,
'--ninja', ninja.full_path(), # this should be meson directly but not possible currently
'--build-dir', meson.build_root(),
'--title', multisse_synthesis_exp,
'--rpi-host', get_option('rpi_host'),
'--ssh', ssh.full_path(),
'--iterations', '10',
]
)
summary('Run synthesis for MultiSSE', 'meson compile ' + multisse_synthesis_exp, section: 'experiments')
run_multisse = 'run-multisse-results'
run_target(run_multisse,
command: [
py3_inst, multisse_results,
'--work-dir', meson.current_build_dir() / 'multisse-results',
'--title', run_multisse,
'--python', py3_inst,
'--exclude', 'i4copter',
'--iterations', '1',
'--ara', ara.full_path()] + apps_in_json,
depends: [ara] + deps_for_apps)
summary('Get MultiSSE statistics', 'meson compile ' + run_multisse, section: 'experiments')
multisse_synthetic_settings = files('settings' / 'multisse_synthetic_app.json.in')[0]
run_autosar_gen = 'run-autosar-generator'
generated_autosar_apps = subproject('generated-autosar-apps', required: false)
append = '''
import sys
with open(sys.argv[1], "w") as f:
f.write(sys.argv[2])
'''
combine = '''
import sys
import glob
parts = []
for part in glob.glob("json_part*.json"):
with open(part) as fp:
parts.append(fp.read())
with open(sys.argv[1], "w") as tgt:
inner = ", ".join(parts)
tgt.write(f"[{inner}]")
'''
gen_apps = []
if build_synthetic_apps
subdir('generated_apps') # generated and tested apps
gen_apps += sane_generated_autosar_apps
endif
if generated_autosar_apps.found()
gen_apps += generated_autosar_apps.get_variable('apps')
endif
gen_deps = []
parts = []
app_counter = 0
foreach app : gen_apps
gen_app = [
'{"name": "@0@", "ll": "@1@", "multisse_settings": "@2@"}'.format(
app['name'],
app['ll'].full_path(),
app['settings'].full_path(),
)
]
gen_deps += [app['ll']]
file_part = custom_target('add_' + app['name'].underscorify(),
input: [],
output: f'json_part@[email protected]',
command: [py3_inst, '-c', append, '@OUTPUT@', gen_app],
)
parts += [file_part]
app_counter += 1
endforeach
synthetic_apps = custom_target('gen_synthesis_apps',
input: [],
output: 'synthetic_apps.json',
command: [py3_inst, '-c', combine, '@OUTPUT@'],
depends: parts,
)
run_multisse_syn_test = 'run-multisse-synthetic-tests'
run_target(run_multisse_syn_test,
command: [
py3_inst, multisse_synthetic_test,
'--work-dir', meson.current_build_dir() / 'multisse-synthetic-tests',
'--title', run_multisse_syn_test,
'--python', py3_inst,
'--iterations', '3',
'--ara', ara.full_path(),
'--applications', synthetic_apps.full_path(),
],
depends: [ara, synthetic_apps] + gen_deps)
summary('Get MultiSSE synthetic tests results', 'meson compile ' + run_multisse_syn_test, section: 'experiments')
# arbitrary tools
run_target(run_autosar_gen,
command: [
py3_inst, autosar_app_generator,
'--subproject-dir', meson.current_source_dir() / 'subprojects' / 'generated-autosar-apps',
'--seed', '42',
'--benchmark-gen', ara_proj.get_variable('benchmark_gen').full_path(),
'--benchmark-gen-template', ara_proj.get_variable('benchmark_gen_jinja').full_path(),
'--multisse-settings', multisse_synthetic_settings.full_path(),
'--toolchains-wrap', meson.current_source_dir() / 'subprojects' / 'toolchains.wrap',
'--ara-wrap', meson.current_source_dir() / 'subprojects' / 'ara.wrap',
])
summary('Generate AUTOSAR apps', 'meson compile ' + run_autosar_gen, section: 'tools')