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
  • Loading branch information
Kampi committed Jul 24, 2024
1 parent d540a61 commit 3228021
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 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_BUILD_DIR=debug_rev5
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
13 changes: 7 additions & 6 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,8 @@ def reset():


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

"""Flash firmware"""
log.info("Flashing CP_APPLICATION.")
subprocess.run(
Expand All @@ -41,7 +42,7 @@ def flash():
"--family",
"nrf53",
"--snr",
SERIAL_NUMBER,
os.environ["JLINK_SERIAL"],
"--program",
"./zswatch_nrf5340_cpuapp@3_debug.hex",
"--chiperase",
Expand All @@ -60,7 +61,7 @@ def flash():
"--family",
"nrf53",
"--snr",
SERIAL_NUMBER,
os.environ["JLINK_SERIAL"],
"--program",
"./zswatch_nrf5340_CPUNET.hex",
"--coprocessor",
Expand All @@ -81,7 +82,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 3228021

Please sign in to comment.