Tools: improve build_bootloaders.py script

give list of failed builds
This commit is contained in:
Andrew Tridgell 2020-03-11 08:29:24 +11:00
parent d35fff5186
commit e15bb744ff
1 changed files with 22 additions and 5 deletions

View File

@ -18,6 +18,8 @@ if len(sys.argv)>1:
os.environ['PYTHONUNBUFFERED'] = '1' os.environ['PYTHONUNBUFFERED'] = '1'
failed_boards = set()
def get_board_list(): def get_board_list():
'''add boards based on existance of hwdef-bl.dat in subdirectories for ChibiOS''' '''add boards based on existance of hwdef-bl.dat in subdirectories for ChibiOS'''
board_list = [] board_list = []
@ -33,15 +35,30 @@ def run_program(cmd_list):
retcode = subprocess.call(cmd_list) retcode = subprocess.call(cmd_list)
if retcode != 0: if retcode != 0:
print("Build failed: %s" % ' '.join(cmd_list)) print("Build failed: %s" % ' '.join(cmd_list))
sys.exit(1) return False
return True
def build_board(board):
if not run_program(["./waf", "configure", "--board", board, "--bootloader", "--no-submodule-update"]):
return False
if not run_program(["./waf", "clean"]):
return False
if not run_program(["./waf", "bootloader"]):
return False
return True
for board in get_board_list(): for board in get_board_list():
if not fnmatch.fnmatch(board, board_pattern): if not fnmatch.fnmatch(board, board_pattern):
continue continue
print("Building for %s" % board) print("Building for %s" % board)
run_program(["./waf", "configure", "--board", board, "--bootloader"]) if not build_board(board):
run_program(["./waf", "clean"]) failed_boards.add(board)
run_program(["./waf", "bootloader"]) continue
shutil.copy('build/%s/bin/AP_Bootloader.bin' % board, 'Tools/bootloaders/%s_bl.bin' % board) shutil.copy('build/%s/bin/AP_Bootloader.bin' % board, 'Tools/bootloaders/%s_bl.bin' % board)
run_program(["Tools/scripts/bin2hex.py", "--offset", "0x08000000", 'Tools/bootloaders/%s_bl.bin' % board, 'Tools/bootloaders/%s_bl.hex' % board]) if not run_program(["Tools/scripts/bin2hex.py", "--offset", "0x08000000", 'Tools/bootloaders/%s_bl.bin' % board, 'Tools/bootloaders/%s_bl.hex' % board]):
failed_boards.add(board)
continue
shutil.copy('build/%s/bootloader/AP_Bootloader' % board, 'Tools/bootloaders/%s_bl.elf' % board) shutil.copy('build/%s/bootloader/AP_Bootloader' % board, 'Tools/bootloaders/%s_bl.elf' % board)
if len(failed_boards):
print("Failed boards: %s" % list(failed_boards))