-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Parse EBL images * Get flashing working for HUSBZB-1 * Send a newline before `EBL info` * Delay for 4s before launching bootloader communication * Use correct data type when comparing regex match * Remove `setup.cfg` * Handle invalid firmware with a better error * Remove all Ember/Gecko bootloader logic * Increase EZSP bootloader launch delay to 5s * Use millisecond logging * Make 5s a constant
- Loading branch information
Showing
10 changed files
with
212 additions
and
53 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file added
BIN
+129 KB
tests/firmwares/NabuCasa_SkyConnect_RCP_v4.1.3_rcp-uart-hw-802154_115200.gbl
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,55 @@ | ||
import pathlib | ||
|
||
import pytest | ||
|
||
from universal_silabs_flasher import firmware | ||
from universal_silabs_flasher.common import Version | ||
|
||
FIRMWARES_DIR = pathlib.Path(__file__).parent / "firmwares" | ||
|
||
|
||
def test_firmware_ebl_valid(): | ||
data = (FIRMWARES_DIR / "ncp-uart-sw-6.4.1.ebl").read_bytes() | ||
fw = firmware.parse_firmware_image(data) | ||
|
||
assert isinstance(fw, firmware.EBLImage) | ||
assert fw.serialize() == data | ||
|
||
with pytest.raises(KeyError): | ||
fw.get_nabucasa_metadata() | ||
|
||
|
||
def test_firmware_gbl_valid_with_metadata(): | ||
data = ( | ||
FIRMWARES_DIR / "NabuCasa_SkyConnect_RCP_v4.1.3_rcp-uart-hw-802154_115200.gbl" | ||
).read_bytes() | ||
fw = firmware.parse_firmware_image(data) | ||
|
||
assert isinstance(fw, firmware.GBLImage) | ||
assert fw.serialize() == data | ||
assert fw.get_nabucasa_metadata() == firmware.NabuCasaMetadata( | ||
metadata_version=1, | ||
sdk_version=Version("4.1.3"), | ||
ezsp_version=None, | ||
fw_type=firmware.FirmwareImageType.RCP_UART_802154, | ||
ot_rcp_version=None, | ||
baudrate=None, | ||
original_json={ | ||
"metadata_version": 1, | ||
"sdk_version": "4.1.3", | ||
"fw_type": "rcp-uart-802154", | ||
}, | ||
) | ||
|
||
|
||
def test_firmware_gbl_valid_no_metadata(): | ||
data = ( | ||
FIRMWARES_DIR / "NabuCasa_EZSP_v6.10.3.0_PB32_ncp-uart-hw_115200.gbl" | ||
).read_bytes() | ||
fw = firmware.parse_firmware_image(data) | ||
|
||
assert isinstance(fw, firmware.GBLImage) | ||
assert fw.serialize() == data | ||
|
||
with pytest.raises(KeyError): | ||
fw.get_nabucasa_metadata() |
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
Oops, something went wrong.