Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream uf2conv.py changes #21107

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Merge upstream uf2conv.py changes
  • Loading branch information
zvecr committed Jun 1, 2023
commit fb6801072fe555fd87e64f73a2b2f7844df199c3
21 changes: 10 additions & 11 deletions util/uf2conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def convert_from_uf2(buf):
assert False, "Non-word padding size at " + ptr
while padding > 0:
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]):
outp.append(block[32 : 32 + datalen])
curraddr = newaddr + datalen
Expand Down Expand Up @@ -218,18 +218,17 @@ def get_drives():
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0])
else:
rootpath = "/media"
searchpaths = ["/media"]
if sys.platform == "darwin":
rootpath = "/Volumes"
searchpaths = ["/Volumes"]
elif sys.platform == "linux":
tmp = rootpath + "/" + os.environ["USER"]
if os.path.isdir(tmp):
rootpath = tmp
tmp = "/run" + rootpath + "/" + os.environ["USER"]
if os.path.isdir(tmp):
rootpath = tmp
for d in os.listdir(rootpath):
drives.append(os.path.join(rootpath, d))
searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]]

for rootpath in searchpaths:
if os.path.isdir(rootpath):
for d in os.listdir(rootpath):
if os.path.isdir(rootpath):
drives.append(os.path.join(rootpath, d))


def has_info(d):
Expand Down
12 changes: 11 additions & 1 deletion util/uf2families.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,15 @@
"id": "0x11de784a",
"short_name": "M0SENSE",
"description": "M0SENSE BL702"
},
{
"id": "0x4b684d71",
"short_name": "MaixPlay-U4",
"description": "Sipeed MaixPlay-U4(BL618)"
},
{
"id": "0x9517422f",
"short_name": "RZA1LU",
"description": "Renesas RZ/A1LU (R7S7210xx)"
}
]
]