1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

First Arm binaries

This commit is contained in:
bsongis 2012-04-06 08:44:11 +00:00
parent 9448363b95
commit af3f17a8ae

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import os, sys, shutil import os, sys, shutil, platform
import subprocess import subprocess
options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")], options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")],
@ -20,9 +20,14 @@ options_v4 = [[("", "EXT=FRSKY")],
[("", "SOMO=NO"), ("SOMO", "SOMO=YES")], [("", "SOMO=NO"), ("SOMO", "SOMO=YES")],
] ]
options_arm = [[("", "EXT=FRSKY")],
[("", "HELI=NO"), ("heli", "HELI=YES")],
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
]
languages = ["en", "fr", "se"] languages = ["en", "fr", "se"]
def generate(hex, arg, options,v4): def generate(hex, arg, extension, options, maxsize):
result = [] result = []
states = [0] * len(options) states = [0] * len(options)
@ -46,7 +51,7 @@ def generate(hex, arg, options,v4):
hex_file += "-" + language hex_file += "-" + language
make_args.append("TRANSLATIONS=" + language.upper()) make_args.append("TRANSLATIONS=" + language.upper())
print "[%d/%d]" % (current, count), hex_file print "[%d/%d]" % (current, count), hex_file
subprocess.check_output(["make", "clean"]) subprocess.check_output(["make", "clean", arg])
p = subprocess.Popen(make_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(make_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait() p.wait()
stderr = p.stderr.read() stderr = p.stderr.read()
@ -63,15 +68,15 @@ def generate(hex, arg, options,v4):
while "" in parts: while "" in parts:
parts.remove("") parts.remove("")
size = int(parts[1]) size = int(parts[1])
if ((size > 65530 and v4==0) or (size > 262000 and v4==1)): if size > maxsize:
print " ", line[:-1], "[NOT RELEASED]" print " ", line[:-1], "[NOT RELEASED]"
else: else:
print " ", line, print " ", line,
if line.startswith("Data:"): if line.startswith("Data:"):
print " ", line, print " ", line,
if ((size <= 65530 and v4==0) or (size <=262000 and v4==1)) : if size <= maxsize:
shutil.copyfile("open9x.hex", "../binaries/" + hex_file + ".hex") shutil.copyfile("open9x." + extension, "../binaries/" + hex_file + "." + extension)
result.append(hex_file) result.append(hex_file)
for index, state in enumerate(states): for index, state in enumerate(states):
@ -90,13 +95,18 @@ def generate_c9x_list(filename, hexes, size):
for hex in hexes: for hex in hexes:
f.write('open9x->add_option(new Open9xFirmware("%s", new Open9xInterface(%s), OPEN9X_BIN_URL "%s.hex"));\n' % (hex, size, hex)) f.write('open9x->add_option(new Open9xFirmware("%s", new Open9xInterface(%s), OPEN9X_BIN_URL "%s.hex"));\n' % (hex, size, hex))
# stock board if platform.system() == "Windows":
hexes = generate("open9x-stock", "PCB=STD", options_stock,0) # arm board
generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "BOARD_STOCK") hexes = generate("open9x-arm", "PCB=ARM", "bin", options_arm, 262000)
generate_c9x_list("../../companion9x/src/open9x-arm-binaries.cpp", hexes, "BOARD_ERSKY9X")
else:
# stock board
hexes = generate("open9x-stock", "PCB=STD", "hex", options_stock, 65530)
generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "BOARD_STOCK")
# v4 board # v4 board
hexes = generate("open9x-v4", "PCB=V4", options_v4,1) hexes = generate("open9x-v4", "PCB=V4", "hex", options_v4, 262000)
generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "BOARD_GRUVIN9X") generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "BOARD_GRUVIN9X")
# stamp # stamp
subprocess.check_output(["make", "stamp"]) subprocess.check_output(["make", "stamp"])