Skip to content

Commit 0213dfb

Browse files
adamdunkelstomchy
authored andcommitted
[nrf fromtree] 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: Adam Dunkels <[email protected]> (cherry picked from commit 221199e) Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent eb3a53d commit 0213dfb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/west_commands/runners/jlink.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def is_ip(ip):
3636
return False
3737
return True
3838

39+
def is_tunnel(tunnel):
40+
return tunnel.startswith("tunnel:")
41+
3942
class ToggleAction(argparse.Action):
4043

4144
def __call__(self, parser, args, ignored, option):
@@ -247,7 +250,7 @@ def do_run(self, command, **kwargs):
247250

248251
server_cmd = ([self.gdbserver] +
249252
['-select',
250-
('ip' if is_ip(self.dev_id) else 'usb') +
253+
('ip' if (is_ip(self.dev_id) or is_tunnel(self.dev_id)) else 'usb') +
251254
(f'={self.dev_id}' if self.dev_id else ''),
252255
'-port', str(self.gdb_port),
253256
'-if', self.iface,
@@ -404,7 +407,7 @@ def flash(self, **kwargs):
404407
loader_details = "?" + self.loader
405408

406409
cmd = ([self.commander] +
407-
(['-IP', f'{self.dev_id}'] if is_ip(self.dev_id) else (['-USB', f'{self.dev_id}'] if self.dev_id else [])) +
410+
(['-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 [])) +
408411
(['-nogui', '1'] if self.supports_nogui else []) +
409412
['-if', self.iface,
410413
'-speed', self.speed,

0 commit comments

Comments
 (0)