update build script to support iar with CC=iccarm option

This commit is contained in:
hathach 2023-01-17 23:37:00 +07:00
parent 1891802f08
commit c86e628a4c
4 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
name: Build IAR for ARM
name: Build ARM with IAR
on:
push:

View File

@ -52,7 +52,7 @@ if __name__ == '__main__':
for example in all_examples:
print(build_separator)
with Pool(processes=os.cpu_count()) as pool:
pool_args = list((map(lambda b, e=example: [e, b], all_boards)))
pool_args = list((map(lambda b, e=example, o='': [e, b, o], all_boards)))
result = pool.starmap(build_utils.build_example, pool_args)
# sum all element of same index (column sum)
result = list(map(sum, list(zip(*result))))

View File

@ -11,6 +11,7 @@ SKIPPED = "\033[33mskipped\033[0m"
build_separator = '-' * 106
make_iar_option = 'CC=iccarm'
def filter_with_input(mylist):
if len(sys.argv) > 1:
@ -19,7 +20,7 @@ def filter_with_input(mylist):
mylist[:] = input_args
def build_family(example, family):
def build_family(example, family, make_option):
all_boards = []
for entry in os.scandir("hw/bsp/{}/boards".format(family)):
if entry.is_dir() and entry.name != 'pico_sdk':
@ -28,13 +29,17 @@ def build_family(example, family):
all_boards.sort()
with Pool(processes=os.cpu_count()) as pool:
pool_args = list((map(lambda b, e=example: [e, b], all_boards)))
pool_args = list((map(lambda b, e=example, o=make_option: [e, b, o], all_boards)))
result = pool.starmap(build_utils.build_example, pool_args)
# sum all element of same index (column sum)
return list(map(sum, list(zip(*result))))
if __name__ == '__main__':
# IAR CC
if make_iar_option not in sys.argv:
make_iar_option = ''
# If examples are not specified in arguments, build all
all_examples = []
for dir1 in os.scandir("examples"):
@ -62,7 +67,7 @@ if __name__ == '__main__':
for example in all_examples:
print(build_separator)
for family in all_families:
fret = build_family(example, family)
fret = build_family(example, family, make_iar_option)
total_result = list(map(lambda x, y: x + y, total_result, fret))
total_time = time.monotonic() - total_time

View File

@ -77,7 +77,7 @@ def skip_example(example, board):
return False
def build_example(example, board):
def build_example(example, board, make_option):
start_time = time.monotonic()
flash_size = "-"
sram_size = "-"
@ -91,14 +91,14 @@ def build_example(example, board):
ret[2] = 1
print(build_format.format(example, board, status, '-', flash_size, sram_size))
else:
build_result = subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True,
build_result = subprocess.run("make -j -C examples/{} BOARD={} {} all".format(example, board, make_option), shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if build_result.returncode == 0:
status = SUCCEEDED
ret[0] = 1
(flash_size, sram_size) = build_size(example, board)
subprocess.run("make -j -C examples/{} BOARD={} copy-artifact".format(example, board), shell=True,
subprocess.run("make -j -C examples/{} BOARD={} {} copy-artifact".format(example, board, make_option), shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
status = FAILED