|
|
@@ -18,48 +18,60 @@ total_time = time.monotonic()
|
|
|
build_format = '| {:29} | {:30} | {:18} | {:7} | {:6} | {:6} |'
|
|
|
build_separator = '-' * 106
|
|
|
|
|
|
+def filter_with_input(mylist):
|
|
|
+ if len(sys.argv) > 1:
|
|
|
+ input_args = list(set(mylist).intersection(sys.argv))
|
|
|
+ if len(input_args) > 0:
|
|
|
+ mylist[:] = input_args
|
|
|
+
|
|
|
# If examples are not specified in arguments, build all
|
|
|
all_examples = []
|
|
|
-
|
|
|
for entry in os.scandir("examples/device"):
|
|
|
if entry.is_dir():
|
|
|
all_examples.append("device/" + entry.name)
|
|
|
-
|
|
|
for entry in os.scandir("examples/host"):
|
|
|
if entry.is_dir():
|
|
|
all_examples.append("host/" + entry.name)
|
|
|
-
|
|
|
-if len(sys.argv) > 1:
|
|
|
- input_examples = list(set(all_examples).intersection(sys.argv))
|
|
|
- if len(input_examples) > 0:
|
|
|
- all_examples = input_examples
|
|
|
-
|
|
|
+filter_with_input(all_examples)
|
|
|
all_examples.sort()
|
|
|
|
|
|
# If boards are not specified in arguments, build all
|
|
|
all_boards = []
|
|
|
-
|
|
|
for entry in os.scandir("hw/bsp"):
|
|
|
- if entry.is_dir() and entry.name != "esp32s2":
|
|
|
- if os.path.isdir(entry.path + "/boards"):
|
|
|
- # family directory
|
|
|
- for subentry in os.scandir(entry.path + "/boards"):
|
|
|
- if subentry.is_dir(): all_boards.append(subentry.name)
|
|
|
- else:
|
|
|
- all_boards.append(entry.name)
|
|
|
+ if entry.is_dir() and os.path.exists(entry.path + "/board.mk"):
|
|
|
+ all_boards.append(entry.name)
|
|
|
+filter_with_input(all_boards)
|
|
|
+all_boards.sort()
|
|
|
|
|
|
-if len(sys.argv) > 1:
|
|
|
- input_boards = list(set(all_boards).intersection(sys.argv))
|
|
|
- if len(input_boards) > 0:
|
|
|
- all_boards = input_boards
|
|
|
+def build_board(example, board):
|
|
|
+ global success_count, fail_count, skip_count
|
|
|
+ start_time = time.monotonic()
|
|
|
+ flash_size = "-"
|
|
|
+ sram_size = "-"
|
|
|
+
|
|
|
+ # Check if board is skipped
|
|
|
+ if skip_example(example, board):
|
|
|
+ success = SKIPPED
|
|
|
+ skip_count += 1
|
|
|
+ print(build_format.format(example, board, success, '-', flash_size, sram_size))
|
|
|
+ else:
|
|
|
+ subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
+ build_result = subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
+
|
|
|
+ if build_result.returncode == 0:
|
|
|
+ success = SUCCEEDED
|
|
|
+ success_count += 1
|
|
|
+ (flash_size, sram_size) = build_size(example, board)
|
|
|
+ else:
|
|
|
+ exit_status = build_result.returncode
|
|
|
+ success = FAILED
|
|
|
+ fail_count += 1
|
|
|
|
|
|
-all_boards.sort()
|
|
|
+ build_duration = time.monotonic() - start_time
|
|
|
+ print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
|
|
|
|
|
|
-def build_example(example, board):
|
|
|
- subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True,
|
|
|
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
- return subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True,
|
|
|
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
+ if build_result.returncode != 0:
|
|
|
+ print(build_result.stdout.decode("utf-8"))
|
|
|
|
|
|
def build_size(example, board):
|
|
|
#elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board)
|
|
|
@@ -72,11 +84,7 @@ def build_size(example, board):
|
|
|
|
|
|
def skip_example(example, board):
|
|
|
ex_dir = 'examples/' + example
|
|
|
-
|
|
|
board_mk = 'hw/bsp/{}/board.mk'.format(board)
|
|
|
- if not os.path.exists(board_mk):
|
|
|
- board_mk = list(glob.iglob('hw/bsp/*/boards/{}/../../family.mk'.format(board)))[0]
|
|
|
-
|
|
|
with open(board_mk) as mk:
|
|
|
mk_contents = mk.read()
|
|
|
|
|
|
@@ -107,35 +115,7 @@ print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', '
|
|
|
for example in all_examples:
|
|
|
print(build_separator)
|
|
|
for board in all_boards:
|
|
|
- start_time = time.monotonic()
|
|
|
-
|
|
|
- flash_size = "-"
|
|
|
- sram_size = "-"
|
|
|
-
|
|
|
- # Check if board is skipped
|
|
|
- if skip_example(example, board):
|
|
|
- success = SKIPPED
|
|
|
- skip_count += 1
|
|
|
- print(build_format.format(example, board, success, '-', flash_size, sram_size))
|
|
|
- else:
|
|
|
- build_result = build_example(example, board)
|
|
|
-
|
|
|
- if build_result.returncode == 0:
|
|
|
- success = SUCCEEDED
|
|
|
- success_count += 1
|
|
|
- (flash_size, sram_size) = build_size(example, board)
|
|
|
- else:
|
|
|
- exit_status = build_result.returncode
|
|
|
- success = FAILED
|
|
|
- fail_count += 1
|
|
|
-
|
|
|
- build_duration = time.monotonic() - start_time
|
|
|
- print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
|
|
|
-
|
|
|
- if build_result.returncode != 0:
|
|
|
- print(build_result.stdout.decode("utf-8"))
|
|
|
-
|
|
|
-
|
|
|
+ build_board(example, board)
|
|
|
|
|
|
total_time = time.monotonic() - total_time
|
|
|
print(build_separator)
|