Skip to content

Commit

Permalink
Move J-Link serial number and build directory to config
Browse files Browse the repository at this point in the history
Add ZSWatch HW revision as variable
  • Loading branch information
Kampi committed Jul 24, 2024
1 parent d540a61 commit f24147f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/pytest/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[pytest]
log_cli = True
log_cli_level = INFO
env =
JLINK_SERIAL=760208506
ZSWATCH_REVISION=5
5 changes: 2 additions & 3 deletions app/pytest/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ psutil
# Artifacts package creation
bz

# used for CAN <=> host testing
python-can>=4.3.0

# RTT connection
pylink-square

pytest-env
16 changes: 9 additions & 7 deletions app/pytest/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import subprocess
import logging
import time
import pylink

SERIAL_NUMBER = "760208490"

log = logging.getLogger()


Expand All @@ -22,7 +21,7 @@ def reset():
"--family",
"nrf53",
"--snr",
SERIAL_NUMBER,
os.environ["JLINK_SERIAL"],
"--reset",
],
shell=False,
Expand All @@ -33,6 +32,9 @@ def reset():


def flash():
log.info("Using J-Link {}".format(os.environ["JLINK_SERIAL"]))
log.info("Using ZSWatch revision {}".format(os.environ["ZSWATCH_REVISION"]))

"""Flash firmware"""
log.info("Flashing CP_APPLICATION.")
subprocess.run(
Expand All @@ -41,9 +43,9 @@ def flash():
"--family",
"nrf53",
"--snr",
SERIAL_NUMBER,
os.environ["JLINK_SERIAL"],
"--program",
"./zswatch_nrf5340_cpuapp@3_debug.hex",
"./zswatch_nrf5340_cpuapp@{}_debug.hex".format(os.environ["ZSWATCH_REVISION"]),
"--chiperase",
"--verify",
],
Expand All @@ -60,7 +62,7 @@ def flash():
"--family",
"nrf53",
"--snr",
SERIAL_NUMBER,
os.environ["JLINK_SERIAL"],
"--program",
"./zswatch_nrf5340_CPUNET.hex",
"--coprocessor",
Expand All @@ -81,7 +83,7 @@ def read_rtt(target_device="nRF5340_XXAA", timeout_ms=10000):
jlink = pylink.JLink()
logging.getLogger("pylink.jlink").setLevel(logging.WARNING)
log.info("Connecting to JLink...")
jlink.open(serial_no=SERIAL_NUMBER)
jlink.open(serial_no=os.environ["JLINK_SERIAL"])
log.info("Connecting to %s..." % target_device)
jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
jlink.connect(target_device)
Expand Down

0 comments on commit f24147f

Please sign in to comment.