diff options
| author | HiFiPhile <[email protected]> | 2024-08-02 11:52:35 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-02 11:52:35 +0200 |
| commit | 95cb319bded7db536edaae24936a825a8524a4a2 (patch) | |
| tree | 7de7d7f8d1916061cdaefcfb4f220397e1d0fbb8 /tools | |
| parent | adc7a78fd6fbdccbe5f586391997052f2becd149 (diff) | |
| parent | 4232642899362fa5e9cf0dc59bad6f1f6d32c563 (diff) | |
Merge branch 'master' into vendor_fifo
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/build.py | 219 | ||||
| -rw-r--r-- | tools/build_board.py | 69 | ||||
| -rw-r--r-- | tools/build_cmake.py | 105 | ||||
| -rw-r--r-- | tools/build_esp32.py | 106 | ||||
| -rw-r--r-- | tools/build_make.py | 80 | ||||
| -rw-r--r-- | tools/gen_doc.py | 4 | ||||
| -rw-r--r-- | tools/get_deps.py | 104 | ||||
| -rw-r--r-- | tools/iar_gen.py | 3 | ||||
| -rw-r--r-- | tools/iar_template.ipcf | 97 | ||||
| -rw-r--r-- | tools/make_release.py | 3 |
10 files changed, 397 insertions, 393 deletions
diff --git a/tools/build.py b/tools/build.py new file mode 100644 index 000000000..b937a7342 --- /dev/null +++ b/tools/build.py @@ -0,0 +1,219 @@ +import argparse +import random +import os +import sys +import time +import subprocess +from pathlib import Path +from multiprocessing import Pool + +import build_utils + +SUCCEEDED = "\033[32msucceeded\033[0m" +FAILED = "\033[31mfailed\033[0m" + +build_separator = '-' * 106 + + +def run_cmd(cmd): + #print(cmd) + r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + title = 'command error' + if r.returncode != 0: + # print build output if failed + if os.getenv('CI'): + print(f"::group::{title}") + print(r.stdout.decode("utf-8")) + print(f"::endgroup::") + else: + print(title) + print(r.stdout.decode("utf-8")) + return r + +def find_family(board): + bsp_dir = Path("hw/bsp") + for family_dir in bsp_dir.iterdir(): + if family_dir.is_dir(): + board_dir = family_dir / 'boards' / board + if board_dir.exists(): + return family_dir.name + return None + + +def get_examples(family): + all_examples = [] + for d in os.scandir("examples"): + if d.is_dir() and 'cmake' not in d.name and 'build_system' not in d.name: + for entry in os.scandir(d.path): + if entry.is_dir() and 'cmake' not in entry.name: + if family != 'espressif' or 'freertos' in entry.name: + all_examples.append(d.name + '/' + entry.name) + + if family == 'espressif': + all_examples.append('device/board_test') + all_examples.append('device/video_capture') + all_examples.sort() + return all_examples + + +def build_board_cmake(board, toolchain): + start_time = time.monotonic() + ret = [0, 0, 0] + + build_dir = f"cmake-build/cmake-build-{board}" + family = find_family(board) + if family == 'espressif': + # for espressif, we have to build example individually + all_examples = get_examples(family) + for example in all_examples: + r = run_cmd(f'cmake examples/{example} -B {build_dir}/{example} -G "Ninja" -DBOARD={board} -DMAX3421_HOST=1') + if r.returncode == 0: + r = run_cmd(f'cmake --build {build_dir}/{example}') + if r.returncode == 0: + ret[0] += 1 + else: + ret[1] += 1 + else: + r = run_cmd(f'cmake examples -B {build_dir} -G "Ninja" -DBOARD={board} -DCMAKE_BUILD_TYPE=MinSizeRel -DTOOLCHAIN={toolchain}') + if r.returncode == 0: + r = run_cmd(f"cmake --build {build_dir}") + if r.returncode == 0: + ret[0] += 1 + else: + ret[1] += 1 + + duration = time.monotonic() - start_time + + if ret[1] == 0: + status = SUCCEEDED + else: + status = FAILED + + flash_size = "-" + sram_size = "-" + example = 'all' + title = build_utils.build_format.format(example, board, status, "{:.2f}s".format(duration), flash_size, sram_size) + print(title) + return ret + + +def build_board_make_all_examples(board, toolchain, all_examples): + start_time = time.monotonic() + ret = [0, 0, 0] + + with Pool(processes=os.cpu_count()) as pool: + pool_args = list((map(lambda e, b=board, o=f"TOOLCHAIN={toolchain}": [e, b, o], all_examples))) + r = pool.starmap(build_utils.build_example, pool_args) + # sum all element of same index (column sum) + rsum = list(map(sum, list(zip(*r)))) + ret[0] += rsum[0] + ret[1] += rsum[1] + ret[2] += rsum[2] + duration = time.monotonic() - start_time + if ret[1] == 0: + status = SUCCEEDED + else: + status = FAILED + + flash_size = "-" + sram_size = "-" + example = 'all' + title = build_utils.build_format.format(example, board, status, "{:.2f}s".format(duration), flash_size, sram_size) + print(title) + return ret + + +def build_family(family, toolchain, build_system, one_per_family, boards): + all_boards = [] + for entry in os.scandir(f"hw/bsp/{family}/boards"): + if entry.is_dir() and entry.name != 'pico_sdk': + all_boards.append(entry.name) + all_boards.sort() + + ret = [0, 0, 0] + + # If only-one flag is set, select one random board + if one_per_family: + for b in boards: + # skip if -b already specify one in this family + if find_family(b) == family: + return ret + all_boards = [random.choice(all_boards)] + + # success, failed, skipped + all_examples = get_examples(family) + for board in all_boards: + r = [0, 0, 0] + if build_system == 'cmake': + r = build_board_cmake(board, toolchain) + elif build_system == 'make': + r = build_board_make_all_examples(board, toolchain, all_examples) + ret[0] += r[0] + ret[1] += r[1] + ret[2] += r[2] + + return ret + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('families', nargs='*', default=[], help='Families to build') + parser.add_argument('-b', '--board', action='append', default=[], help='Boards to build') + parser.add_argument('-t', '--toolchain', default='gcc', help='Toolchain to use, default is gcc') + parser.add_argument('-s', '--build-system', default='cmake', help='Build system to use, default is cmake') + parser.add_argument('-1', '--one-per-family', action='store_true', default=False, help='Build only one random board inside a family') + args = parser.parse_args() + + families = args.families + boards = args.board + toolchain = args.toolchain + build_system = args.build_system + one_per_family = args.one_per_family + + if len(families) == 0 and len(boards) == 0: + print("Please specify families or board to build") + return 1 + + print(build_separator) + print(build_utils.build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) + total_time = time.monotonic() + result = [0, 0, 0] + + # build families + all_families = [] + if 'all' in families: + for entry in os.scandir("hw/bsp"): + if entry.is_dir() and entry.name != 'espressif' and os.path.isfile(entry.path + "/family.cmake"): + all_families.append(entry.name) + else: + all_families = list(families) + all_families.sort() + + # succeeded, failed + for f in all_families: + fret = build_family(f, toolchain, build_system, one_per_family, boards) + result[0] += fret[0] + result[1] += fret[1] + result[2] += fret[2] + + # build boards + for b in boards: + r = [0, 0, 0] + if build_system == 'cmake': + r = build_board_cmake(b, toolchain) + elif build_system == 'make': + all_examples = get_examples(find_family(b)) + r = build_board_make_all_examples(b, toolchain, all_examples) + result[0] += r[0] + result[1] += r[1] + result[2] += r[2] + + total_time = time.monotonic() - total_time + print(build_separator) + print(f"Build Summary: {result[0]} {SUCCEEDED}, {result[1]} {FAILED} and took {total_time:.2f}s") + print(build_separator) + return result[1] + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/build_board.py b/tools/build_board.py deleted file mode 100644 index 13376d126..000000000 --- a/tools/build_board.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import sys -import time -import subprocess -from multiprocessing import Pool - -import build_utils - -SUCCEEDED = "\033[32msucceeded\033[0m" -FAILED = "\033[31mfailed\033[0m" -SKIPPED = "\033[33mskipped\033[0m" - -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 __name__ == '__main__': - # If examples are not specified in arguments, build all - all_examples = [] - for dir1 in os.scandir("examples"): - if dir1.is_dir(): - for entry in os.scandir(dir1.path): - if entry.is_dir(): - all_examples.append(dir1.name + '/' + entry.name) - 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 os.path.exists(entry.path + "/board.mk"): - all_boards.append(entry.name) - filter_with_input(all_boards) - all_boards.sort() - - # Get dependencies - for b in all_boards: - subprocess.run("make -C examples/device/board_test BOARD={} get-deps".format(b), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - print(build_separator) - print(build_utils.build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) - total_time = time.monotonic() - - # succeeded, failed, skipped - total_result = [0, 0, 0] - for example in all_examples: - print(build_separator) - with Pool(processes=os.cpu_count()) as pool: - 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)))) - - # add to total result - total_result = list(map(lambda x, y: x + y, total_result, result)) - - total_time = time.monotonic() - total_time - print(build_separator) - print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1], - FAILED, total_result[2], SKIPPED, total_time)) - print(build_separator) - - sys.exit(total_result[1]) diff --git a/tools/build_cmake.py b/tools/build_cmake.py deleted file mode 100644 index e539b9f94..000000000 --- a/tools/build_cmake.py +++ /dev/null @@ -1,105 +0,0 @@ -import os -import sys -import time -import subprocess -import pathlib -from multiprocessing import Pool - -import build_utils - -SUCCEEDED = "\033[32msucceeded\033[0m" -FAILED = "\033[31mfailed\033[0m" -SKIPPED = "\033[33mskipped\033[0m" - -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 - - -def build_family(family, cmake_option): - all_boards = [] - for entry in os.scandir("hw/bsp/{}/boards".format(family)): - if entry.is_dir() and entry.name != 'pico_sdk': - all_boards.append(entry.name) - all_boards.sort() - - # success, failed, skipped - ret = [0, 0, 0] - for board in all_boards: - start_time = time.monotonic() - - build_dir = f"cmake-build/cmake-build-{board}" - - # Generate build - r = subprocess.run(f"cmake examples -B {build_dir} -G \"Ninja\" -DFAMILY={family} -DBOARD" - f"={board} {cmake_option}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - # Build - if r.returncode == 0: - r = subprocess.run(f"cmake --build {build_dir}", shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - - duration = time.monotonic() - start_time - - if r.returncode == 0: - status = SUCCEEDED - ret[0] += 1 - else: - status = FAILED - ret[1] += 1 - - flash_size = "-" - sram_size = "-" - example = 'all' - title = build_utils.build_format.format(example, board, status, "{:.2f}s".format(duration), flash_size, sram_size) - - if os.getenv('CI'): - # always print build output if in CI - print(f"::group::{title}") - print(r.stdout.decode("utf-8")) - print(f"::endgroup::") - else: - # print build output if failed - print(title) - if r.returncode != 0: - print(r.stdout.decode("utf-8")) - - return ret - - -if __name__ == '__main__': - cmake_options = '' - for a in sys.argv[1:]: - if a.startswith('-'): - cmake_options += ' ' + a - - # If family are not specified in arguments, build all supported - all_families = [] - for entry in os.scandir("hw/bsp"): - if entry.is_dir() and entry.name != 'espressif' and os.path.isfile(entry.path + "/family.cmake"): - all_families.append(entry.name) - filter_with_input(all_families) - all_families.sort() - - print(build_separator) - print(build_utils.build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) - total_time = time.monotonic() - - # succeeded, failed, skipped - total_result = [0, 0, 0] - for family in all_families: - fret = build_family(family, cmake_options) - if len(fret) == len(total_result): - total_result = [total_result[i] + fret[i] for i in range(len(fret))] - - total_time = time.monotonic() - total_time - print(build_separator) - print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1], - FAILED, total_result[2], SKIPPED, total_time)) - print(build_separator) - - sys.exit(total_result[1]) diff --git a/tools/build_esp32.py b/tools/build_esp32.py deleted file mode 100644 index 951467c23..000000000 --- a/tools/build_esp32.py +++ /dev/null @@ -1,106 +0,0 @@ -import os -import glob -import sys -import subprocess -import time - -import build_utils - -SUCCEEDED = "\033[32msucceeded\033[0m" -FAILED = "\033[31mfailed\033[0m" -SKIPPED = "\033[33mskipped\033[0m" - -success_count = 0 -fail_count = 0 -skip_count = 0 -exit_status = 0 - -total_time = time.monotonic() - -build_format = '| {:30} | {:30} | {:18} | {:7} | {:6} | {:6} |' -build_separator = '-' * 107 - -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 - - -# Build all examples if not specified -all_examples = [entry.replace('examples/', '') for entry in glob.glob("examples/*/*_freertos")] -filter_with_input(all_examples) -all_examples.append('device/board_test') -all_examples.sort() - -# Build all boards if not specified -all_boards = [] -for entry in os.scandir("hw/bsp/espressif/boards"): - if entry.is_dir(): - all_boards.append(entry.name) -filter_with_input(all_boards) -all_boards.sort() - -def build_board(example, board): - global success_count, fail_count, skip_count, exit_status - start_time = time.monotonic() - - # Check if board is skipped - build_dir = f"cmake-build/cmake-build-{board}/{example}" - - # Generate and build - r = subprocess.run(f"cmake examples/{example} -B {build_dir} -G \"Ninja\" -DBOARD={board} -DMAX3421_HOST=1", - shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - if r.returncode == 0: - r = subprocess.run(f"cmake --build {build_dir}", shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - build_duration = time.monotonic() - start_time - flash_size = "-" - sram_size = "-" - - if r.returncode == 0: - success = SUCCEEDED - success_count += 1 - #(flash_size, sram_size) = build_size(example, board) - else: - exit_status = r.returncode - success = FAILED - fail_count += 1 - - title = build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size) - if os.getenv('CI'): - # always print build output if in CI - print(f"::group::{title}") - print(r.stdout.decode("utf-8")) - print(f"::endgroup::") - else: - # print build output if failed - print(title) - if r.returncode != 0: - print(r.stdout.decode("utf-8")) - - -def build_size(example, board): - #elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board) - elf_file = 'examples/device/{}/_build/{}/*.elf'.format(example, board) - size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") - size_list = size_output.split('\n')[1].split('\t') - flash_size = int(size_list[0]) - sram_size = int(size_list[1]) + int(size_list[2]) - return (flash_size, sram_size) - - -print(build_separator) -print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) -print(build_separator) - -for example in all_examples: - for board in all_boards: - build_board(example, board) - -total_time = time.monotonic() - total_time -print(build_separator) -print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, total_time)) -print(build_separator) - -sys.exit(exit_status) diff --git a/tools/build_make.py b/tools/build_make.py deleted file mode 100644 index f79a452e4..000000000 --- a/tools/build_make.py +++ /dev/null @@ -1,80 +0,0 @@ -import os -import sys -import time -from multiprocessing import Pool - -import build_utils - -SUCCEEDED = "\033[32msucceeded\033[0m" -FAILED = "\033[31mfailed\033[0m" -SKIPPED = "\033[33mskipped\033[0m" - -build_separator = '-' * 106 - -make_iar_option = 'TOOLCHAIN=iar' - -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 - - -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': - all_boards.append(entry.name) - filter_with_input(all_boards) - all_boards.sort() - - with Pool(processes=os.cpu_count()) as pool: - 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 d in os.scandir("examples"): - if d.is_dir() and 'cmake' not in d.name and 'build_system' not in d.name: - for entry in os.scandir(d.path): - if entry.is_dir() and 'cmake' not in entry.name: - all_examples.append(d.name + '/' + entry.name) - filter_with_input(all_examples) - all_examples.sort() - - # If family are not specified in arguments, build all - all_families = [] - for entry in os.scandir("hw/bsp"): - if entry.is_dir() and os.path.isdir(entry.path + "/boards") and entry.name != 'espressif': - all_families.append(entry.name) - filter_with_input(all_families) - all_families.sort() - - print(build_separator) - print(build_utils.build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM')) - total_time = time.monotonic() - - # succeeded, failed, skipped - total_result = [0, 0, 0] - for example in all_examples: - print(build_separator) - for family in all_families: - fret = build_family(example, family, make_iar_option) - if len(fret) == len(total_result): - total_result = [total_result[i] + fret[i] for i in range(len(fret))] - - total_time = time.monotonic() - total_time - print(build_separator) - print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1], - FAILED, total_result[2], SKIPPED, total_time)) - print(build_separator) - - sys.exit(total_result[1]) diff --git a/tools/gen_doc.py b/tools/gen_doc.py index c63294588..668c77ef6 100644 --- a/tools/gen_doc.py +++ b/tools/gen_doc.py @@ -7,9 +7,9 @@ from get_deps import deps_all TOP = Path(__file__).parent.parent.resolve() -########################################### +# ----------------------------------------- # Dependencies -########################################### +# ----------------------------------------- def gen_deps_doc(): deps_rst = Path(TOP) / "docs/reference/dependencies.rst" diff --git a/tools/get_deps.py b/tools/get_deps.py index 85c8c2126..7fbde0e02 100644 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -1,3 +1,4 @@ +import argparse import sys import subprocess from pathlib import Path @@ -13,7 +14,7 @@ deps_mandatory = { '159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'all'], 'tools/uf2': ['https://github.com/microsoft/uf2.git', - '19615407727073e36d81bf239c52108ba92e7660', + 'c594542b2faa01cc33a2b97c9fbebc38549df80a', 'all'], } @@ -37,18 +38,18 @@ deps_optional = { 'xmc4000'], 'hw/mcu/microchip': ['https://github.com/hathach/microchip_driver.git', '9e8b37e307d8404033bb881623a113931e1edf27', - 'sam3x samd11 samd21 samd51 same5x same7x saml2x samg'], + 'sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg'], 'hw/mcu/mindmotion/mm32sdk': ['https://github.com/hathach/mm32sdk.git', - '0b79559eb411149d36e073c1635c620e576308d4', + 'b93e856211060ae825216c6a1d6aa347ec758843', 'mm32'], 'hw/mcu/nordic/nrfx': ['https://github.com/NordicSemiconductor/nrfx.git', - '2527e3c8449cfd38aee41598e8af8492f410ed15', + '7c47cc0a56ce44658e6da2458e86cd8783ccc4a2', 'nrf'], 'hw/mcu/nuvoton': ['https://github.com/majbthrd/nuc_driver.git', '2204191ec76283371419fbcec207da02e1bc22fa', 'nuc'], 'hw/mcu/nxp/lpcopen': ['https://github.com/hathach/nxp_lpcopen.git', - '84e0bd3e43910aaf71eefd62075cf57495418312', + 'b41cf930e65c734d8ec6de04f1d57d46787c76ae', 'lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43'], 'hw/mcu/nxp/mcux-sdk': ['https://github.com/hathach/mcux-sdk.git', '144f1eb7ea8c06512e12f12b27383601c0272410', @@ -84,7 +85,7 @@ deps_optional = { '2615e866fa48fe1ff1af9e31c348813f2b19e7ec', 'stm32f4'], 'hw/mcu/st/cmsis_device_f7': ['https://github.com/STMicroelectronics/cmsis_device_f7.git', - 'fc676ef1ad177eb874eaa06444d3d75395fc51f4', + '25b0463439303b7a38f0d27b161f7d2f3c096e79', 'stm32f7'], 'hw/mcu/st/cmsis_device_g0': ['https://github.com/STMicroelectronics/cmsis_device_g0.git', '3a23e1224417f3f2d00300ecd620495e363f2094', @@ -96,10 +97,10 @@ deps_optional = { '60dc2c913203dc8629dc233d4384dcc41c91e77f', 'stm32h7'], 'hw/mcu/st/cmsis_device_h5': ['https://github.com/STMicroelectronics/cmsis_device_h5.git', - '62b2cb0fbfe10c5791ee469bbde7b397c2fea8f5', + 'cd2d1d579743de57b88ccaf61a968b9c05848ffc', 'stm32h5'], 'hw/mcu/st/cmsis_device_l0': ['https://github.com/STMicroelectronics/cmsis_device_l0.git', - '06748ca1f93827befdb8b794402320d94d02004f', + '69cd5999fd40ae6e546d4905b21635c6ca1bcb92', 'stm32l0'], 'hw/mcu/st/cmsis_device_l1': ['https://github.com/STMicroelectronics/cmsis_device_l1.git', '7f16ec0a1c4c063f84160b4cc6bf88ad554a823e', @@ -111,7 +112,7 @@ deps_optional = { 'd922865fc0326a102c26211c44b8e42f52c1e53d', 'stm32l5'], 'hw/mcu/st/cmsis_device_u5': ['https://github.com/STMicroelectronics/cmsis_device_u5.git', - '06d7edade7167b0eafdd550bf77cfc4fa98eae2e', + '5ad9797c54ec3e55eff770fc9b3cd4a1aefc1309', 'stm32u5'], 'hw/mcu/st/cmsis_device_wb': ['https://github.com/STMicroelectronics/cmsis_device_wb.git', '9c5d1920dd9fabbe2548e10561d63db829bb744f', @@ -166,9 +167,15 @@ deps_optional = { 'stm32wb'], 'hw/mcu/ti': ['https://github.com/hathach/ti_driver.git', '143ed6cc20a7615d042b03b21e070197d473e6e5', - 'msp430 msp432e4 tm4c123'], + 'msp430 msp432e4 tm4c'], + 'hw/mcu/wch/ch32v103': ['https://github.com/openwch/ch32v103.git', + '7578cae0b21f86dd053a1f781b2fc6ab99d0ec17', + 'ch32v10x'], + 'hw/mcu/wch/ch32v20x': ['https://github.com/openwch/ch32v20x.git', + 'c4c38f507e258a4e69b059ccc2dc27dde33cea1b', + 'ch32v20x'], 'hw/mcu/wch/ch32v307': ['https://github.com/openwch/ch32v307.git', - '17761f5cf9dbbf2dcf665b7c04934188add20082', + '184f21b852cb95eed58e86e901837bc9fff68775', 'ch32v307'], 'hw/mcu/wch/ch32f20x': ['https://github.com/openwch/ch32f20x.git', '77c4095087e5ed2c548ec9058e655d0b8757663b', @@ -176,8 +183,11 @@ deps_optional = { 'lib/CMSIS_5': ['https://github.com/ARM-software/CMSIS_5.git', '20285262657d1b482d132d20d755c8c330d55c1f', 'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2x' + 'lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43' 'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5' - 'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'], + 'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb' + 'sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg' + 'tm4c'], 'lib/sct_neopixel': ['https://github.com/gsteiert/sct_neopixel.git', 'e73e04ca63495672d955f9268e003cffe168fcd8', 'lpc55'], @@ -224,27 +234,59 @@ def get_a_dep(d): return 0 -# Arguments can be -# - family name -# - specific deps path -# - all -if __name__ == "__main__": +def find_family(board): + bsp_dir = Path(TOP / "hw/bsp") + for family_dir in bsp_dir.iterdir(): + if family_dir.is_dir(): + board_dir = family_dir / 'boards' / board + if board_dir.exists(): + return family_dir.name + return None + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('families', nargs='*', default=[], help='Families to fetch') + parser.add_argument('-b', '--board', action='append', default=[], help='Boards to fetch') + parser.add_argument('--print', action='store_true', help='Print commit hash only') + args = parser.parse_args() + + families = args.families + boards = args.board + print_only = args.print + status = 0 deps = list(deps_mandatory.keys()) - # get all if 'all' is argument - if len(sys.argv) == 2 and sys.argv[1] == 'all': + + if 'all' in families: deps += deps_optional.keys() else: - for arg in sys.argv[1:]: - if arg in deps_all.keys(): - # if arg is a dep, add it - deps.append(arg) - else: - # arg is a family name, add all deps of that family - for d in deps_optional: - if arg in deps_optional[d][2]: - deps.append(d) + families = list(families) + if boards is not None: + for b in boards: + f = find_family(b) + if f is not None: + families.append(f) - with Pool() as pool: - status = sum(pool.map(get_a_dep, deps)) - sys.exit(status) + for f in families: + for d in deps_optional: + if d not in deps and f in deps_optional[d][2]: + deps.append(d) + + if print_only: + pvalue = {} + # print only without arguments, always add CMSIS_5 + if len(families) == 0 and len(boards) == 0: + deps.append('lib/CMSIS_5') + for d in deps: + commit = deps_all[d][1] + pvalue[d] = commit + print(pvalue) + else: + with Pool() as pool: + status = sum(pool.map(get_a_dep, deps)) + return status + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/iar_gen.py b/tools/iar_gen.py index 264dd9a58..ebcfa1423 100644 --- a/tools/iar_gen.py +++ b/tools/iar_gen.py @@ -56,6 +56,7 @@ def Main(): def ListPath(path, blacklist=[]): # Get all .c files files = glob.glob(f'../{path}/**/*.c', recursive=True) + files.extend(glob.glob(f'../{path}/**/*.h', recursive=True)) # Filter files = [x for x in files if all(y not in x for y in blacklist)] # Get common dir list @@ -77,6 +78,8 @@ def List(): ListPath('lib/SEGGER_RTT') if __name__ == "__main__": + if os.path.dirname(os.getcwd()) != 'tools': + os.chdir('tools') if (len(sys.argv) > 1): if (sys.argv[1] == 'l'): List() diff --git a/tools/iar_template.ipcf b/tools/iar_template.ipcf index c3683c3d7..33a6ef045 100644 --- a/tools/iar_template.ipcf +++ b/tools/iar_template.ipcf @@ -10,57 +10,101 @@ <files> <group name="src"> <path>$TUSB_DIR$/src/tusb.c</path> + <path>$TUSB_DIR$/src/tusb.h</path> + <path>$TUSB_DIR$/src/tusb_option.h</path> </group> <group name="src/class/audio"> <path>$TUSB_DIR$/src/class/audio/audio_device.c</path> + <path>$TUSB_DIR$/src/class/audio/audio.h</path> + <path>$TUSB_DIR$/src/class/audio/audio_device.h</path> </group> <group name="src/class/bth"> <path>$TUSB_DIR$/src/class/bth/bth_device.c</path> + <path>$TUSB_DIR$/src/class/bth/bth_device.h</path> </group> <group name="src/class/cdc"> <path>$TUSB_DIR$/src/class/cdc/cdc_device.c</path> <path>$TUSB_DIR$/src/class/cdc/cdc_host.c</path> <path>$TUSB_DIR$/src/class/cdc/cdc_rndis_host.c</path> + <path>$TUSB_DIR$/src/class/cdc/cdc.h</path> + <path>$TUSB_DIR$/src/class/cdc/cdc_device.h</path> + <path>$TUSB_DIR$/src/class/cdc/cdc_host.h</path> + <path>$TUSB_DIR$/src/class/cdc/cdc_rndis.h</path> + <path>$TUSB_DIR$/src/class/cdc/cdc_rndis_host.h</path> </group> <group name="src/class/dfu"> <path>$TUSB_DIR$/src/class/dfu/dfu_device.c</path> <path>$TUSB_DIR$/src/class/dfu/dfu_rt_device.c</path> + <path>$TUSB_DIR$/src/class/dfu/dfu.h</path> + <path>$TUSB_DIR$/src/class/dfu/dfu_device.h</path> + <path>$TUSB_DIR$/src/class/dfu/dfu_rt_device.h</path> </group> <group name="src/class/hid"> <path>$TUSB_DIR$/src/class/hid/hid_device.c</path> <path>$TUSB_DIR$/src/class/hid/hid_host.c</path> + <path>$TUSB_DIR$/src/class/hid/hid.h</path> + <path>$TUSB_DIR$/src/class/hid/hid_device.h</path> + <path>$TUSB_DIR$/src/class/hid/hid_host.h</path> </group> <group name="src/class/midi"> <path>$TUSB_DIR$/src/class/midi/midi_device.c</path> + <path>$TUSB_DIR$/src/class/midi/midi.h</path> + <path>$TUSB_DIR$/src/class/midi/midi_device.h</path> </group> <group name="src/class/msc"> <path>$TUSB_DIR$/src/class/msc/msc_device.c</path> <path>$TUSB_DIR$/src/class/msc/msc_host.c</path> + <path>$TUSB_DIR$/src/class/msc/msc.h</path> + <path>$TUSB_DIR$/src/class/msc/msc_device.h</path> + <path>$TUSB_DIR$/src/class/msc/msc_host.h</path> </group> <group name="src/class/net"> <path>$TUSB_DIR$/src/class/net/ecm_rndis_device.c</path> <path>$TUSB_DIR$/src/class/net/ncm_device.c</path> + <path>$TUSB_DIR$/src/class/net/ncm.h</path> + <path>$TUSB_DIR$/src/class/net/net_device.h</path> </group> <group name="src/class/usbtmc"> <path>$TUSB_DIR$/src/class/usbtmc/usbtmc_device.c</path> + <path>$TUSB_DIR$/src/class/usbtmc/usbtmc.h</path> + <path>$TUSB_DIR$/src/class/usbtmc/usbtmc_device.h</path> </group> <group name="src/class/vendor"> <path>$TUSB_DIR$/src/class/vendor/vendor_device.c</path> <path>$TUSB_DIR$/src/class/vendor/vendor_host.c</path> + <path>$TUSB_DIR$/src/class/vendor/vendor_device.h</path> + <path>$TUSB_DIR$/src/class/vendor/vendor_host.h</path> </group> <group name="src/class/video"> <path>$TUSB_DIR$/src/class/video/video_device.c</path> + <path>$TUSB_DIR$/src/class/video/video.h</path> + <path>$TUSB_DIR$/src/class/video/video_device.h</path> </group> <group name="src/common"> <path>$TUSB_DIR$/src/common/tusb_fifo.c</path> + <path>$TUSB_DIR$/src/common/tusb_common.h</path> + <path>$TUSB_DIR$/src/common/tusb_compiler.h</path> + <path>$TUSB_DIR$/src/common/tusb_debug.h</path> + <path>$TUSB_DIR$/src/common/tusb_fifo.h</path> + <path>$TUSB_DIR$/src/common/tusb_mcu.h</path> + <path>$TUSB_DIR$/src/common/tusb_private.h</path> + <path>$TUSB_DIR$/src/common/tusb_types.h</path> + <path>$TUSB_DIR$/src/common/tusb_verify.h</path> </group> <group name="src/device"> <path>$TUSB_DIR$/src/device/usbd.c</path> <path>$TUSB_DIR$/src/device/usbd_control.c</path> + <path>$TUSB_DIR$/src/device/dcd.h</path> + <path>$TUSB_DIR$/src/device/usbd.h</path> + <path>$TUSB_DIR$/src/device/usbd_pvt.h</path> </group> <group name="src/host"> <path>$TUSB_DIR$/src/host/hub.c</path> <path>$TUSB_DIR$/src/host/usbh.c</path> + <path>$TUSB_DIR$/src/host/hcd.h</path> + <path>$TUSB_DIR$/src/host/hub.h</path> + <path>$TUSB_DIR$/src/host/usbh.h</path> + <path>$TUSB_DIR$/src/host/usbh_pvt.h</path> </group> <group name="src/portable/analog/max3421"> <path>$TUSB_DIR$/src/portable/analog/max3421/hcd_max3421.c</path> @@ -70,26 +114,39 @@ </group> <group name="src/portable/chipidea/ci_fs"> <path>$TUSB_DIR$/src/portable/chipidea/ci_fs/dcd_ci_fs.c</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_fs/ci_fs_kinetis.h</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_fs/ci_fs_mcx.h</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_fs/ci_fs_type.h</path> </group> <group name="src/portable/chipidea/ci_hs"> <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/dcd_ci_hs.c</path> <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/hcd_ci_hs.c</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/ci_hs_imxrt.h</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/ci_hs_lpc18_43.h</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/ci_hs_mcx.h</path> + <path>$TUSB_DIR$/src/portable/chipidea/ci_hs/ci_hs_type.h</path> </group> <group name="src/portable/dialog/da146xx"> <path>$TUSB_DIR$/src/portable/dialog/da146xx/dcd_da146xx.c</path> </group> <group name="src/portable/ehci"> <path>$TUSB_DIR$/src/portable/ehci/ehci.c</path> + <path>$TUSB_DIR$/src/portable/ehci/ehci.h</path> + <path>$TUSB_DIR$/src/portable/ehci/ehci_api.h</path> </group> <group name="src/portable/mentor/musb"> <path>$TUSB_DIR$/src/portable/mentor/musb/dcd_musb.c</path> <path>$TUSB_DIR$/src/portable/mentor/musb/hcd_musb.c</path> + <path>$TUSB_DIR$/src/portable/mentor/musb/musb_msp432e.h</path> + <path>$TUSB_DIR$/src/portable/mentor/musb/musb_tm4c.h</path> + <path>$TUSB_DIR$/src/portable/mentor/musb/musb_type.h</path> </group> <group name="src/portable/microchip/pic"> <path>$TUSB_DIR$/src/portable/microchip/pic/dcd_pic.c</path> </group> <group name="src/portable/microchip/pic32mz"> <path>$TUSB_DIR$/src/portable/microchip/pic32mz/dcd_pic32mz.c</path> + <path>$TUSB_DIR$/src/portable/microchip/pic32mz/usbhs_registers.h</path> </group> <group name="src/portable/microchip/samd"> <path>$TUSB_DIR$/src/portable/microchip/samd/dcd_samd.c</path> @@ -99,6 +156,7 @@ </group> <group name="src/portable/microchip/samx7x"> <path>$TUSB_DIR$/src/portable/microchip/samx7x/dcd_samx7x.c</path> + <path>$TUSB_DIR$/src/portable/microchip/samx7x/common_usb_regs.h</path> </group> <group name="src/portable/mindmotion/mm32"> <path>$TUSB_DIR$/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c</path> @@ -122,12 +180,14 @@ <group name="src/portable/nxp/lpc17_40"> <path>$TUSB_DIR$/src/portable/nxp/lpc17_40/dcd_lpc17_40.c</path> <path>$TUSB_DIR$/src/portable/nxp/lpc17_40/hcd_lpc17_40.c</path> + <path>$TUSB_DIR$/src/portable/nxp/lpc17_40/dcd_lpc17_40.h</path> </group> <group name="src/portable/nxp/lpc_ip3511"> <path>$TUSB_DIR$/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c</path> </group> <group name="src/portable/ohci"> <path>$TUSB_DIR$/src/portable/ohci/ohci.c</path> + <path>$TUSB_DIR$/src/portable/ohci/ohci.h</path> </group> <group name="src/portable/raspberrypi/pio_usb"> <path>$TUSB_DIR$/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c</path> @@ -137,42 +197,79 @@ <path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/dcd_rp2040.c</path> <path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/hcd_rp2040.c</path> <path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/rp2040_usb.c</path> + <path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/rp2040_usb.h</path> </group> <group name="src/portable/renesas/rusb2"> <path>$TUSB_DIR$/src/portable/renesas/rusb2/dcd_rusb2.c</path> <path>$TUSB_DIR$/src/portable/renesas/rusb2/hcd_rusb2.c</path> <path>$TUSB_DIR$/src/portable/renesas/rusb2/rusb2_common.c</path> + <path>$TUSB_DIR$/src/portable/renesas/rusb2/rusb2_ra.h</path> + <path>$TUSB_DIR$/src/portable/renesas/rusb2/rusb2_rx.h</path> + <path>$TUSB_DIR$/src/portable/renesas/rusb2/rusb2_type.h</path> </group> <group name="src/portable/sony/cxd56"> <path>$TUSB_DIR$/src/portable/sony/cxd56/dcd_cxd56.c</path> </group> <group name="src/portable/st/stm32_fsdev"> <path>$TUSB_DIR$/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c</path> + <path>$TUSB_DIR$/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.h</path> </group> <group name="src/portable/st/typec"> <path>$TUSB_DIR$/src/portable/st/typec/typec_stm32.c</path> </group> <group name="src/portable/sunxi"> <path>$TUSB_DIR$/src/portable/sunxi/dcd_sunxi_musb.c</path> + <path>$TUSB_DIR$/src/portable/sunxi/musb_def.h</path> </group> <group name="src/portable/synopsys/dwc2"> <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dcd_dwc2.c</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_bcm.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_efm32.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_esp32.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_gd32.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_stm32.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_type.h</path> + <path>$TUSB_DIR$/src/portable/synopsys/dwc2/dwc2_xmc.h</path> </group> <group name="src/portable/ti/msp430x5xx"> <path>$TUSB_DIR$/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c</path> </group> <group name="src/portable/valentyusb/eptri"> <path>$TUSB_DIR$/src/portable/valentyusb/eptri/dcd_eptri.c</path> + <path>$TUSB_DIR$/src/portable/valentyusb/eptri/dcd_eptri.h</path> </group> <group name="src/portable/wch"> + <path>$TUSB_DIR$/src/portable/wch/dcd_ch32_usbfs.c</path> <path>$TUSB_DIR$/src/portable/wch/dcd_ch32_usbhs.c</path> + <path>$TUSB_DIR$/src/portable/wch/ch32_usbhs_reg.h</path> </group> <group name="src/typec"> <path>$TUSB_DIR$/src/typec/usbc.c</path> + <path>$TUSB_DIR$/src/typec/pd_types.h</path> + <path>$TUSB_DIR$/src/typec/tcd.h</path> + <path>$TUSB_DIR$/src/typec/usbc.h</path> + </group> + <group name="src/class/cdc/serial"> + <path>$TUSB_DIR$/src/class/cdc/serial/ch34x.h</path> + <path>$TUSB_DIR$/src/class/cdc/serial/cp210x.h</path> + <path>$TUSB_DIR$/src/class/cdc/serial/ftdi_sio.h</path> + </group> + <group name="src/osal"> + <path>$TUSB_DIR$/src/osal/osal.h</path> + <path>$TUSB_DIR$/src/osal/osal_freertos.h</path> + <path>$TUSB_DIR$/src/osal/osal_mynewt.h</path> + <path>$TUSB_DIR$/src/osal/osal_none.h</path> + <path>$TUSB_DIR$/src/osal/osal_pico.h</path> + <path>$TUSB_DIR$/src/osal/osal_rtthread.h</path> + <path>$TUSB_DIR$/src/osal/osal_rtx4.h</path> </group> <group name="lib/SEGGER_RTT/RTT"> <path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT.c</path> <path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT_printf.c</path> + <path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT.h</path> + </group> + <group name="lib/SEGGER_RTT/Config"> + <path>$TUSB_DIR$/lib/SEGGER_RTT/Config/SEGGER_RTT_Conf.h</path> </group> </files> diff --git a/tools/make_release.py b/tools/make_release.py index 256ca8f21..126e07292 100644 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -1,4 +1,5 @@ import re +import gen_doc version = '0.16.0' @@ -46,4 +47,6 @@ with open(f_library_json, 'w') as f: # docs/info/changelog.rst ################### +gen_doc.gen_deps_doc() + print("Update docs/info/changelog.rst") |
