-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add USB Flashing Format (UF2) support
Uses code originally from microsoft/uf2 on GitHub. microsoft/uf2#42
- Loading branch information
Showing
22 changed files
with
1,032 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[MESSAGES CONTROL] | ||
disable=too-few-public-methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
""" | ||
Test the 'commands.uf2conv' module. | ||
""" | ||
|
||
# third-party | ||
from vcorelib.paths.context import tempfile | ||
|
||
# internal | ||
from tests.resources import resource | ||
|
||
# module under test | ||
from yambs import PKG_NAME | ||
from yambs.entry import main as yambs_main | ||
|
||
|
||
def test_uf2conv_basic(): | ||
"""Test the 'uf2conv' command.""" | ||
|
||
base = [PKG_NAME, "uf2conv", "-c"] | ||
|
||
assert yambs_main(base) != 0 | ||
|
||
assert yambs_main(base + ["-l"]) == 0 | ||
|
||
with tempfile() as tmp: | ||
for kind in ["bin", "hex"]: | ||
output = ["-o", str(tmp)] | ||
args = output + [str(resource(f"test1.{kind}"))] | ||
assert yambs_main(base + args) == 0 | ||
assert yambs_main(base + ["--carray"] + args) == 0 | ||
assert yambs_main(base + ["--info"] + args) == 0 | ||
assert yambs_main(base + ["-f", "0x16573617"] + args) == 0 | ||
assert yambs_main(base + ["-f", "SAML21"] + args) == 0 | ||
assert yambs_main(base + ["-f", "bad"] + args) != 0 | ||
|
||
assert ( | ||
yambs_main( | ||
base + output + [str(resource("pi_pico_circuitpython.uf2"))] | ||
) | ||
== 0 | ||
) | ||
assert ( | ||
yambs_main( | ||
base | ||
+ output | ||
+ ["--carray", str(resource("pi_pico_circuitpython.uf2"))] | ||
) | ||
== 0 | ||
) | ||
assert ( | ||
yambs_main( | ||
base | ||
+ output | ||
+ ["--info", str(resource("pi_pico_circuitpython.uf2"))] | ||
) | ||
== 0 | ||
) | ||
assert ( | ||
yambs_main( | ||
base | ||
+ output | ||
+ ["--info", str(resource("pi_pico_circuitpython.uf2"))] | ||
) | ||
== 0 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
UF2 Bootloader v1.23.1-adafruit.1-88-g797305f SFHWRO | ||
Model: Grand Central M4 Express | ||
Board-ID: SAMD51P20A-GrandCentral-v0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
:020000040800F2 | ||
:100000000000012041000008F7010008F501000888 | ||
:10001000F5010008F5010008F501000800000000E6 | ||
:10002000000000000000000000000000F7010008D0 | ||
:10003000F701000800000000F7010008F7010008C0 | ||
:1000400008B54FF0E022D2F8883D43F47003C2F8BF | ||
:10005000883DBFF34F8FBFF36F8F0024E1EE104A4E | ||
:10006000094A0A490A4800F086F82146094A0A481E | ||
:1000700000F08FF8094800F0BFF800F093F821462F | ||
:10008000204600F01BF8FEE7000000001002000808 | ||
:1000900000000020080000000000002000000020F8 | ||
:1000A00080B483B000AF786039607A683B681344ED | ||
:1000B00018460C37BD465DF8047B704780B582B0AA | ||
:1000C00000AF02210120FFF7EBFF00F03BF800F04A | ||
:1000D00020F84FF000037B6000233B6010E0D7ED79 | ||
:1000E000017A77EEA77AC7ED017A97ED017AF0EE03 | ||
:1000F000006AC7EE267AC7ED017A3B6801333B60A0 | ||
:100100003B68B3F57A7FEADB002318460837BD4623 | ||
:1001100080BD80B483B000AF00237B6000233B60D0 | ||
:1001200005E07B689B007B603B6801333B603B687C | ||
:10013000B3F5FA6FF5DB00BF00BF0C37BD465DF8C5 | ||
:10014000047B704780B483B000AF00237B60002342 | ||
:100150003B6005E07B685B007B603B6801333B6094 | ||
:100160003B68B3F57A7FF5DB00BF00BF0C37BD46B7 | ||
:100170005DF8047B70470A44914200F1FF3300D1DF | ||
:10018000704710B511F8014B03F8014F9142F9D1B6 | ||
:1001900010BD02440346934200D1704703F8011B8F | ||
:1001A000F9E7000070B50E4D0E4C641BA41000263C | ||
:1001B000A6420BD10C4B0BB1AFF300800B4D0C4C96 | ||
:1001C000641BA4100026A64205D170BD55F8043B5F | ||
:1001D00098470136ECE755F8043B98470136F2E7BB | ||
:1001E00010020008100200080000000010020008C1 | ||
:1001F00010020008FEE77047024BC01A024B18605D | ||
:10020000704700BF08000000000000200000000050 | ||
:0400000508000041AE | ||
:00000001FF |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Test the 'uf2' module. | ||
""" | ||
|
||
# internal | ||
from tests.resources import resource | ||
|
||
# module under test | ||
from yambs.uf2 import board_id, to_str | ||
|
||
|
||
def test_board_id(): | ||
"""Test the 'board_id' method.""" | ||
|
||
assert board_id(str(resource("."))) is not None | ||
assert board_id(str(resource(".")), info_file="/test.txt") is None | ||
assert to_str(b"hello") == "hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.