summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/uf2conv.py26
-rw-r--r--util/uf2families.json85
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):
142 return b"".join(outp) 142 return b"".join(outp)
143 143
144class Block: 144class Block:
145 def __init__(self, addr): 145 def __init__(self, addr, default_data=0xFF):
146 self.addr = addr 146 self.addr = addr
147 self.bytes = bytearray(256) 147 self.bytes = bytearray([default_data] * 256)
148 148
149 def encode(self, blockno, numblocks): 149 def encode(self, blockno, numblocks):
150 global familyid 150 global familyid
@@ -210,24 +210,26 @@ def to_str(b):
210def get_drives(): 210def get_drives():
211 drives = [] 211 drives = []
212 if sys.platform == "win32": 212 if sys.platform == "win32":
213 r = subprocess.check_output(["wmic", "PATH", "Win32_LogicalDisk", 213 r = subprocess.check_output([
214 "get", "DeviceID,", "VolumeName,", 214 "powershell",
215 "FileSystem,", "DriveType"]) 215 "-Command",
216 for line in to_str(r).split('\n'): 216 '(Get-WmiObject Win32_LogicalDisk -Filter "FileSystem=\'FAT\'").DeviceID'
217 words = re.split(r'\s+', line) 217 ])
218 if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": 218 drives = [drive.strip() for drive in to_str(r).splitlines()]
219 drives.append(words[0])
220 else: 219 else:
221 searchpaths = ["/media"] 220 searchpaths = ["/mnt", "/media"]
222 if sys.platform == "darwin": 221 if sys.platform == "darwin":
223 searchpaths = ["/Volumes"] 222 searchpaths = ["/Volumes"]
224 elif sys.platform == "linux": 223 elif sys.platform == "linux":
225 searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]] 224 searchpaths += ["/media/" + os.environ["USER"], "/run/media/" + os.environ["USER"]]
225 if "SUDO_USER" in os.environ.keys():
226 searchpaths += ["/media/" + os.environ["SUDO_USER"]]
227 searchpaths += ["/run/media/" + os.environ["SUDO_USER"]]
226 228
227 for rootpath in searchpaths: 229 for rootpath in searchpaths:
228 if os.path.isdir(rootpath): 230 if os.path.isdir(rootpath):
229 for d in os.listdir(rootpath): 231 for d in os.listdir(rootpath):
230 if os.path.isdir(rootpath): 232 if os.path.isdir(os.path.join(rootpath, d)):
231 drives.append(os.path.join(rootpath, d)) 233 drives.append(os.path.join(rootpath, d))
232 234
233 235
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 @@
35 "description": "ST STM32WLxx" 35 "description": "ST STM32WLxx"
36 }, 36 },
37 { 37 {
38 "id": "0x22e0d6fc",
39 "short_name": "RTL8710B",
40 "description": "Realtek AmebaZ RTL8710B"
41 },
42 {
38 "id": "0x2abc77ec", 43 "id": "0x2abc77ec",
39 "short_name": "LPC55", 44 "short_name": "LPC55",
40 "description": "NXP LPC55xx" 45 "description": "NXP LPC55xx"
@@ -50,6 +55,11 @@
50 "description": "GD32F350" 55 "description": "GD32F350"
51 }, 56 },
52 { 57 {
58 "id": "0x3379CFE2",
59 "short_name": "RTL8720D",
60 "description": "Realtek AmebaD RTL8720D"
61 },
62 {
53 "id": "0x04240bdf", 63 "id": "0x04240bdf",
54 "short_name": "STM32L5", 64 "short_name": "STM32L5",
55 "description": "ST STM32L5xx" 65 "description": "ST STM32L5xx"
@@ -65,6 +75,11 @@
65 "description": "NXP i.MX RT10XX" 75 "description": "NXP i.MX RT10XX"
66 }, 76 },
67 { 77 {
78 "id": "0x51e903a8",
79 "short_name": "XR809",
80 "description": "Xradiotech 809"
81 },
82 {
68 "id": "0x53b80f00", 83 "id": "0x53b80f00",
69 "short_name": "STM32F7", 84 "short_name": "STM32F7",
70 "description": "ST STM32F7xx" 85 "description": "ST STM32F7xx"
@@ -105,11 +120,21 @@
105 "description": "ST STM32F0xx" 120 "description": "ST STM32F0xx"
106 }, 121 },
107 { 122 {
123 "id": "0x675a40b0",
124 "short_name": "BK7231U",
125 "description": "Beken 7231U/7231T"
126 },
127 {
108 "id": "0x68ed2b88", 128 "id": "0x68ed2b88",
109 "short_name": "SAMD21", 129 "short_name": "SAMD21",
110 "description": "Microchip (Atmel) SAMD21" 130 "description": "Microchip (Atmel) SAMD21"
111 }, 131 },
112 { 132 {
133 "id": "0x6a82cc42",
134 "short_name": "BK7251",
135 "description": "Beken 7251/7252"
136 },
137 {
113 "id": "0x6b846188", 138 "id": "0x6b846188",
114 "short_name": "STM32F3", 139 "short_name": "STM32F3",
115 "description": "ST STM32F3xx" 140 "description": "ST STM32F3xx"
@@ -120,6 +145,11 @@
120 "description": "ST STM32F407" 145 "description": "ST STM32F407"
121 }, 146 },
122 { 147 {
148 "id": "0x4e8f1c5d",
149 "short_name": "STM32H5",
150 "description": "ST STM32H5xx"
151 },
152 {
123 "id": "0x6db66082", 153 "id": "0x6db66082",
124 "short_name": "STM32H7", 154 "short_name": "STM32H7",
125 "description": "ST STM32H7xx" 155 "description": "ST STM32H7xx"
@@ -130,6 +160,11 @@
130 "description": "ST STM32WBxx" 160 "description": "ST STM32WBxx"
131 }, 161 },
132 { 162 {
163 "id": "0x7b3ef230",
164 "short_name": "BK7231N",
165 "description": "Beken 7231N"
166 },
167 {
133 "id": "0x7eab61ed", 168 "id": "0x7eab61ed",
134 "short_name": "ESP8266", 169 "short_name": "ESP8266",
135 "description": "ESP8266" 170 "description": "ESP8266"
@@ -145,11 +180,21 @@
145 "description": "ST STM32F407VG" 180 "description": "ST STM32F407VG"
146 }, 181 },
147 { 182 {
183 "id": "0x9fffd543",
184 "short_name": "RTL8710A",
185 "description": "Realtek Ameba1 RTL8710A"
186 },
187 {
148 "id": "0xada52840", 188 "id": "0xada52840",
149 "short_name": "NRF52840", 189 "short_name": "NRF52840",
150 "description": "Nordic NRF52840" 190 "description": "Nordic NRF52840"
151 }, 191 },
152 { 192 {
193 "id": "0x820d9a5f",
194 "short_name": "NRF52820",
195 "description": "Nordic NRF52820_xxAA"
196 },
197 {
153 "id": "0xbfdd4eee", 198 "id": "0xbfdd4eee",
154 "short_name": "ESP32S2", 199 "short_name": "ESP32S2",
155 "description": "ESP32-S2" 200 "description": "ESP32-S2"
@@ -195,6 +240,26 @@
195 "description": "ESP32-C61" 240 "description": "ESP32-C61"
196 }, 241 },
197 { 242 {
243 "id": "0xb6dd00af",
244 "short_name": "ESP32H21",
245 "description": "ESP32-H21"
246 },
247 {
248 "id": "0x9e0baa8a",
249 "short_name": "ESP32H4",
250 "description": "ESP32-H4"
251 },
252 {
253 "id": "0xde1270b7",
254 "short_name": "BL602",
255 "description": "Boufallo 602"
256 },
257 {
258 "id": "0xe08f7564",
259 "short_name": "RTL8720C",
260 "description": "Realtek AmebaZ2 RTL8720C"
261 },
262 {
198 "id": "0xe48bff56", 263 "id": "0xe48bff56",
199 "short_name": "RP2040", 264 "short_name": "RP2040",
200 "description": "Raspberry Pi RP2040" 265 "description": "Raspberry Pi RP2040"
@@ -293,5 +358,25 @@
293 "id": "0x7be8976d", 358 "id": "0x7be8976d",
294 "short_name": "RA4M1", 359 "short_name": "RA4M1",
295 "description": "Renesas RA4M1" 360 "description": "Renesas RA4M1"
361 },
362 {
363 "id": "0x7410520a",
364 "short_name": "MAX32690",
365 "description": "Analog Devices MAX32690"
366 },
367 {
368 "id": "0xd63f8632",
369 "short_name": "MAX32650",
370 "description": "Analog Devices MAX32650/1/2"
371 },
372 {
373 "id": "0xf0c30d71",
374 "short_name": "MAX32666",
375 "description": "Analog Devices MAX32665/6"
376 },
377 {
378 "id": "0x91d3fd18",
379 "short_name": "MAX78002",
380 "description": "Analog Devices MAX78002"
296 } 381 }
297] 382]