summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorZixun LI <[email protected]>2025-11-25 10:59:43 +0100
committerZixun LI <[email protected]>2025-11-25 10:59:43 +0100
commitdc083e4d9c87658498a3bd0b527d25bc88dd1ed6 (patch)
tree0523e934e5a1b1fe8331b28990ddf2e2f4478077 /tools
parente59b2c40fc9e655918629d73cc8c54b86b4a70c1 (diff)
parentfee2d2a034d65aa625bc1a8b32c3b7a51292a39f (diff)
Merge remote-tracking branch 'tinyusb/master' into n6_build
Signed-off-by: Zixun LI <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/file2carray.py46
-rwxr-xr-xtools/gen_doc.py2
-rwxr-xr-xtools/gen_presets.py36
-rwxr-xr-xtools/get_deps.py16
-rwxr-xr-xtools/iar_gen.py2
-rw-r--r--tools/iar_template.ipcf5
-rwxr-xr-xtools/make_release.py20
7 files changed, 116 insertions, 11 deletions
diff --git a/tools/file2carray.py b/tools/file2carray.py
new file mode 100644
index 000000000..7150364bf
--- /dev/null
+++ b/tools/file2carray.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+import argparse
+import random
+import os
+import sys
+import time
+import subprocess
+from pathlib import Path
+from multiprocessing import Pool
+from weakref import finalize
+
+
+def print_carray(f, payload):
+ while len(payload) > 0:
+ f.write('\n ')
+ f.write(', '.join('0x{:02x}'.format(x) for x in payload[0:16]))
+ f.write(',')
+ payload = payload[16:]
+ f.write('\n')
+
+
+def main():
+ parser = argparse.ArgumentParser(description='Convert binary files to C array format')
+ parser.add_argument('files', nargs='+', help='Binary files to convert')
+ args = parser.parse_args()
+
+ files = args.files
+ for fin_name in files:
+ if not os.path.isfile(fin_name):
+ print(f"File {fin_name} does not exist")
+ continue
+
+ with open(fin_name, 'rb') as fin:
+ contents = fin.read()
+ fout_name = fin_name + '.h'
+ with open(fout_name, 'w') as fout:
+ print(f"Converting {fin_name} to {fout_name}")
+ fout.write(f'enum {{ BINDATA_LEN = {len(contents)} }};\n')
+ fout.write(f'const size_t bindata_len = BINDATA_LEN;\n')
+ fout.write(f'const uint8_t bindata[] __attribute__((aligned(16))) = {{')
+ print_carray(fout, contents)
+ fout.write('};\n')
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/tools/gen_doc.py b/tools/gen_doc.py
index ab07bc116..3920531d5 100755
--- a/tools/gen_doc.py
+++ b/tools/gen_doc.py
@@ -23,7 +23,7 @@ def gen_deps_doc():
Dependencies
************
-MCU low-level peripheral driver and external libraries for building TinyUSB examples
+MCU low-level peripheral drivers and external libraries for building TinyUSB examples
{tabulate(df, headers="keys", tablefmt='rst')}
"""
diff --git a/tools/gen_presets.py b/tools/gen_presets.py
index 94b8d16b0..94a9361db 100755
--- a/tools/gen_presets.py
+++ b/tools/gen_presets.py
@@ -5,13 +5,20 @@ from pathlib import Path
def main():
board_list = []
+ board_list_esp = []
- # Find all board.cmake files
+ # Find all board.cmake files, exclude espressif
for root, dirs, files in os.walk("hw/bsp"):
for file in files:
- if file == "board.cmake":
+ if file == "board.cmake" and "espressif" not in root:
board_list.append(os.path.basename(root))
+ # Find all espressif boards
+ for root, dirs, files in os.walk("hw/bsp/espressif"):
+ for file in files:
+ if file == "board.cmake":
+ board_list_esp.append(os.path.basename(root))
+
print('Generating presets for the following boards:')
print(board_list)
@@ -29,8 +36,17 @@ def main():
"cacheVariables": {
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo",
"BOARD": r"${presetName}"
+ }},
+ {"name": "default single config",
+ "hidden": True,
+ "description": r"Configure preset for the ${presetName} board",
+ "generator": "Ninja",
+ "binaryDir": r"${sourceDir}/build/${presetName}",
+ "cacheVariables": {
+ "BOARD": r"${presetName}"
}}]
+ # Add non-espressif boards
presets['configurePresets'].extend(
sorted(
[
@@ -43,6 +59,22 @@ def main():
)
)
+ # Add espressif boards with single config generator
+ presets['configurePresets'].extend(
+ sorted(
+ [
+ {
+ 'name': board,
+ 'inherits': 'default single config'
+ }
+ for board in board_list_esp
+ ], key=lambda x: x['name']
+ )
+ )
+
+ # Combine all boards
+ board_list.extend(board_list_esp)
+
# Build presets
# no inheritance since 'name' doesn't support macro expansion
presets['buildPresets'] = sorted(
diff --git a/tools/get_deps.py b/tools/get_deps.py
index 0828140c1..35f3b3e92 100755
--- a/tools/get_deps.py
+++ b/tools/get_deps.py
@@ -47,11 +47,11 @@ deps_optional = {
'b93e856211060ae825216c6a1d6aa347ec758843',
'mm32'],
'hw/mcu/nordic/nrfx': ['https://github.com/NordicSemiconductor/nrfx.git',
- '7c47cc0a56ce44658e6da2458e86cd8783ccc4a2',
+ '11f57e578c7feea13f21c79ea0efab2630ac68c7',
'nrf'],
'hw/mcu/nuvoton': ['https://github.com/majbthrd/nuc_driver.git',
'2204191ec76283371419fbcec207da02e1bc22fa',
- 'nuc'],
+ 'nuc100_120 nuc121_125 nuc126 nuc505'],
'hw/mcu/nxp/lpcopen': ['https://github.com/hathach/nxp_lpcopen.git',
'b41cf930e65c734d8ec6de04f1d57d46787c76ae',
'lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43'],
@@ -124,6 +124,9 @@ deps_optional = {
'hw/mcu/st/cmsis_device_n6': ['https://github.com/STMicroelectronics/cmsis-device-n6.git',
'7bcdc944fbf7cf5928d3c1d14054ca13261d33ec',
'stm32n6'],
+ 'hw/mcu/st/cmsis-device-u0': ['https://github.com/STMicroelectronics/cmsis-device-u0.git',
+ 'e3a627c6a5bc4eb2388e1885a95cc155e1672253',
+ 'stm32u0'],
'hw/mcu/st/cmsis_device_u5': ['https://github.com/STMicroelectronics/cmsis_device_u5.git',
'6e67187dec98035893692ab2923914cb5f4e0117',
'stm32u5'],
@@ -190,6 +193,9 @@ deps_optional = {
'hw/mcu/st/stm32n6xx_hal_driver': ['https://github.com/STMicroelectronics/stm32n6xx-hal-driver.git',
'bc6c41f8f67d61b47af26695d0bf67762a000666',
'stm32n6'],
+ 'hw/mcu/st/stm32u0xx_hal_driver': ['https://github.com/STMicroelectronics/stm32u0xx-hal-driver.git',
+ 'cbfb5ac654256445237fd32b3587ac6a238d24f1',
+ 'stm32u0'],
'hw/mcu/st/stm32u5xx_hal_driver': ['https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git',
'2c5e2568fbdb1900a13ca3b2901fdd302cac3444',
'stm32u5'],
@@ -240,12 +246,12 @@ deps_optional = {
'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf saml2x '
'lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 '
'stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 '
- 'stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32n6 stm32u5 stm32wb stm32wba'
+ 'stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32u0 stm32u5 stm32wb stm32wba'
'sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x saml2x samg '
'tm4c '],
'lib/CMSIS_6': ['https://github.com/ARM-software/CMSIS_6.git',
- 'b0bbb0423b278ca632cfe1474eb227961d835fd2',
- 'ra'],
+ '6f0a58d01aa9bd2feba212097f9afe7acd991d52',
+ 'ra stm32n6'],
'lib/sct_neopixel': ['https://github.com/gsteiert/sct_neopixel.git',
'e73e04ca63495672d955f9268e003cffe168fcd8',
'lpc55'],
diff --git a/tools/iar_gen.py b/tools/iar_gen.py
index 8d45659db..571febb2c 100755
--- a/tools/iar_gen.py
+++ b/tools/iar_gen.py
@@ -74,7 +74,7 @@ def ListPath(path, blacklist=[]):
print('</group>')
def List():
- ListPath('src', [ 'template.c', 'dcd_synopsys.c', 'dcd_esp32sx.c' ])
+ ListPath('src', [ 'template.c' ])
ListPath('lib/SEGGER_RTT')
if __name__ == "__main__":
diff --git a/tools/iar_template.ipcf b/tools/iar_template.ipcf
index 33a6ef045..2581a4702 100644
--- a/tools/iar_template.ipcf
+++ b/tools/iar_template.ipcf
@@ -58,6 +58,11 @@
<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/mtp">
+ <path>$TUSB_DIR$/src/class/mtp/mtp_device.c</path>
+ <path>$TUSB_DIR$/src/class/mtp/mtp.h</path>
+ <path>$TUSB_DIR$/src/class/mtp/mtp_device.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>
diff --git a/tools/make_release.py b/tools/make_release.py
index c1caf3300..71c1e6f64 100755
--- a/tools/make_release.py
+++ b/tools/make_release.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
import re
import gen_doc
+import gen_presets
-version = '0.18.0'
+version = '0.20.0'
print('version {}'.format(version))
ver_id = version.split('.')
@@ -45,9 +46,24 @@ with open(f_library_json, 'w') as f:
f.write(fdata)
###################
-# docs/info/changelog.rst
+# sonar-project.properties
###################
+f_sonar_properties = 'sonar-project.properties'
+with open(f_sonar_properties) as f:
+ fdata = f.read()
+fdata = re.sub(r'(sonar\.projectVersion=)\d+\.\d+\.\d+', r'\g<1>{}'.format(version), fdata)
+
+with open(f_sonar_properties, 'w') as f:
+ f.write(fdata)
+# gen docs
gen_doc.gen_deps_doc()
+gen_doc.gen_boards_doc()
+# gen presets
+gen_presets.main()
+
+##################(ver#
+# docs/info/changelog.rst
+###################
print("Update docs/info/changelog.rst")