diff options
| author | Joel Challis | 2025-11-17 03:24:23 +0100 |
|---|---|---|
| committer | GitHub | 2025-11-17 03:24:23 +0100 |
| commit | 8eebc613cf1ba9ae8213a20b3a500eefcd08ffd3 (patch) | |
| tree | 8b39d1b0f002add9f268500c1d226ad50dab5976 | |
| parent | a2adc920665ba9e4ad9100b5601464ce80a76134 (diff) | |
Merge upstream uf2conv changes (#25786)
| -rwxr-xr-x | util/uf2conv.py | 26 | ||||
| -rw-r--r-- | util/uf2families.json | 85 |
2 files changed, 99 insertions, 12 deletions
diff --git a/util/uf2conv.py b/util/uf2conv.py index 67cf92f169..a0507b00b9 100755 --- a/util/uf2conv.py +++ b/util/uf2conv.py @@ -142,9 +142,9 @@ def convert_to_uf2(file_content): return b"".join(outp) class Block: - def __init__(self, addr): + def __init__(self, addr, default_data=0xFF): self.addr = addr - self.bytes = bytearray(256) + self.bytes = bytearray([default_data] * 256) def encode(self, blockno, numblocks): global familyid @@ -210,24 +210,26 @@ def to_str(b): def get_drives(): drives = [] if sys.platform == "win32": - r = subprocess.check_output(["wmic", "PATH", "Win32_LogicalDisk", - "get", "DeviceID,", "VolumeName,", - "FileSystem,", "DriveType"]) - for line in to_str(r).split('\n'): - words = re.split(r'\s+', line) - if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": - drives.append(words[0]) + r = subprocess.check_output([ + "powershell", + "-Command", + '(Get-WmiObject Win32_LogicalDisk -Filter "FileSystem=\'FAT\'").DeviceID' + ]) + drives = [drive.strip() for drive in to_str(r).splitlines()] else: - searchpaths = ["/media"] + searchpaths = ["/mnt", "/media"] if sys.platform == "darwin": searchpaths = ["/Volumes"] elif sys.platform == "linux": - searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]] + searchpaths += ["/media/" + os.environ["USER"], "/run/media/" + os.environ["USER"]] + if "SUDO_USER" in os.environ.keys(): + searchpaths += ["/media/" + os.environ["SUDO_USER"]] + searchpaths += ["/run/media/" + os.environ["SUDO_USER"]] for rootpath in searchpaths: if os.path.isdir(rootpath): for d in os.listdir(rootpath): - if os.path.isdir(rootpath): + if os.path.isdir(os.path.join(rootpath, d)): drives.append(os.path.join(rootpath, d)) diff --git a/util/uf2families.json b/util/uf2families.json index e35bf8d428..cd21783fe3 100644 --- a/util/uf2families.json +++ b/util/uf2families.json @@ -35,6 +35,11 @@ "description": "ST STM32WLxx" }, { + "id": "0x22e0d6fc", + "short_name": "RTL8710B", + "description": "Realtek AmebaZ RTL8710B" + }, + { "id": "0x2abc77ec", "short_name": "LPC55", "description": "NXP LPC55xx" @@ -50,6 +55,11 @@ "description": "GD32F350" }, { + "id": "0x3379CFE2", + "short_name": "RTL8720D", + "description": "Realtek AmebaD RTL8720D" + }, + { "id": "0x04240bdf", "short_name": "STM32L5", "description": "ST STM32L5xx" @@ -65,6 +75,11 @@ "description": "NXP i.MX RT10XX" }, { + "id": "0x51e903a8", + "short_name": "XR809", + "description": "Xradiotech 809" + }, + { "id": "0x53b80f00", "short_name": "STM32F7", "description": "ST STM32F7xx" @@ -105,11 +120,21 @@ "description": "ST STM32F0xx" }, { + "id": "0x675a40b0", + "short_name": "BK7231U", + "description": "Beken 7231U/7231T" + }, + { "id": "0x68ed2b88", "short_name": "SAMD21", "description": "Microchip (Atmel) SAMD21" }, { + "id": "0x6a82cc42", + "short_name": "BK7251", + "description": "Beken 7251/7252" + }, + { "id": "0x6b846188", "short_name": "STM32F3", "description": "ST STM32F3xx" @@ -120,6 +145,11 @@ "description": "ST STM32F407" }, { + "id": "0x4e8f1c5d", + "short_name": "STM32H5", + "description": "ST STM32H5xx" + }, + { "id": "0x6db66082", "short_name": "STM32H7", "description": "ST STM32H7xx" @@ -130,6 +160,11 @@ "description": "ST STM32WBxx" }, { + "id": "0x7b3ef230", + "short_name": "BK7231N", + "description": "Beken 7231N" + }, + { "id": "0x7eab61ed", "short_name": "ESP8266", "description": "ESP8266" @@ -145,11 +180,21 @@ "description": "ST STM32F407VG" }, { + "id": "0x9fffd543", + "short_name": "RTL8710A", + "description": "Realtek Ameba1 RTL8710A" + }, + { "id": "0xada52840", "short_name": "NRF52840", "description": "Nordic NRF52840" }, { + "id": "0x820d9a5f", + "short_name": "NRF52820", + "description": "Nordic NRF52820_xxAA" + }, + { "id": "0xbfdd4eee", "short_name": "ESP32S2", "description": "ESP32-S2" @@ -195,6 +240,26 @@ "description": "ESP32-C61" }, { + "id": "0xb6dd00af", + "short_name": "ESP32H21", + "description": "ESP32-H21" + }, + { + "id": "0x9e0baa8a", + "short_name": "ESP32H4", + "description": "ESP32-H4" + }, + { + "id": "0xde1270b7", + "short_name": "BL602", + "description": "Boufallo 602" + }, + { + "id": "0xe08f7564", + "short_name": "RTL8720C", + "description": "Realtek AmebaZ2 RTL8720C" + }, + { "id": "0xe48bff56", "short_name": "RP2040", "description": "Raspberry Pi RP2040" @@ -293,5 +358,25 @@ "id": "0x7be8976d", "short_name": "RA4M1", "description": "Renesas RA4M1" + }, + { + "id": "0x7410520a", + "short_name": "MAX32690", + "description": "Analog Devices MAX32690" + }, + { + "id": "0xd63f8632", + "short_name": "MAX32650", + "description": "Analog Devices MAX32650/1/2" + }, + { + "id": "0xf0c30d71", + "short_name": "MAX32666", + "description": "Analog Devices MAX32665/6" + }, + { + "id": "0x91d3fd18", + "short_name": "MAX78002", + "description": "Analog Devices MAX78002" } ] |