Tools: use 10.2.1 compiler for latest builds of ChibiOS boards
This commit is contained in:
parent
18cbd25828
commit
e95abce466
@ -32,6 +32,28 @@ else:
|
||||
running_python3 = True
|
||||
|
||||
|
||||
def is_chibios_build(board):
|
||||
'''see if a board is using HAL_ChibiOS'''
|
||||
hwdef_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "libraries", "AP_HAL_ChibiOS", "hwdef")
|
||||
return os.path.exists(os.path.join(hwdef_dir, board, "hwdef.dat"))
|
||||
|
||||
|
||||
def get_required_compiler(tag, board):
|
||||
'''return required compiler for a build tag.
|
||||
return format is the version string that waf configure will detect.
|
||||
You should setup a link from this name in $HOME/arm-gcc directory pointing at the
|
||||
appropriate compiler
|
||||
'''
|
||||
if not is_chibios_build(board):
|
||||
# only override compiler for ChibiOS builds
|
||||
return None
|
||||
if tag == 'latest':
|
||||
# use 10.2.1 compiler for master builds
|
||||
return "g++-10.2.1"
|
||||
# for all other builds we use the default compiler in $PATH
|
||||
return None
|
||||
|
||||
|
||||
class build_binaries(object):
|
||||
def __init__(self, tags):
|
||||
self.tags = tags
|
||||
@ -62,21 +84,34 @@ class build_binaries(object):
|
||||
return ["--static"]
|
||||
return []
|
||||
|
||||
def run_waf(self, args):
|
||||
def run_waf(self, args, compiler=None):
|
||||
if os.path.exists("waf"):
|
||||
waf = "./waf"
|
||||
else:
|
||||
waf = os.path.join(".", "modules", "waf", "waf-light")
|
||||
cmd_list = [waf]
|
||||
cmd_list.extend(args)
|
||||
self.run_program("BB-WAF", cmd_list)
|
||||
env = None
|
||||
if compiler is not None:
|
||||
# default to $HOME/arm-gcc, but allow for any path with AP_GCC_HOME environment variable
|
||||
gcc_home = os.environ.get("AP_GCC_HOME", os.path.join(os.environ["HOME"], "arm-gcc"))
|
||||
gcc_path = os.path.join(gcc_home, compiler, "bin")
|
||||
if os.path.exists(gcc_path):
|
||||
# setup PATH to point at the right compiler, and setup to use ccache
|
||||
env = os.environ.copy()
|
||||
env["PATH"] = gcc_path + ":" + env["PATH"]
|
||||
env["CC"] = "ccache arm-none-eabi-gcc"
|
||||
env["CXX"] = "ccache arm-none-eabi-g++"
|
||||
else:
|
||||
raise Exception("BB-WAF: Missing compiler %s" % gcc_path)
|
||||
self.run_program("BB-WAF", cmd_list, env=env)
|
||||
|
||||
def run_program(self, prefix, cmd_list, show_output=True):
|
||||
def run_program(self, prefix, cmd_list, show_output=True, env=None):
|
||||
if show_output:
|
||||
self.progress("Running (%s)" % " ".join(cmd_list))
|
||||
p = subprocess.Popen(cmd_list, bufsize=1, stdin=None,
|
||||
stdout=subprocess.PIPE, close_fds=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
stderr=subprocess.STDOUT, env=env)
|
||||
output = ""
|
||||
while True:
|
||||
x = p.stdout.readline()
|
||||
@ -164,7 +199,7 @@ is bob we will attempt to checkout bob-AVR'''
|
||||
return False
|
||||
|
||||
def skip_board_waf(self, board):
|
||||
'''check if we should skip this build because we don't support the
|
||||
'''check if we should skip this build because we do not support the
|
||||
board in this release
|
||||
'''
|
||||
|
||||
@ -409,15 +444,19 @@ is bob we will attempt to checkout bob-AVR'''
|
||||
"--board", board,
|
||||
"--out", self.buildroot,
|
||||
"clean"]
|
||||
gccstring = get_required_compiler(tag, board)
|
||||
if gccstring is not None:
|
||||
waf_opts += ["--assert-cc-version", gccstring]
|
||||
|
||||
waf_opts.extend(self.board_options(board))
|
||||
self.run_waf(waf_opts)
|
||||
self.run_waf(waf_opts, compiler=gccstring)
|
||||
except subprocess.CalledProcessError:
|
||||
self.progress("waf configure failed")
|
||||
continue
|
||||
try:
|
||||
target = os.path.join("bin",
|
||||
"".join([binaryname, framesuffix]))
|
||||
self.run_waf(["build", "--targets", target])
|
||||
self.run_waf(["build", "--targets", target], compiler=gccstring)
|
||||
except subprocess.CalledProcessError:
|
||||
msg = ("Failed build of %s %s%s %s" %
|
||||
(vehicle, board, framesuffix, tag))
|
||||
|
Loading…
Reference in New Issue
Block a user