Skip to content

Commit

Permalink
JLink-Target: Serial default to None
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusmue committed Feb 8, 2022
1 parent 8951a93 commit 06d4eb2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions avatar2/protocols/jlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class JLinkProtocol(Thread):
:ivar origin: the target utilizing this protocol
"""

def __init__(self, serial="12345678", device="ARM7", interface="swd", avatar=None, origin=None):
def __init__(self, serial=None, device="ARM7", interface="swd", avatar=None, origin=None):
self._shutdown = Event()
self.avatar = avatar
self._origin = origin
self.jlink = pylink.JLink()
self.jlink.open(serial)
self.jlink.open(serial_no=serial)
if interface == "swd": # swd is more generic than jtag
self.jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
self.log = logging.getLogger('%s.%s' %
Expand Down
4 changes: 2 additions & 2 deletions avatar2/targets/jlink_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class JLinkTarget(Target):
def __init__(self, avatar, serial, interface, device, **kwargs):
def __init__(self, avatar, serial=None, device="ARM7", interface="swd", **kwargs):
"""
Create a JLink target instance
:param avatar: The avatar instance
Expand Down Expand Up @@ -39,4 +39,4 @@ def reset(self, halt=True):
if halt:
self.state = TargetStates.STOPPED
else:
self.state = TargetStates.RUNNING
self.state = TargetStates.RUNNING
2 changes: 1 addition & 1 deletion handbook/0x02_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Easy to use. For example, with Segger JLink hardware devices, developers do not

| name | type | default | purpose |
|---------------------|-------|---------|-------------------------------------------------------------------------------------------------|
| serial | str |"123456" | JLink emulator serial number. JLink Onboard provides default number "123456" |
| serial | str | None | JLink emulator serial number. Default None, which leaves JLink the choice where to connect to. |
| device | str | "ARM7" | Device name which should be avaliable for used JLink emulator |
| interface | str | "swd" | "swd" or "jtag" interface |

Expand Down

0 comments on commit 06d4eb2

Please sign in to comment.