Difference between revisions of "J-Link Commander"

From SEGGER Wiki
Jump to: navigation, search
(Batch processing)
Line 23: Line 23:
 
! Command line option !! Description
 
! Command line option !! Description
 
|-
 
|-
| -device <DeviceName> || Select the target device
+
| -device <DeviceName> || Selects the target device
 
|-
 
|-
| -if <TargetInterface> || Configure the target interface
+
| -if <TargetInterface> || Configures the target interface
 
|-
 
|-
| -speed <InterfaceSpeed> || Configure the target interface speed
+
| -speed <InterfaceSpeed> || Configures the target interface speed
 
|-
 
|-
 
| -jtagconf <IRPre,DRPre> || Configures the JTAG scan configuration of the target device.<br />IRPre==-1 and DRPre==-1 can be passed to use auto-detection (First known device will be used)
 
| -jtagconf <IRPre,DRPre> || Configures the JTAG scan configuration of the target device.<br />IRPre==-1 and DRPre==-1 can be passed to use auto-detection (First known device will be used)
Line 33: Line 33:
 
| -autoconnect <Value> || Value==1: Forces the J-Link Commander to connect to the target, automatically
 
| -autoconnect <Value> || Value==1: Forces the J-Link Commander to connect to the target, automatically
 
|-
 
|-
| -CommanderScript <ScriptPath> || Select a J-Link Commander Command file which contains the commands for the batch mode.
+
| -CommanderScript <ScriptPath> || Selects a J-Link Commander Command file which contains the commands for the batch mode.
 
|}
 
|}
   

Revision as of 16:44, 7 March 2016

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

In general, some target configuration settings needs to be specified in J-Link Commander before establishing a connection to the target device. 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 Description
-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.

Example:

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.

Examples:

1. Returns an Error (ERRORLEVEL == 1)

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

2. Returns no Error (ERRORLEVEL == 0)

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

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