J-Link Commander

From SEGGER - Support Wiki
Jump to: navigation, search

J-Link Commander (JLink.exe) is a free command line based utility that can be used for verifying proper functionality of J-Link as well as for simple analysis of the target system with J-Link. It supports some simple commands, such as memory dump, halt, step, go etc. to verify the target connection. The J-Link Commander is part of the J-Link software and documentation package, which is available for download on the SEGGER webpage.

Perform flash download

J-Link Commander allows to download data files of different types into the flash memory of the target systems.

  • Connect J-Link to the PC
  • Connect target system to J-Link
  • Start J-Link Commander
  • Enter the requested settings (e.g. target device, interface settings, etc...)
  • Type the following commands:
    • r
    • loadfile <PathToFile> [<DestAddr>]
  • J-Link Commander executes the flash download and prints out the time statistics on success.

JLinkCommander FlashDownload.png

Batch processing

Basically, some target configuration settings needs to be specified in J-Link Commander before a target connection can be established. However, the J-Link Commander comes with multiple command line options as well as a so called J-Link Commander Command Script mode, which allows using J-Link Commander in batch processing mode, so that it can be used fully automatic.

The table below describes the different command line arguments, which can be used to run the commander, without the need to input any configuration / commands:

Command line option Explanation
-device <DeviceName> Selects the target device.
-if <TargetInterface> Configures the target interface.
-speed <InterfaceSpeed> Configures the target interface speed.
-jtagconf <IRPre,DRPre> Configures the JTAG scan configuration of the target device.
IRPre==-1 and DRPre==-1 can be passed to use auto-detection (First known device will be used).
-autoconnect <Value> Value==1: Forces the J-Link Commander to connect to the target, automatically.
-CommanderScript <ScriptPath> Selects a J-Link Commander Command file which contains the commands for the batch mode.


JLink.exe -device CC2538SF53 -if JTAG -speed 4000 -jtagconf -1,-1 -autoconnect 1 -CommanderScript C:\Work\JLinkCommandFile.jlink

JLink.exe return value

The return value of the J-Link Commander application (JLink.exe) can be read out int the environment variable ERRORLEVEL.


1. Returns an Error (ERRORLEVEL == 1)

start /wait "J-Link Commander" "JLink.exe" -if InvalidInterfaceParameter
ECHO error level is %ERRORLEVEL%

2. Returns no Error (ERRORLEVEL == 0)

start /wait "J-Link Commander" "JLink.exe" 
ECHO error level is %ERRORLEVEL%

For information how to access the environment variable ERRORLEVEL within a java application please refer to: http://stackoverflow.com/questions/8922485/how-to-execute-echo-errorlevel-in-java

For further information regarding this, please refer to: http://blogs.msdn.com/b/oldnewthing/archive/2008/09/26/8965755.aspx