diff options
| author | HiFiPhile <[email protected]> | 2025-10-11 16:53:35 +0200 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2025-10-11 16:53:35 +0200 |
| commit | b9b1c6432a7be43297afb0a75621ece5fc63f3a5 (patch) | |
| tree | cd7639e4b3a5782fb78f20a3b96f24d69577508c /tools | |
| parent | e0a589cdcae6eaf790d05712a6f2b8c0352fb5fd (diff) | |
| parent | 2e29d1c60d119b2aa71e36d0c1ac2a383e333076 (diff) | |
Merge branch 'master' into dwc2_iso_incomp
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/file2carray.py | 46 | ||||
| -rwxr-xr-x | tools/gen_presets.py | 36 | ||||
| -rwxr-xr-x | tools/get_deps.py | 8 | ||||
| -rwxr-xr-x | tools/iar_gen.py | 2 | ||||
| -rw-r--r-- | tools/iar_template.ipcf | 5 | ||||
| -rwxr-xr-x | tools/make_release.py | 2 |
6 files changed, 94 insertions, 5 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_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..36ed98a62 100755 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -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,7 +246,7 @@ 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 stm32n6 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', 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..488ad4901 100755 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -2,7 +2,7 @@ import re import gen_doc -version = '0.18.0' +version = '0.19.0' print('version {}'.format(version)) ver_id = version.split('.') |
