From e15bb744ffd1fab0b74dcd8beed47f47dfa18edd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 11 Mar 2020 08:29:24 +1100 Subject: [PATCH] Tools: improve build_bootloaders.py script give list of failed builds --- Tools/scripts/build_bootloaders.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Tools/scripts/build_bootloaders.py b/Tools/scripts/build_bootloaders.py index 687c4534fb..2b2a5728df 100755 --- a/Tools/scripts/build_bootloaders.py +++ b/Tools/scripts/build_bootloaders.py @@ -18,6 +18,8 @@ if len(sys.argv)>1: os.environ['PYTHONUNBUFFERED'] = '1' +failed_boards = set() + def get_board_list(): '''add boards based on existance of hwdef-bl.dat in subdirectories for ChibiOS''' board_list = [] @@ -33,15 +35,30 @@ def run_program(cmd_list): retcode = subprocess.call(cmd_list) if retcode != 0: 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(): if not fnmatch.fnmatch(board, board_pattern): continue print("Building for %s" % board) - run_program(["./waf", "configure", "--board", board, "--bootloader"]) - run_program(["./waf", "clean"]) - run_program(["./waf", "bootloader"]) + if not build_board(board): + failed_boards.add(board) + continue 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) + +if len(failed_boards): + print("Failed boards: %s" % list(failed_boards))