Commit 221199e1 authored by Adam Dunkels's avatar Adam Dunkels Committed by Anas Nashif
Browse files

runners: jlink: add support for J-Link tunnels

This adds support for J-Link tunnels, which run on top of an IP network
and therefore uses the -IP option. J-Link tunnels are identified by a
tunnel: prefix instead of a bare IP address. This change checks for the
presence of such a prefix, and choses the -IP transport option if the
tunnel prefix is found.

This has been tested with J-Link Remote Server v7.98g and the SEGGER
tunnel option.

Signed-off-by: default avatarAdam Dunkels <adam@dunkels.com>
parent b4a35d9b
Loading
Loading
Loading
Loading
+5 −2
Changes for scripts/west_commands/runners/jlink.py: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ def is_ip(ip):
        return False
    return True

def is_tunnel(tunnel):
    return tunnel.startswith("tunnel:")

class ToggleAction(argparse.Action):

    def __call__(self, parser, args, ignored, option):
@@ -247,7 +250,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):

        server_cmd = ([self.gdbserver] +
                      ['-select',
                                           ('ip' if is_ip(self.dev_id) else 'usb') +
                                           ('ip' if (is_ip(self.dev_id) or is_tunnel(self.dev_id)) else 'usb') +
                                           (f'={self.dev_id}' if self.dev_id else ''),
                       '-port', str(self.gdb_port),
                       '-if', self.iface,
@@ -404,7 +407,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
                loader_details = "?" + self.loader

            cmd = ([self.commander] +
                   (['-IP', f'{self.dev_id}'] if is_ip(self.dev_id) else (['-USB', f'{self.dev_id}'] if self.dev_id else [])) +
                   (['-IP', f'{self.dev_id}'] if (is_ip(self.dev_id) or is_tunnel(self.dev_id)) else (['-USB', f'{self.dev_id}'] if self.dev_id else [])) +
                   (['-nogui', '1'] if self.supports_nogui else []) +
                   ['-if', self.iface,
                    '-speed', self.speed,