summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/build_board.py4
-rw-r--r--tools/build_family.py11
-rw-r--r--tools/build_utils.py31
-rw-r--r--tools/get_dependencies.py25
-rw-r--r--tools/get_deps.py111
-rw-r--r--tools/get_family_deps.py21
-rw-r--r--tools/iar_template.ipcf2
-rw-r--r--tools/make_release.py40
-rw-r--r--tools/mksunxi.py2
-rwxr-xr-xtools/pcapng_to_corpus.py44
-rw-r--r--tools/top.mk30
m---------tools/uf20
-rw-r--r--tools/usb_drivers/tinyusb_win_usbser.inf2
13 files changed, 247 insertions, 76 deletions
diff --git a/tools/build_board.py b/tools/build_board.py
index 8d10ef820..13376d126 100644
--- a/tools/build_board.py
+++ b/tools/build_board.py
@@ -52,11 +52,11 @@ 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))))
-
+
# add to total result
total_result = list(map(lambda x, y: x + y, total_result, result))
diff --git a/tools/build_family.py b/tools/build_family.py
index c6c64d2b3..cdc099691 100644
--- a/tools/build_family.py
+++ b/tools/build_family.py
@@ -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
diff --git a/tools/build_utils.py b/tools/build_utils.py
index f457c7986..d0ef52717 100644
--- a/tools/build_utils.py
+++ b/tools/build_utils.py
@@ -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 = "-"
@@ -85,21 +85,22 @@ def build_example(example, board):
# succeeded, failed, skipped
ret = [0, 0, 0]
+ make_cmd = "make -j -C examples/{} BOARD={} {}".format(example, board, make_option)
+
# Check if board is skipped
if skip_example(example, board):
status = SKIPPED
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,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ subprocess.run(make_cmd + " clean", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ build_result = subprocess.run(make_cmd + " all", 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,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ (flash_size, sram_size) = build_size(make_cmd)
+ #subprocess.run(make_cmd + " copy-artifact", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
status = FAILED
ret[1] = 1
@@ -113,10 +114,14 @@ def build_example(example, board):
return ret
-def build_size(example, board):
- elf_file = 'examples/{}/_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)
+def build_size(make_cmd):
+ size_output = subprocess.run(make_cmd + ' size', shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8").splitlines()
+ for i, l in enumerate(size_output):
+ text_title = 'text data bss dec'
+ if text_title in l:
+ size_list = size_output[i+1].split('\t')
+ flash_size = int(size_list[0])
+ sram_size = int(size_list[1]) + int(size_list[2])
+ return (flash_size, sram_size)
+
+ return (0, 0)
diff --git a/tools/get_dependencies.py b/tools/get_dependencies.py
deleted file mode 100644
index e7d3e0a76..000000000
--- a/tools/get_dependencies.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-import sys
-import subprocess
-
-
-# dependency lookup (ABC sorted)
-# deps = {
-# 'LPC11UXX' : [ [] ]
-# }
-
-
-def get_family_dep(family):
- for entry in os.scandir("hw/bsp/{}/boards".format(family)):
- if entry.is_dir():
- result = subprocess.run("make -C examples/device/board_test BOARD={} get-deps".format(entry.name),
- shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- print(result.stdout.decode("utf-8"))
- return result.returncode
-
-status = 0
-all_family = sys.argv[1:]
-for f in all_family:
- status += get_family_dep(f)
-
-sys.exit(status) \ No newline at end of file
diff --git a/tools/get_deps.py b/tools/get_deps.py
new file mode 100644
index 000000000..8bf56cd8d
--- /dev/null
+++ b/tools/get_deps.py
@@ -0,0 +1,111 @@
+import sys
+import subprocess
+from pathlib import Path
+from multiprocessing import Pool
+
+# Mandatory Dependencies that is always fetched
+# path, url, commit (Alphabet sorted by path)
+deps_mandatory = {
+ 'lib/FreeRTOS-Kernel' : ['def7d2df2b0506d3d249334974f51e427c17a41c', 'https://github.com/FreeRTOS/FreeRTOS-Kernel.git' ],
+ 'lib/lwip' : ['159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'https://github.com/lwip-tcpip/lwip.git' ],
+ 'tools/uf2' : ['19615407727073e36d81bf239c52108ba92e7660', 'https://github.com/microsoft/uf2.git' ],
+}
+
+# Optional Dependencies per MCU
+# path, url, commit (Alphabet sorted by path)
+deps_optional = {
+ 'hw/mcu/allwinner' : ['8e5e89e8e132c0fd90e72d5422e5d3d68232b756', 'https://github.com/hathach/allwinner_driver.git' ],
+ 'hw/mcu/bridgetek/ft9xx/ft90x-sdk' : ['91060164afe239fcb394122e8bf9eb24d3194eb1', 'https://github.com/BRTSG-FOSS/ft90x-sdk.git' ],
+ 'hw/mcu/broadcom' : ['08370086080759ed54ac1136d62d2ad24c6fa267', 'https://github.com/adafruit/broadcom-peripherals.git' ],
+ 'hw/mcu/gd/nuclei-sdk' : ['7eb7bfa9ea4fbeacfafe1d5f77d5a0e6ed3922e7', 'https://github.com/Nuclei-Software/nuclei-sdk.git' ],
+ 'hw/mcu/infineon/mtb-xmclib-cat3' : ['daf5500d03cba23e68c2f241c30af79cd9d63880', 'https://github.com/Infineon/mtb-xmclib-cat3.git' ],
+ 'hw/mcu/microchip' : ['9e8b37e307d8404033bb881623a113931e1edf27', 'https://github.com/hathach/microchip_driver.git' ],
+ 'hw/mcu/mindmotion/mm32sdk' : ['0b79559eb411149d36e073c1635c620e576308d4', 'https://github.com/hathach/mm32sdk.git' ],
+ 'hw/mcu/nordic/nrfx' : ['281cc2e178fd9a470d844b3afdea9eb322a0b0e8', 'https://github.com/NordicSemiconductor/nrfx.git' ],
+ 'hw/mcu/nuvoton' : ['2204191ec76283371419fbcec207da02e1bc22fa', 'https://github.com/majbthrd/nuc_driver.git' ],
+ 'hw/mcu/nxp/lpcopen' : ['43c45c85405a5dd114fff0ea95cca62837740c13', 'https://github.com/hathach/nxp_lpcopen.git' ],
+ 'hw/mcu/nxp/mcux-sdk' : ['ae2ab01d9d70ad00cd0e935c2552bd5f0e5c0294', 'https://github.com/NXPmicro/mcux-sdk.git' ],
+ 'hw/mcu/nxp/nxp_sdk' : ['845c8fc49b6fb660f06a5c45225494eacb06f00c', 'https://github.com/hathach/nxp_sdk.git' ],
+ 'hw/mcu/raspberry_pi/Pico-PIO-USB' : ['c3715ce94b6f6391856de56081d4d9b3e98fa93d', 'https://github.com/sekigon-gonnoc/Pico-PIO-USB.git' ],
+ 'hw/mcu/renesas/fsp' : ['8dc14709f2a6518b43f71efad70d900b7718d9f1', 'https://github.com/renesas/fsp.git' ],
+ 'hw/mcu/renesas/rx' : ['706b4e0cf485605c32351e2f90f5698267996023', 'https://github.com/kkitayam/rx_device.git' ],
+ 'hw/mcu/silabs/cmsis-dfp-efm32gg12b' : ['f1c31b7887669cb230b3ea63f9b56769078960bc', 'https://github.com/cmsis-packs/cmsis-dfp-efm32gg12b.git' ],
+ 'hw/mcu/sony/cxd56/spresense-exported-sdk' : ['2ec2a1538362696118dc3fdf56f33dacaf8f4067', 'https://github.com/sonydevworld/spresense-exported-sdk.git' ],
+ 'hw/mcu/st/cmsis_device_f0' : ['2fc25ee22264bc27034358be0bd400b893ef837e', 'https://github.com/STMicroelectronics/cmsis_device_f0.git' ],
+ 'hw/mcu/st/cmsis_device_f1' : ['6601104a6397299b7304fd5bcd9a491f56cb23a6', 'https://github.com/STMicroelectronics/cmsis_device_f1.git' ],
+ 'hw/mcu/st/cmsis_device_f2' : ['182fcb3681ce116816feb41b7764f1b019ce796f', 'https://github.com/STMicroelectronics/cmsis_device_f2.git' ],
+ 'hw/mcu/st/cmsis_device_f3' : ['5e4ee5ed7a7b6c85176bb70a9fd3c72d6eb99f1b', 'https://github.com/STMicroelectronics/cmsis_device_f3.git' ],
+ 'hw/mcu/st/cmsis_device_f4' : ['2615e866fa48fe1ff1af9e31c348813f2b19e7ec', 'https://github.com/STMicroelectronics/cmsis_device_f4.git' ],
+ 'hw/mcu/st/cmsis_device_f7' : ['fc676ef1ad177eb874eaa06444d3d75395fc51f4', 'https://github.com/STMicroelectronics/cmsis_device_f7.git' ],
+ 'hw/mcu/st/cmsis_device_g0' : ['08258b28ee95f50cb9624d152a1cbf084be1f9a5', 'https://github.com/STMicroelectronics/cmsis_device_g0.git' ],
+ 'hw/mcu/st/cmsis_device_g4' : ['ce822adb1dc552b3aedd13621edbc7fdae124878', 'https://github.com/STMicroelectronics/cmsis_device_g4.git' ],
+ 'hw/mcu/st/cmsis_device_h7' : ['60dc2c913203dc8629dc233d4384dcc41c91e77f', 'https://github.com/STMicroelectronics/cmsis_device_h7.git' ],
+ 'hw/mcu/st/cmsis_device_l0' : ['06748ca1f93827befdb8b794402320d94d02004f', 'https://github.com/STMicroelectronics/cmsis_device_l0.git' ],
+ 'hw/mcu/st/cmsis_device_l1' : ['7f16ec0a1c4c063f84160b4cc6bf88ad554a823e', 'https://github.com/STMicroelectronics/cmsis_device_l1.git' ],
+ 'hw/mcu/st/cmsis_device_l4' : ['6ca7312fa6a5a460b5a5a63d66da527fdd8359a6', 'https://github.com/STMicroelectronics/cmsis_device_l4.git' ],
+ 'hw/mcu/st/cmsis_device_l5' : ['d922865fc0326a102c26211c44b8e42f52c1e53d', 'https://github.com/STMicroelectronics/cmsis_device_l5.git' ],
+ 'hw/mcu/st/cmsis_device_u5' : ['bc00f3c9d8a4e25220f84c26d414902cc6bdf566', 'https://github.com/STMicroelectronics/cmsis_device_u5.git' ],
+ 'hw/mcu/st/cmsis_device_wb' : ['9c5d1920dd9fabbe2548e10561d63db829bb744f', 'https://github.com/STMicroelectronics/cmsis_device_wb.git' ],
+ 'hw/mcu/st/stm32f0xx_hal_driver' : ['0e95cd88657030f640a11e690a8a5186c7712ea5', 'https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git'],
+ 'hw/mcu/st/stm32f1xx_hal_driver' : ['1dd9d3662fb7eb2a7f7d3bc0a4c1dc7537915a29', 'https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git'],
+ 'hw/mcu/st/stm32f2xx_hal_driver' : ['c75ace9b908a9aca631193ebf2466963b8ea33d0', 'https://github.com/STMicroelectronics/stm32f2xx_hal_driver.git'],
+ 'hw/mcu/st/stm32f3xx_hal_driver' : ['1761b6207318ede021706e75aae78f452d72b6fa', 'https://github.com/STMicroelectronics/stm32f3xx_hal_driver.git'],
+ 'hw/mcu/st/stm32f4xx_hal_driver' : ['04e99fbdabd00ab8f370f377c66b0a4570365b58', 'https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git'],
+ 'hw/mcu/st/stm32f7xx_hal_driver' : ['f7ffdf6bf72110e58b42c632b0a051df5997e4ee', 'https://github.com/STMicroelectronics/stm32f7xx_hal_driver.git'],
+ 'hw/mcu/st/stm32g0xx_hal_driver' : ['5b53e6cee664a82b16c86491aa0060e2110c00cb', 'https://github.com/STMicroelectronics/stm32g0xx_hal_driver.git'],
+ 'hw/mcu/st/stm32g4xx_hal_driver' : ['8b4518417706d42eef5c14e56a650005abf478a8', 'https://github.com/STMicroelectronics/stm32g4xx_hal_driver.git'],
+ 'hw/mcu/st/stm32h7xx_hal_driver' : ['d8461b980b59b1625207d8c4f2ce0a9c2a7a3b04', 'https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git'],
+ 'hw/mcu/st/stm32l0xx_hal_driver' : ['fbdacaf6f8c82a4e1eb9bd74ba650b491e97e17b', 'https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git'],
+ 'hw/mcu/st/stm32l1xx_hal_driver' : ['44efc446fa69ed8344e7fd966e68ed11043b35d9', 'https://github.com/STMicroelectronics/stm32l1xx_hal_driver.git'],
+ 'hw/mcu/st/stm32l4xx_hal_driver' : ['aee3d5bf283ae5df87532b781bdd01b7caf256fc', 'https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git'],
+ 'hw/mcu/st/stm32l5xx_hal_driver' : ['675c32a75df37f39d50d61f51cb0dcf53f07e1cb', 'https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git'],
+ 'hw/mcu/st/stm32u5xx_hal_driver' : ['2e1d4cdb386e33391cb261dfff4fefa92e4aa35a', 'https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git'],
+ 'hw/mcu/st/stm32wbxx_hal_driver' : ['2c5f06638be516c1b772f768456ba637f077bac8', 'https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git'],
+ 'hw/mcu/ti' : ['143ed6cc20a7615d042b03b21e070197d473e6e5', 'https://github.com/hathach/ti_driver.git' ],
+ 'hw/mcu/wch/ch32v307' : ['17761f5cf9dbbf2dcf665b7c04934188add20082', 'https://github.com/openwch/ch32v307.git' ],
+ 'lib/CMSIS_5' : ['20285262657d1b482d132d20d755c8c330d55c1f', 'https://github.com/ARM-software/CMSIS_5.git' ],
+ 'lib/sct_neopixel' : ['e73e04ca63495672d955f9268e003cffe168fcd8', 'https://github.com/gsteiert/sct_neopixel.git' ],
+}
+
+# combined 2 deps
+deps_all = {**deps_mandatory, **deps_optional}
+
+# TOP is tinyusb root dir
+TOP = Path(__file__).parent.parent.resolve()
+
+
+def get_a_dep(d):
+ if d not in deps_all.keys():
+ print('{} is not found in dependency list')
+ return 1
+ commit = deps_all[d][0]
+ url = deps_all[d][1]
+ print('cloning {} with {}'.format(d, url))
+
+ p = Path(TOP / d)
+ git_cmd = "git -C {}".format(p)
+
+ # Init git deps if not existed
+ if not p.exists():
+ p.mkdir(parents=True)
+ subprocess.run("{} init".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ subprocess.run("{} remote add origin {}".format(git_cmd, url), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+ # Check if commit is already fetched
+ result = subprocess.run("{} rev-parse HEAD".format(git_cmd, commit), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ head = result.stdout.decode("utf-8").splitlines()[0]
+
+ if commit != head:
+ subprocess.run("{} reset --hard".format(git_cmd, commit), shell=True)
+ subprocess.run("{} fetch --depth 1 origin {}".format(git_cmd, commit), shell=True)
+ subprocess.run("{} checkout FETCH_HEAD".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+ return 0
+
+
+if __name__ == "__main__":
+ status = 0
+ deps = list(deps_mandatory.keys()) + sys.argv[1:]
+ with Pool() as pool:
+ status = sum(pool.map(get_a_dep, deps))
+ sys.exit(status)
diff --git a/tools/get_family_deps.py b/tools/get_family_deps.py
new file mode 100644
index 000000000..071d7b756
--- /dev/null
+++ b/tools/get_family_deps.py
@@ -0,0 +1,21 @@
+import sys
+import subprocess
+import os
+
+# TOP is tinyusb root dir
+TOP = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+def get_family_dep(family):
+ for entry in os.scandir("{}/hw/bsp/{}/boards".format(TOP, family)):
+ if entry.is_dir():
+ result = subprocess.run("make -C {}/examples/device/board_test BOARD={} get-deps".format(TOP, entry.name),
+ shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ print(result.stdout.decode("utf-8"))
+ return result.returncode
+
+
+status = 0
+for d in sys.argv[1:]:
+ status += get_family_dep(d)
+
+sys.exit(status)
diff --git a/tools/iar_template.ipcf b/tools/iar_template.ipcf
index ba54fe057..d243aab0a 100644
--- a/tools/iar_template.ipcf
+++ b/tools/iar_template.ipcf
@@ -141,5 +141,5 @@
<path>$TUSB_DIR$/lib/SEGGER_RTT/Syscalls/SEGGER_RTT_Syscalls_IAR.c</path>
</group>
</files>
-
+
</iarProjectConnection>
diff --git a/tools/make_release.py b/tools/make_release.py
new file mode 100644
index 000000000..7481e8864
--- /dev/null
+++ b/tools/make_release.py
@@ -0,0 +1,40 @@
+import re
+
+version = '0.15.0'
+
+print('version {}'.format(version))
+ver_id = version.split('.')
+
+###################
+# src/tusb_option.h
+###################
+f_option_h = 'src/tusb_option.h'
+
+with open(f_option_h) as f:
+ fdata = f.read()
+
+fdata = re.sub(r'(#define TUSB_VERSION_MAJOR *) \d+', r"\1 {}".format(ver_id[0]), fdata)
+fdata = re.sub(r'(#define TUSB_VERSION_MINOR *) \d+', r"\1 {}".format(ver_id[1]), fdata)
+fdata = re.sub(r'(#define TUSB_VERSION_REVISION *) \d+', r"\1 {}".format(ver_id[2]), fdata)
+
+# Write the file out again
+with open(f_option_h, 'w') as f:
+ f.write(fdata)
+
+###################
+# repository.yml
+###################
+f_repository_yml = 'repository.yml'
+with open(f_repository_yml) as f:
+ fdata = f.read()
+
+if fdata.find(version) < 0:
+ fdata = re.sub(r'("0-latest"): "\d+\.\d+\.\d+"', r'"{}": "{}"\r\n \1: "{}"'.format(version, version, version), fdata)
+ with open(f_repository_yml, 'w') as f:
+ f.write(fdata)
+
+###################
+# docs/info/changelog.rst
+###################
+
+print("Update docs/info/changelog.rst")
diff --git a/tools/mksunxi.py b/tools/mksunxi.py
index 04786f429..fd8557cfc 100644
--- a/tools/mksunxi.py
+++ b/tools/mksunxi.py
@@ -45,4 +45,4 @@ if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: mksunxi.py input.bin output.bin")
exit(1)
- exit(process_file(sys.argv[1], sys.argv[2])) \ No newline at end of file
+ exit(process_file(sys.argv[1], sys.argv[2]))
diff --git a/tools/pcapng_to_corpus.py b/tools/pcapng_to_corpus.py
new file mode 100755
index 000000000..9c31365eb
--- /dev/null
+++ b/tools/pcapng_to_corpus.py
@@ -0,0 +1,44 @@
+#!/bin/python3
+import argparse
+import pcapng
+import zipfile
+import hashlib
+
+def extract_packets(pcap_file):
+ """Reads a wireshark packet capture and extracts the binary packets"""
+ packets = []
+ with open(pcap_file, 'rb') as fp:
+ scanner = pcapng.FileScanner(fp)
+ for block in scanner:
+ if isinstance(block, pcapng.blocks.EnhancedPacket):
+ packets.append(block.packet_data)
+ return packets
+
+def build_corpus_zip(zip_file_output, packets):
+ """Builds a zip file with a file per packet
+
+ The structure of this zip corpus is a simple content addressable storage
+ i.e. seed_file_name == sha256_digest(packet).
+ """
+ with zipfile.ZipFile(zip_file_output, 'a') as out:
+ for packet in packets:
+ hash = hashlib.sha256(packet).hexdigest()
+ if hash not in out.namelist():
+ out.writestr(hash, packet)
+
+
+def main(pcap_file, output_zip_file):
+ packets = extract_packets(pcap_file)
+ build_corpus_zip(output_zip_file, packets)
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ prog = "pcapng_to_corpus.py",
+ description="""Converts a wireshark capture to a zip of binary packet
+ files suitable for an oss-fuzz corpus. In the case the
+ zip corpus already exists, this script will modify
+ the zip file in place adding seed entries.""")
+ parser.add_argument('pcapng_capture_file')
+ parser.add_argument('oss_fuzz_corpus_zip')
+ args = parser.parse_args()
+ main(args.pcapng_capture_file, args.oss_fuzz_corpus_zip)
diff --git a/tools/top.mk b/tools/top.mk
deleted file mode 100644
index 84523a557..000000000
--- a/tools/top.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-ifneq ($(lastword a b),b)
-$(error This Makefile require make 3.81 or newer)
-endif
-
-# Detect whether shell style is windows or not
-# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
-ifeq '$(findstring ;,$(PATH))' ';'
-CMDEXE := 1
-endif
-
-# Set TOP to be the path to get from the current directory (where make was
-# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
-# the name of this makefile relative to where make was invoked.
-
-THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
-TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
-
-ifeq ($(CMDEXE),1)
-TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi))
-else
-TOP := $(shell realpath $(TOP))
-endif
-#$(info Top directory is $(TOP))
-
-ifeq ($(CMDEXE),1)
-CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%)))
-else
-CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
-endif
-#$(info Path from top is $(CURRENT_PATH))
diff --git a/tools/uf2 b/tools/uf2
deleted file mode 160000
-Subproject 19615407727073e36d81bf239c52108ba92e766
diff --git a/tools/usb_drivers/tinyusb_win_usbser.inf b/tools/usb_drivers/tinyusb_win_usbser.inf
index e7f7a9b22..659f048ae 100644
--- a/tools/usb_drivers/tinyusb_win_usbser.inf
+++ b/tools/usb_drivers/tinyusb_win_usbser.inf
@@ -105,4 +105,4 @@ DRIVERFILENAME ="usbser"
MFGNAME="tinyusb.org"
INSTDISK="tinyusb CDC Driver"
DESCRIPTION="tinyusb Serial"
-SERVICE="USB RS-232 Emulation Driver" \ No newline at end of file
+SERVICE="USB RS-232 Emulation Driver"