Merge upstream uf2conv.py changes (#21107)

This commit is contained in:
Joel Challis 2023-06-01 21:12:25 +01:00 committed by GitHub
parent a4ed6ad0f5
commit 0a3ec7f59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 12 deletions

View File

@ -74,7 +74,7 @@ def convert_from_uf2(buf):
assert False, "Non-word padding size at " + ptr assert False, "Non-word padding size at " + ptr
while padding > 0: while padding > 0:
padding -= 4 padding -= 4
outp += b"\x00\x00\x00\x00" outp.append(b"\x00\x00\x00\x00")
if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]): if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]):
outp.append(block[32 : 32 + datalen]) outp.append(block[32 : 32 + datalen])
curraddr = newaddr + datalen curraddr = newaddr + datalen
@ -218,17 +218,16 @@ def get_drives():
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0]) drives.append(words[0])
else: else:
rootpath = "/media" searchpaths = ["/media"]
if sys.platform == "darwin": if sys.platform == "darwin":
rootpath = "/Volumes" searchpaths = ["/Volumes"]
elif sys.platform == "linux": elif sys.platform == "linux":
tmp = rootpath + "/" + os.environ["USER"] searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]]
if os.path.isdir(tmp):
rootpath = tmp for rootpath in searchpaths:
tmp = "/run" + rootpath + "/" + os.environ["USER"] if os.path.isdir(rootpath):
if os.path.isdir(tmp):
rootpath = tmp
for d in os.listdir(rootpath): for d in os.listdir(rootpath):
if os.path.isdir(rootpath):
drives.append(os.path.join(rootpath, d)) drives.append(os.path.join(rootpath, d))

View File

@ -203,5 +203,15 @@
"id": "0x11de784a", "id": "0x11de784a",
"short_name": "M0SENSE", "short_name": "M0SENSE",
"description": "M0SENSE BL702" "description": "M0SENSE BL702"
},
{
"id": "0x4b684d71",
"short_name": "MaixPlay-U4",
"description": "Sipeed MaixPlay-U4(BL618)"
},
{
"id": "0x9517422f",
"short_name": "RZA1LU",
"description": "Renesas RZ/A1LU (R7S7210xx)"
} }
] ]