summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-06-01 21:12:25 +0100
committerGitHub <noreply@github.com>2023-06-01 21:12:25 +0100
commit0a3ec7f59c0b809ae0a0a7a91c427c29c1c9b33c (patch)
tree57bc05a20db3ca44a06ace24dc6bc3c07db3eaf3 /util
parenta4ed6ad0f5ccbbf1b497dc03ba64820bdaaa8957 (diff)
Merge upstream uf2conv.py changes (#21107)
Diffstat (limited to 'util')
-rwxr-xr-xutil/uf2conv.py21
-rw-r--r--util/uf2families.json12
2 files changed, 21 insertions, 12 deletions
diff --git a/util/uf2conv.py b/util/uf2conv.py
index 578b2b4977..84271cee4f 100755
--- a/util/uf2conv.py
+++ b/util/uf2conv.py
@@ -74,7 +74,7 @@ def convert_from_uf2(buf):
74 assert False, "Non-word padding size at " + ptr 74 assert False, "Non-word padding size at " + ptr
75 while padding > 0: 75 while padding > 0:
76 padding -= 4 76 padding -= 4
77 outp += b"\x00\x00\x00\x00" 77 outp.append(b"\x00\x00\x00\x00")
78 if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]): 78 if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]):
79 outp.append(block[32 : 32 + datalen]) 79 outp.append(block[32 : 32 + datalen])
80 curraddr = newaddr + datalen 80 curraddr = newaddr + datalen
@@ -218,18 +218,17 @@ def get_drives():
218 if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": 218 if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
219 drives.append(words[0]) 219 drives.append(words[0])
220 else: 220 else:
221 rootpath = "/media" 221 searchpaths = ["/media"]
222 if sys.platform == "darwin": 222 if sys.platform == "darwin":
223 rootpath = "/Volumes" 223 searchpaths = ["/Volumes"]
224 elif sys.platform == "linux": 224 elif sys.platform == "linux":
225 tmp = rootpath + "/" + os.environ["USER"] 225 searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]]
226 if os.path.isdir(tmp): 226
227 rootpath = tmp 227 for rootpath in searchpaths:
228 tmp = "/run" + rootpath + "/" + os.environ["USER"] 228 if os.path.isdir(rootpath):
229 if os.path.isdir(tmp): 229 for d in os.listdir(rootpath):
230 rootpath = tmp 230 if os.path.isdir(rootpath):
231 for d in os.listdir(rootpath): 231 drives.append(os.path.join(rootpath, d))
232 drives.append(os.path.join(rootpath, d))
233 232
234 233
235 def has_info(d): 234 def has_info(d):
diff --git a/util/uf2families.json b/util/uf2families.json
index c2140fe351..778af4421f 100644
--- a/util/uf2families.json
+++ b/util/uf2families.json
@@ -203,5 +203,15 @@
203 "id": "0x11de784a", 203 "id": "0x11de784a",
204 "short_name": "M0SENSE", 204 "short_name": "M0SENSE",
205 "description": "M0SENSE BL702" 205 "description": "M0SENSE BL702"
206 },
207 {
208 "id": "0x4b684d71",
209 "short_name": "MaixPlay-U4",
210 "description": "Sipeed MaixPlay-U4(BL618)"
211 },
212 {
213 "id": "0x9517422f",
214 "short_name": "RZA1LU",
215 "description": "Renesas RZ/A1LU (R7S7210xx)"
206 } 216 }
207] \ No newline at end of file 217]