forked from AdaCore/Ada_Drivers_Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_projects_generator.py
executable file
·87 lines (75 loc) · 3.27 KB
/
board_projects_generator.py
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
#!/usr/bin/env python3
from subprocess import check_call
BOARDS = {
'Crazyflie': { 'rts_profiles': ['light-tasking', 'embedded']},
'HiFive1': { 'rts_profiles': ['light']},
'HiFive1_rev_B': { 'rts_profiles': ['light']},
'Unleashed': { 'rts_profiles': ['light', 'light-tasking', 'embedded']},
'MicroBit': { 'rts_profiles': ['light']},
'NRF52_DK': { 'rts_profiles': ['light']},
'Native': { 'rts_profiles': ['none']},
'OpenMV2': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32F407_Discovery': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32F429_Discovery': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32F469_Discovery': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32F746_Discovery': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32F769_Discovery': { 'rts_profiles': ['light-tasking', 'embedded']},
'NUCLEO_F446ZE': { 'rts_profiles': ['light-tasking', 'embedded']},
'Feather_STM32F405': { 'rts_profiles': ['light-tasking', 'embedded']},
'STM32_H405': { 'rts_profiles': ['light-tasking', 'embedded']},
}
FOLDERS = {'Crazyflie': 'crazyflie',
'HiFive1': 'HiFive1',
'HiFive1_rev_B': 'HiFive1_rev_B',
'Unleashed': 'Unleashed',
'MicroBit': 'MicroBit',
'NRF52_DK': 'NRF52_DK',
'Native': 'native',
'OpenMV2': 'OpenMV2',
'STM32F407_Discovery': 'stm32f407_discovery',
'STM32F429_Discovery': 'stm32f429_discovery',
'STM32F469_Discovery': 'stm32f469_discovery',
'STM32F746_Discovery': 'stm32f746_discovery',
'STM32F769_Discovery': 'stm32f769_discovery',
'NUCLEO_F446ZE': 'nucleo_f446ze',
'Feather_STM32F405': 'feather_stm32f405',
'STM32_H405': 'stm32_h405'}
USE_STARTUP_GEN = ['HiFive1', 'HiFive1_rev_B', 'MicroBit', 'NRF52_DK']
def gen_project(board_name, rts):
assert board_name is not None, "board is undefined"
assert board_name in BOARDS, "%s is undefined" % board_name
if rts == 'light':
suffix = 'ZFP'
elif rts == 'light-tasking':
suffix = 'SFP'
elif rts == 'embedded':
suffix = 'Full'
elif rts == 'none':
suffix = None
else:
assert False, "Unexpected runtime %s" % rts
if suffix is not None:
project_name = '%s_%s' % (board_name, suffix)
object_dir_name = "obj/" + suffix.lower()
source_dir_name = "src/" + suffix.lower()
else:
project_name = board_name
object_dir_name = "obj"
source_dir_name = "config_src"
args = ["python3",
"../scripts/project_wizard.py",
"--script-mode",
"-d", FOLDERS[board_name],
"-p", project_name,
"-s", source_dir_name,
"-o", object_dir_name,
"Board=%s" % board_name,
"Runtime_Profile=%s" % rts,
"Use_Startup_Gen=" + ("True" if board_name in USE_STARTUP_GEN else "False")]
check_call(args)
if __name__ == "__main__":
for b in BOARDS:
print("\n=== %s ===" % b)
for rts in BOARDS[b]['rts_profiles']:
print("\n=== %s" % rts)
gen_project(b, rts)