-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb6cd83
commit fb52a57
Showing
8 changed files
with
156 additions
and
53 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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pytest | ||
pyserial | ||
termcolor | ||
pyusb | ||
imgtool |
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,62 @@ | ||
########################################################################################## | ||
# Copyright (c) 2024 Nordic Semiconductor | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
########################################################################################## | ||
|
||
import pytest | ||
import time | ||
import os | ||
from utils.flash_tools import flash_device, reset_device, recover_device, setup_jlink, dfu_device | ||
from utils.uart import Uart | ||
from tests.conftest import t91x_board | ||
import sys | ||
sys.path.append(os.getcwd()) | ||
from utils.logger import get_logger | ||
|
||
def wait_until_uart_available(name, timeout_seconds=60): | ||
base_path = "/dev/serial/by-id" | ||
while timeout_seconds > 0: | ||
try: | ||
serial_paths = [os.path.join(base_path, entry) for entry in os.listdir(base_path)] | ||
for path in sorted(serial_paths): | ||
if name in path: | ||
break | ||
except (FileNotFoundError, PermissionError) as e: | ||
logger.error(e) | ||
time.sleep(1) | ||
timeout_seconds -= 1 | ||
|
||
@pytest.fixture(scope="function") | ||
def t91x_dfu(): | ||
SEGGER_NRF53 = os.getenv('SEGGER_NRF53') | ||
SEGGER_NRF91 = os.getenv('SEGGER_NRF91') | ||
CONNECTIVITY_BRIDGE_UART = os.getenv('UART_ID') | ||
NRF53_HEX_FILE = os.getenv('NRF53_HEX_FILE') | ||
NRF91_HEX_FILE = os.getenv('NRF91_HEX_FILE') | ||
|
||
setup_jlink(SEGGER_NRF53) | ||
wait_until_uart_available(SEGGER_NRF91) | ||
flash_device(hexfile=NRF91_HEX_FILE, serial=SEGGER_NRF91) | ||
recover_device(serial=SEGGER_NRF53, core='Network') | ||
recover_device(serial=SEGGER_NRF53, core='Application') | ||
flash_device(hexfile=NRF53_HEX_FILE, serial=SEGGER_NRF53, extra_args=['--core', 'Network', '--options', 'reset=RESET_NONE,chip_erase_mode=ERASE_ALL,verify=VERIFY_NONE']) | ||
flash_device(hexfile=NRF53_HEX_FILE, serial=SEGGER_NRF53, extra_args=['--options', 'reset=RESET_SYSTEM,chip_erase_mode=ERASE_ALL,verify=VERIFY_NONE']) | ||
wait_until_uart_available(CONNECTIVITY_BRIDGE_UART) | ||
|
||
return t91x_board() | ||
|
||
@pytest.mark.dut2 | ||
def test_dfu(t91x_dfu): | ||
# NRF91_BL_UPDATE_ZIP = os.getenv('NRF91_BL_UPDATE_ZIP') | ||
NRF91_APP_UPDATE_ZIP = os.getenv('NRF91_APP_UPDATE_ZIP') | ||
|
||
t91x_dfu.uart.stop() | ||
|
||
# dfu_device(NRF91_BL_UPDATE_ZIP) | ||
dfu_device(NRF91_APP_UPDATE_ZIP) | ||
|
||
t91x_dfu.uart.start() | ||
|
||
expected_lines = ["Firmware version 1", "Zephyr OS"] | ||
t91x_dfu.uart.wait_for_str(expected_lines, timeout=60) | ||
logger.info("Expected lines found") |
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