From 0fb5ededcf63703334aee46ddb94f6e3b38d5166 Mon Sep 17 00:00:00 2001 From: Craig Hesling Date: Tue, 2 Jun 2020 09:01:33 -0700 Subject: util/flash_jlink.py: Allow USB mode This adds the option to specify "" for --ip, which will disable the TCP/IP mode. Thus, the JLink tool will default to USB direct. BRANCH=none BUG=none TEST=# Ensure JLinkRemoteServerCLExe is not running ./util/flash_jlink.py --ip '' # Ensure JLinkExe uses direct USB and succeeds TEST=# Ensure "JLinkRemoteServerCLExe -Port 2551 -select USB" is running ./util/flash_jlink.py # Ensure JLinkExe uses TCP/IP and succeeds Signed-off-by: Craig Hesling Change-Id: I9da2efa8adf155673f14f12dbb354492b0827332 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226880 Commit-Queue: Tom Hughes Reviewed-by: Tom Hughes --- util/flash_jlink.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/flash_jlink.py b/util/flash_jlink.py index 826f6eea60..3dd731bf7d 100755 --- a/util/flash_jlink.py +++ b/util/flash_jlink.py @@ -53,13 +53,18 @@ def create_jlink_command_file(firmware_file): def flash(jlink_exe, ip, device, interface, cmd_file): cmd = [ jlink_exe, - '-ip', ip, + ] + + if len(ip) > 0: + cmd.extend(['-ip', ip]) + + cmd.extend([ '-device', device, '-if', interface, '-speed', 'auto', '-autoconnect', '1', - '-CommandFile', cmd_file - ] + '-CommandFile', cmd_file, + ]) logging.debug('Running command: "%s"', ' '.join(cmd)) subprocess.run(cmd) -- cgit v1.2.1