From d00fb2bb219ca9b30b87ac62c4a6d72cd0ba0020 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 3 Jan 2019 12:50:04 +0100 Subject: [PATCH] runners: jlink: Default to correct JLink executable On Microsoft Windows, the default name of the JLink executable is "JLink.exe", while on *NIX it is instead "JLinkExe". Detect and correctly set the default name based on the platform. Signed-off-by: Carles Cufi --- src/west/runners/jlink.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/west/runners/jlink.py b/src/west/runners/jlink.py index 589986c..b0ffc19 100644 --- a/src/west/runners/jlink.py +++ b/src/west/runners/jlink.py @@ -6,10 +6,12 @@ import os import tempfile +import sys from west import log from west.runners.core import ZephyrBinaryRunner, RunnerCaps, BuildConfiguration +DEFAULT_JLINK_EXE = 'JLink.exe' if sys.platform == 'win32' else 'JLinkExe' DEFAULT_JLINK_GDB_PORT = 2331 @@ -17,7 +19,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for the J-Link GDB server.''' def __init__(self, cfg, device, - commander='JLinkExe', + commander=DEFAULT_JLINK_EXE, flash_addr=0x0, erase=True, iface='swd', speed='auto', gdbserver='JLinkGDBServer', gdb_port=DEFAULT_JLINK_GDB_PORT, @@ -62,7 +64,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner): parser.add_argument('--gdb-port', default=DEFAULT_JLINK_GDB_PORT, help='pyocd gdb port, defaults to {}'.format( DEFAULT_JLINK_GDB_PORT)) - parser.add_argument('--commander', default='JLinkExe', + parser.add_argument('--commander', default=DEFAULT_JLINK_EXE, help='J-Link Commander, default is JLinkExe') parser.add_argument('--erase', default=False, action='store_true', help='if given, mass erase flash before loading')