Skip to content

Commit

Permalink
Provide board directory instead of architecture.
Browse files Browse the repository at this point in the history
Apart from information about the architecture we also need
the board location.
In case a board name differs from the directory name,
the script wouldn't be able to retrieve the full name of the board.
  • Loading branch information
wsipak committed Nov 8, 2023
1 parent c0a9461 commit 85dadbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
21 changes: 11 additions & 10 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,11 @@ def get_full_name(yaml_filename):
return full_board_name


def get_board_yaml_path(arch, board_name):
board_yaml = f'{config.project_path}/boards/{arch}/{board_name}/{board_name}.yaml'
def get_board_yaml_path(board_dir, board_name):
return f'{config.project_path}/{board_dir}/{board_name}.yaml'


return board_yaml


def main(arch: str, board_name: str, sample_name: str) -> None:
def main(board_dir: str, board_name: str, sample_name: str) -> None:
"""
Main function to build a Zephyr sample for a specific board and create relevant artifacts.
Expand Down Expand Up @@ -244,7 +241,11 @@ def main(arch: str, board_name: str, sample_name: str) -> None:
elf_name = config.artifact_paths["elf"].format(**format_args)
elf_md5_name = config.artifact_paths["elf-md5"].format(**format_args)

platform_full_name = get_full_name(get_board_yaml_path(arch, board_name))
platform_full_name = get_full_name(get_board_yaml_path(board_dir, board_name))
try:
arch = board_dir.split("/")[-2]
except IndexError:
raise Exception(f"Could not deduce `arch` from the provided board directory: `{board_dir}`.")

result = {
"platform": board_name,
Expand Down Expand Up @@ -281,7 +282,7 @@ def main(arch: str, board_name: str, sample_name: str) -> None:

if __name__ == "__main__":
ap = ArgumentParser()
ap.add_argument("arch")
ap.add_argument("board_dir")
ap.add_argument("board_name")
ap.add_argument("sample_name")
ap.add_argument("-j", "--job-number")
Expand All @@ -291,15 +292,15 @@ def main(arch: str, board_name: str, sample_name: str) -> None:
config.load()

multijob = args.job_number is not None and args.jobs_total is not None
arch = args.arch
board_dir = args.board_dir
board_name = args.board_name
sample_name = args.sample_name

if multijob:
start_time = time.time()
print_frame(f"job {args.job_number} / {args.jobs_total} started")

main(arch, board_name, sample_name)
main(board_dir, board_name, sample_name)

if multijob:
total_time = time.time() - start_time
Expand Down
6 changes: 3 additions & 3 deletions scripts/get_boards_samples_pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Args:
omit_board = ("nsim", "xenvm", "xt-sim", "fvp_")
boards_to_run = list(filter(lambda x: all(map(lambda y: y not in x.name, omit_board)), boards_to_run))

return [(board.arch, board.name) for board in boards_to_run]
return [(board.dir, board.name) for board in boards_to_run]


def generate_samples() -> None:
Expand All @@ -43,11 +43,11 @@ def generate_samples() -> None:
otherwise generate the sample for all boards
"""
all_boards_data = get_boards()
for arch, board in all_boards_data:
for dir, board in all_boards_data:
for sample, sample_data in config.samples.items():
sample_boards = sample_data.get("boards", [board])
if board in sample_boards:
print(f"{arch} {board} {sample}")
print(f"{dir} {board} {sample}")

if __name__ == "__main__":
config.load()
Expand Down

0 comments on commit 85dadbe

Please sign in to comment.