CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/scripts/build_iofirmware.py
Views: 1798
1
#!/usr/bin/env python3
2
3
"""
4
script to build iofirmware and copy to Tools/IO_Firmware
5
6
AP_FLAKE8_CLEAN
7
"""
8
9
import os
10
import shutil
11
import subprocess
12
import sys
13
14
os.environ['PYTHONUNBUFFERED'] = '1'
15
16
17
def run_program(cmd_list):
18
print("Running (%s)" % " ".join(cmd_list))
19
retcode = subprocess.call(cmd_list)
20
if retcode != 0:
21
print("Build failed: %s" % ' '.join(cmd_list))
22
sys.exit(1)
23
24
25
print("Building iofirmware")
26
run_program(["./waf", "configure", "--board", 'iomcu'])
27
run_program(["./waf", "clean"])
28
run_program(["./waf", "iofirmware"])
29
shutil.copy('build/iomcu/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_lowpolh.bin')
30
shutil.copy('build/iomcu/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_highpolh.bin')
31
32
run_program(["./waf", "configure", "--board", 'iomcu', '--enable-iomcu-profiled-support'])
33
run_program(["./waf", "clean"])
34
run_program(["./waf", "iofirmware"])
35
shutil.copy('build/iomcu/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_cube_lowpolh.bin')
36
shutil.copy('build/iomcu/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_cube_highpolh.bin')
37
38
run_program(["./waf", "configure", "--board", 'iomcu-dshot'])
39
run_program(["./waf", "clean"])
40
run_program(["./waf", "iofirmware"])
41
shutil.copy('build/iomcu-dshot/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_dshot_lowpolh.bin')
42
shutil.copy('build/iomcu-dshot/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_dshot_highpolh.bin')
43
44
run_program(["./waf", "configure", "--board", 'iomcu-dshot', '--enable-iomcu-profiled-support'])
45
run_program(["./waf", "clean"])
46
run_program(["./waf", "iofirmware"])
47
shutil.copy('build/iomcu-dshot/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_cube_dshot_lowpolh.bin')
48
shutil.copy('build/iomcu-dshot/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_cube_dshot_highpolh.bin')
49
50
run_program(["./waf", "configure", "--board", 'iomcu-f103'])
51
run_program(["./waf", "clean"])
52
run_program(["./waf", "iofirmware"])
53
shutil.copy('build/iomcu-f103/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_lowpolh.bin')
54
shutil.copy('build/iomcu-f103/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_highpolh.bin')
55
56
run_program(["./waf", "configure", "--board", 'iomcu-f103-dshot'])
57
run_program(["./waf", "clean"])
58
run_program(["./waf", "iofirmware"])
59
shutil.copy('build/iomcu-f103-dshot/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_dshot_lowpolh.bin')
60
shutil.copy('build/iomcu-f103-dshot/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_dshot_highpolh.bin')
61
62
run_program(["./waf", "configure", "--board", 'iomcu_f103_8MHz'])
63
run_program(["./waf", "clean"])
64
run_program(["./waf", "iofirmware"])
65
shutil.copy('build/iomcu_f103_8MHz/bin/iofirmware_lowpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_8MHz_lowpolh.bin')
66
shutil.copy('build/iomcu_f103_8MHz/bin/iofirmware_highpolh.bin', 'Tools/IO_Firmware/iofirmware_f103_8MHz_highpolh.bin')
67
68
run_program(["./waf", "configure", "--board", 'iomcu-f103-8MHz-dshot'])
69
run_program(["./waf", "clean"])
70
run_program(["./waf", "iofirmware"])
71
shutil.copy('build/iomcu-f103-8MHz-dshot/bin/iofirmware_lowpolh.bin',
72
'Tools/IO_Firmware/iofirmware_f103_8MHz_dshot_lowpolh.bin')
73
shutil.copy('build/iomcu-f103-8MHz-dshot/bin/iofirmware_highpolh.bin',
74
'Tools/IO_Firmware/iofirmware_f103_8MHz_dshot_highpolh.bin')
75
76