Skip to content

Commit

Permalink
armv7a9: provide jtag reset for target
Browse files Browse the repository at this point in the history
Utilize new way of rebooting target using available debugger (Jtag/SMT2)

JIRA: CI-515
  • Loading branch information
maska989 committed Dec 10, 2024
1 parent 8f8b959 commit 9a52af6
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions trunner/target/armv7a9.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,53 @@
)
from trunner.harness import TerminalHarness
from trunner.host import Host
from trunner.tools import Phoenixd, OpenocdGdbServer, wait_for_vid_pid
from trunner.tools import Phoenixd, OpenocdGdbServer, OpenocdProcess, wait_for_vid_pid
from trunner.types import TestResult, TestOptions
from .base import TargetBase, find_port


class ARMv7A9TargetRebooter(Rebooter):
# TODO add text mode reboot

def __call__(self, flash=False, hard=False):
"""Sets flash mode and perform hard or soft & debugger reboot based on `hard` flag."""

self._set_flash_mode(flash)
if hard:
if self.host.has_gpio():
self._reboot_dut_gpio(hard=hard)
else:
self._reboot_dut_text(self)
else:
self._reboot_by_debugger()

def _reboot_by_debugger(self):
OpenocdProcess(
board="digilent_zedboard",
extra_args=[
"-c adapter srst pulse_width 250",
"-c adapter srst delay 250",
"-c adapter speed 10000",
"-c init; reset; continue",
],
).run()

def _reboot_soft(self):
self._reboot_hard()

def _reboot_hard(self):

self.host.set_power(False)
# optimal power off time to prevent sustaining chips, e.g. flash memory, related to #540 issue
time.sleep(0.75)
self.dut.clear_buffer()
self.host.set_power(True)
time.sleep(0.05)
# needed to make sure that smt2 debugger device has disappeared
time.sleep(0.5)
# after reboot we need to wait for start smt2 device
wait_for_vid_pid(vid=0x0403, pid=0x6014, device="smt2", timeout=5)
# after power off it is necessary to wait more time to free all resources
time.sleep(2)

def _set_flash_mode(self, flash):
self.host.set_flash_mode(not flash)
Expand All @@ -53,9 +82,6 @@ def __init__(self, dut: Dut, script: str, cwd: Optional[str] = None):
def __call__(self):
"""Loads plo image to RAM using gdb."""

# after reboot we need to wait for smt2 device
wait_for_vid_pid(vid=0x0403, pid=0x6014, device="smt2", timeout=5)

with self.gdbserver.run():
try:
subprocess.run(
Expand Down

0 comments on commit 9a52af6

Please sign in to comment.