Difference between revisions of "J-Link Commander"

From SEGGER Wiki
Jump to: navigation, search
(Syntax)
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
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 Pack]], which is available for download on the [https://www.segger.com/jlink-software.html SEGGER webpage].
+
J-Link Commander (JLink.exe / JLinkExe) 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 Pack]], which is available for download on the [https://www.segger.com/jlink-software.html SEGGER webpage].
   
  +
The sources of the J-Link Commander are available as part of the [https://www.segger.com/products/debug-probes/j-link/technology/j-link-sdk/ J-Link SDK].
<div class="toclimit-3">
 
  +
  +
<div class="toclimit-2">
 
__TOC__
 
__TOC__
 
</div>
 
</div>
 
   
 
== Commands ==
 
== Commands ==
The table below lists the available commands of J-Link Commander. All commands are listed in alphabetical order within their respective categories.
+
The table below lists the available commands of J-Link Commander.
Detailed descriptions of the commands can be found in the sections that follow.
+
Detailed descriptions of the commands can be found in the sections below.
  +
All commands are accepted case insensitive.
   
  +
{{Note|This list is only valid for the latest version of the J-Link Commander.
  +
In case of doubt, use the [[#?|?]] command.
  +
}}
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Command (short form) !! Explanation
+
! Command (long) !! Command (short) !! Explanation
 
|-
 
|-
! colspan="2" | Basic
+
! colspan="3" | Basic
 
|-
 
|-
| [[#clrBP | clrBP]] || Clear breakpoint.
+
| [[#? | ?]] || ? || Show information about all or specific commands
|-
 
| [[#clrWP | clrWP]] || Clear watchpoint.
 
 
|-
 
|-
| [[#device | device]] || Selects a device.
+
| [[#Exit | Exit]] || Exit || Close J-Link connection and quit
|-
 
| [[#erase | erase]] || Erase internal flash of selected device.
 
|-
 
| [[#exec | exec]] || Execute J-Link Command String.
 
|-
 
| [[#exit | exit]] (qc, q) || Closes J-Link Commander.
 
 
|-
 
|-
| [[#exitonerror | exitonerror]] (eoe) || Commander exits after error.
+
| [[#ExitOnError | ExitOnError]] || EoE || Exit on error
 
|-
 
|-
| [[#f | f]] || Prints firmware info.
+
| [[#Sleep | Sleep]] || Sleep || Waits the given time (in milliseconds)
|-
 
| [[#go | go]] (g) || Starts the CPU core.
 
|-
 
| [[#halt | halt]] (h) || Halts the CPU core.
 
|-
 
| [[#hwinfo | hwinfo]] || Show hardware info.
 
|-
 
| [[#is | is]] || Scan chain select register length.
 
|-
 
| [[#loadfile | loadfile]] || Load data file into target memory.
 
|-
 
| [[#log | log]] || Enables log to file.
 
|-
 
| [[#mem | mem]] || Read memory.
 
|-
 
| [[#mem8 | mem8]] || Read 8-bit items.
 
|-
 
| [[#mem16 | mem16]] || Read 16-bit items.
 
|-
 
| [[#mem32 | mem32]] || Read 32-bit items.
 
|-
 
| [[#mem64 | mem64]] || Read 64-bit items.
 
|-
 
| [[#mr | mr]] || Measures reaction time of RTCK pin.
 
|-
 
| [[#ms | ms]] || Measures length of scan chain.
 
|-
 
| [[#power | power]] || Switch power supply for target.
 
|-
 
| [[#r | r]] || Resets and halts the target.
 
|-
 
| [[#readAP | readAP]] || Reads from a CoreSight AP register.
 
|-
 
| [[#readcsr | readcsr]] || Reads CSR register on a RISC-V based target.
 
|-
 
| [[#readDP | readDP]] || Reads from a CoreSight DP register.
 
|-
 
| [[#regs | regs]] || Shows all current register values.
 
|-
 
| [[#rnh | rnh]] || Resets without halting the target.
 
|-
 
| [[#rreg | rreg]] || Shows a specific register value.
 
|-
 
| [[#rx | rx]] || Reset target with delay.
 
|-
 
| [[#savebin | savebin]] || Saves target memory into binary file.
 
|-
 
| [[#setBP | setBP]] || Set breakpoint.
 
|-
 
| [[#setPC | setPC]] || Set the PC to specified value.
 
|-
 
| [[#SetTimeoutCmd | SetTimeoutCmd]] || Set timeout for the stepover command.
 
|-
 
| [[#setWP | setWP]] || Set watchpoint.
 
|-
 
| [[#sleep | sleep]] || Waits the given time (in milliseconds).
 
|-
 
| [[#speed | speed]] || Set target interface speed.
 
|-
 
| [[#st | st]] || Shows the current hardware status.
 
|-
 
| [[#step | step]] (s) || Single step the target chip.
 
|-
 
| [[#stepover | stepover]] (so) || Execute a stepover.
 
|-
 
| [[#unlock | unlock]] || Unlocks a device.
 
|-
 
| [[#verifybin | verifybin]] || Compares memory with data file.
 
|-
 
| [[#w1 | w1]] || Write 8-bit items.
 
|-
 
| [[#w2 | w2]] || Write 16-bit items.
 
|-
 
| [[#w4 | w4]] || Write 32-bit items.
 
|-
 
| [[#writeAP | writeAP]] || Writes to a CoreSight AP register.
 
|-
 
| [[#writecsr | writecsr]] || Writes CSR register on a RISC-V based target.
 
|-
 
| [[#writeDP | writeDP]] || Writes to a CoreSight DP register.
 
|-
 
| [[#wreg | wreg]] || Write register.
 
 
|-
 
|-
  +
| [[#Log | Log]] || Log || Enables log to file
! colspan="2" | Flasher I/O
 
 
|-
 
|-
  +
| [[#ExpDevList | ExpDevList]] || ExpDevList || Export device names from DLL internal device list to text file
| [[#fdelete | fdelete]] (fdel) || Delete file on emulator.
 
 
|-
 
|-
  +
| [[#ExpDevListXML | ExpDevListXML]] || ExpDevListXML || Export device names from DLL internal device list to XML file
| [[#flist | flist]] || List directory on emulator.
 
 
|-
 
|-
  +
! colspan="3" | Configuration - J-Link
| [[#fread | fread]] (frd) || Read file from emulator.
 
 
|-
 
|-
| [[#fshow | fshow]] || Read and display file from emulator.
+
| [[#USB | USB]] || USB || Connect to J-Link via USB
 
|-
 
|-
  +
| [[#IP | IP]] || IP || Connect to J-Link via TCP/IP or to Remote Server
| [[#fsize | fsize]] (fsz) || Display size of file on emulator.
 
 
|-
 
|-
  +
| [[#SelectProbe | SelectProbe]] || SelPrb || Show list of all connected probes via specified interface. The Probe to communicate with can then be selected
| [[#fwrite | fwrite]] (fwr) || Write file to emulator.
 
 
|-
 
|-
  +
| [[#ShowEmuList | ShowEmuList]] || ShowEmuList || Show list of all connected probes via specified interface
! colspan="2" | Connection
 
 
|-
 
|-
  +
| [[#Power | Power]] || Power || Switch power supply for target (5V-Supply pin) on or off
| [[#ip | ip]] || Connect to J-Link Pro via TCP/IP.
 
 
|-
 
|-
| [[#usb | usb]] || Connect to J-Link via USB.
+
| [[#VTREF | VTREF]] || VTREF || Set fixed value for VTref on J-Link
 
|-
 
|-
  +
| [[#VCOM | VCOM]] || VCOM || Enable/disable VCOM Takes effect after power cycle of the Probe
! colspan="2" | Connection
 
 
|-
 
|-
| [[#VTREF | VTREF]] || Sets a fixed value for VTref on J-Link.
+
| [[#ShowFWInfo | ShowFWInfo]] || F || Show firmware info
 
|-
 
|-
  +
| [[#ShowHWStatus | ShowHWStatus]] || St || Show hardware status
| [[#WebUSBDisable | WebUSBDisable]] || Disables WebUSB on J-Link.
 
 
|-
 
|-
  +
| [[#License | License]] || License || Show list of all available license commands
| [[#WebUSBEnable | WebUSBEnable]] || Enables WebUSB on J-Link.
 
 
|-
 
|-
  +
| [[#IPAddr | IPAddr]] || IPAddr || Show/Assign IP address and subnetmask of/to connected Probe
|}
 
 
=== Detailed description ===
 
Following is a detailed description with syntax explaination and examples of the commands listed above.
 
 
==== clrBP ====
 
This command removes a breakpoint set by J-Link.
 
 
'''Syntax'''<br>
 
clrBP <BP_Handle>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#GWAddr | GWAddr]] || GWAddr || Show/Assign network gateway address of/to connected Probe
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#DNSAddr | DNSAddr]] || DNSAddr || Show/Assign network DNS server address of/to connected Probe
| ''BP_Handle'' || Handle of breakpoint to be removed.
 
|}
 
 
'''Example'''<br>
 
clrBP 1
 
 
==== clrWP ====
 
This command removes a watchpoint set by J-Link.
 
 
'''Syntax'''<br>
 
clrWP <WP_Handle>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#ShowConf | ShowConf]] || Conf || Show configuration of the connected Probe
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#Calibrate | Calibrate]] || Calib || Calibrate the target current measurement
| ''WP_Handle'' || Handle of watchpoint to be removed.
 
|}
 
 
'''Example'''<br>
 
clrWP 0x2
 
 
==== device ====
 
Selects a specific device J-Link shall connect to and performs a reconnect.
 
In most cases explicit selection of the device is not necessary.
 
Selecting a device enables the user to make use of the J-Link flash programming functionality as well as using unlimited breakpoints in flash memory.
 
For some devices explicit device selection is mandatory in order to allow the DLL to perform special handling needed by the device.
 
Some commands require that a device is set prior to use them.
 
 
'''Syntax'''<br>
 
device <DeviceName>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
! colspan="3" | Configuration - Target (CPU)
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#Connect | Connect]] || Con || Connect to target device
| ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows a device selection dialog.
 
|}
 
 
'''Example'''<br>
 
device stm32f407ig
 
 
==== erase ====
 
Erases all flash sectors of the current device. A device has to be specified previously.
 
 
'''Syntax'''<br>
 
erase
 
 
==== exec ====
 
Execute J-Link Command String. For more information about the usage of J-Link Command Strings please refer to J-Link Command Strings.
 
 
'''Syntax'''<br>
 
exec <Command>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#Device | Device]] || Device || Select specific device J-Link shall connect to
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#SelectInterface | SelectInterface]] || SI || Select target interface
| ''Command'' || J-Link Command String to be executed.
 
|}
 
 
'''Example'''<br>
 
exec SupplyPower = 1
 
 
==== exit ====
 
This command closes the target connection, the connection to the J-Link and exits J-Link Commander.
 
 
'''Syntax'''<br>
 
q
 
 
==== exitonerror ====
 
This command toggles whether J-Link Commander exits on error or not.
 
 
'''Syntax'''<br>
 
ExitOnError <1|0>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#Speed | Speed]] || Speed || Set target interface speed
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#LE | LE]] || LE || Change mode to little endian
| ''1/0'' || 1: J-Link Commander will now exit on Error. <br> 0: J-Link Commander will no longer exit on Error.
 
|}
 
 
'''Example'''<br>
 
eoe 1
 
 
==== f ====
 
Prints firmware and hardware version info. Please notice that minor hardware revisions may not be displayed, as they do not have any effect on the feature set.
 
 
'''Syntax'''<br>
 
f
 
 
==== fdelete ====
 
On emulators which support file I/O this command deletes a specific file.
 
 
'''Syntax'''<br>
 
fdelete <FileName>
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#BE | BE]] || BE || Change mode to big endian
! Parameter !! Meaning
 
 
|-
 
|-
  +
! colspan="3" | Debugging
| ''FileName'' || File to delete from the Flasher.
 
|}
 
 
'''Example'''<br>
 
fdelete Flasher.dat
 
 
==== flist ====
 
On emulators which support file I/O this command shows the directory tree of the Flasher.
 
 
'''Syntax'''<br>
 
flist
 
 
==== fread ====
 
On emulators which support file I/O this command reads a specific file.
 
Offset applies to both destination and source file.
 
 
'''Syntax'''<br>
 
fread <EmuFile> <HostFile> [<Offset> [<NumBytes>]]
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#Halt | Halt]] || H || Halt CPU
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#IsHalted | IsHalted]] || IH || Return current CPU state
| ''EmuFile'' || File name to read from.
 
 
|-
 
|-
  +
| [[#WaitHalt | WaitHalt]] || WH || Wait until CPU is halted or timeout is reached
| ''HostFile'' || Destination file on the host.
 
 
|-
 
|-
  +
| [[#Go | Go]] || G || Start CPU if halted
| ''Offset'' || Specifies the offset in the file, at which data reading is started.
 
 
|-
 
|-
  +
| [[#Reset | Reset]] || R || Reset CPU
| ''NumBytes'' || Maximum number of bytes to read.
 
|}
 
 
'''Example'''<br>
 
fread Flasher.dat C:\Project\Flasher.dat
 
 
==== fshow ====
 
On emulators which support file I/O this command reads and prints a specific file.
 
Currently, only Flasher models support file I/O.
 
 
'''Syntax'''<br>
 
fshow <FileName> [-a] [<Offset> [<NumBytes>]]
 
 
{| class="wikitable"
 
 
|-
 
|-
  +
| [[#ResetX | ResetX]] || RX || Reset CPU with delay after reset
! Parameter !! Meaning
 
 
|-
 
|-
  +
| [[#RSetType | RSetType]] || Rst || Set the current reset type
| ''FileName'' || Source file name to read from the Flasher.
 
  +
|-
  +
| [[#Step | Step]] || S || Execute step(s) on the CPU
  +
|-
  +
| [[#IS | IS]] || IS || Identify length of scan chain select register
  +
|-
  +
| [[#MS | MS]] || MS || Measure length of scan chain
  +
|-
  +
| [[#Regs | Regs]] || Regs || Display CPU register contents
  +
|-
  +
| [[#RReg | RReg]] || RReg || Read register
  +
|-
  +
| [[#WReg | WReg]] || WReg || Write register
 
|-
 
|-
  +
| [[#MoE | MoE]] || MoE || Shows mode-of-entry (CPU halt reason)
| ''a'' || If set, Input will be parsed as text instead of being shown as hex.
 
 
|-
 
|-
  +
| [[#SetBP | SetBP]] || SetBP || Set breakpoint
| ''Offset'' || Specifies the offset in the file, at which data reading is started.
 
  +
|-
  +
| [[#ClearBP | ClearBP]] || ClrBP || Clear breakpoint
  +
|-
  +
| [[#SetWP | SetWP]] || SetWP || Set watchpoint
  +
|-
  +
| [[#ClearWP | ClearWP]] || ClrWP || Clear watchpoint
  +
|-
  +
| [[#VCatch | VCatch]] || VC || Write vector catch
  +
|-
  +
| [[#SetPC | SetPC]] || SetPC || Set the PC to specified value
  +
|-
  +
| [[#ReadAP | ReadAP]] || ReadAP || Read CoreSight AP register
  +
|-
  +
| [[#WriteAP | WriteAP]] || WriteAP || Write CoreSight AP register
  +
|-
  +
| [[#ReadDP | ReadDP]] || ReadDP || Read CoreSight DP register
  +
|-
  +
| [[#WriteDP | WriteDP]] || WriteDP || Write CoreSight DP register
  +
|-
  +
| [[#RCP15Ex | RCP15Ex]] || RCE || Read CP15 register
  +
|-
  +
| [[#WCP15Ex | WCP15Ex]] || WCE || Write CP15 register
  +
|-
  +
| [[#Term | Term]] || Term || Visualize printf output using DCC (SEGGER DCC handler running on target)
  +
|-
  +
! colspan="3" | Debugging - Memory operation
  +
|-
  +
| [[#Mem | Mem]] || Mem || Read memory and show corresponding ASCII values
  +
|-
  +
| [[#Mem8 | Mem8]] || Mem8 || Read 8-bit items
  +
|-
  +
| [[#Mem16 | Mem16]] || Mem16 || Read 16-bit items
  +
|-
  +
| [[#Mem32 | Mem32]] || Mem32 || Read 32-bit items
  +
|-
  +
| [[#Write1 | Write1]] || W1 || Write 8-bit items
  +
|-
  +
| [[#Write2 | Write2]] || W2 || Write 16-bit items
  +
|-
  +
| [[#Write4 | Write4]] || W4 || Write 32-bit items
  +
|-
  +
! colspan="3" | Debugging - JTAG related
  +
|-
  +
| [[#JTAGConf | JTAGConf]] || JTAGConf || Set number of IR/DR bits before Target device
  +
|-
  +
| [[#JTAGId | JTAGId]] || I || Read JTAG Id
  +
|-
  +
| [[#WJTAGIR | WJTAGIR]] || WJIR || Write JTAG command (IR)
  +
|-
  +
| [[#WJTAGDR | WJTAGDR]] || WJDR || Write JTAG data (DR)
  +
|-
  +
| [[#WJTAGRaw | WJTAGRaw]] || WJR || Write Raw JTAG data
  +
|-
  +
| [[#ResetTAP | ResetTAP]] || RTAP || Reset TAP Controller using state machine (111110)
  +
|-
  +
| [[#ResetTRST | ResetTRST]] || RT || Reset TAP Controller using nTRST
  +
|-
  +
! colspan="3" | Debugging - ICE
  +
|-
  +
| [[#ICE | ICE]] || ICE || Show state of the embedded ICE macrocell (ICE breaker)
  +
|-
  +
| [[#ReadICE | ReadICE]] || RI || Read Ice register
  +
|-
  +
| [[#WriteICE | WriteICE]] || WI || Write Ice register
  +
|-
  +
! colspan="3" | TRACE
  +
|-
  +
| [[#TClear | TClear]] || TC || Clear TRACE buffer
  +
|-
  +
| [[#TSetSize | TSetSize]] || TSS || Set TRACE size of trace buffer
  +
|-
  +
| [[#TSetFormat | TSetFormat]] || TSF || Set TRACE Format
  +
|-
  +
| [[#TShowRegions | TShowRegions]] || TSR || Show TRACE Regions (and analyze trace buffer)
  +
|-
  +
| [[#TStart | TStart]] || TStart || Start TRACE
  +
|-
  +
| [[#TStop | TStop]] || TStop || Stop TRACE
  +
|-
  +
! colspan="3" | SWO
  +
|-
  +
| [[#SWOSpeed | SWOSpeed]] || SWOSpeed || Show supported SWO speeds
  +
|-
  +
| [[#SWOStart | SWOStart]] || SWOStart || Start SWO
  +
|-
  +
| [[#SWOStop | SWOStop]] || SWOStop || Stop SWO
  +
|-
  +
| [[#SWOStat | SWOStat]] || SWOStat || Display SWO status
  +
|-
  +
| [[#SWORead | SWORead]] || SWORead || Read and display SWO data
  +
|-
  +
| [[#SWOShow | SWOShow]] || SWOShow || Read and analyze SWO data
  +
|-
  +
| [[#SWOFlush | SWOFlush]] || SWOFlush || Flush SWO data
  +
|-
  +
| [[#SWOView | SWOView]] || SWOView || View SWO terminal data
  +
|-
  +
! colspan="3" | Flash programming
  +
|-
  +
| [[#Erase | Erase]] || Erase || Erase flash (range) of selected device
  +
|-
  +
| [[#LoadFile | LoadFile]] || LoadFile || Load data file into target memory
  +
|-
  +
| [[#SaveBin | SaveBin]] || SaveBin || Save target memory range into binary file
  +
|-
  +
| [[#VerifyBin | VerifyBin]] || VerifyBin || Verfy if specified bin file is at the specified target memory location
  +
|-
  +
! colspan="3" | Flasher File I/O Commands
  +
|-
  +
| [[#FWrite | FWrite]] || FWr || (Flasher only) Write file to probe
  +
|-
  +
| [[#FRead | FRead]] || FRd || (Flasher only) Read file from probe
  +
|-
  +
| [[#FShow | FShow]] || FShow || (Flasher only) Read and display file from probe
  +
|-
  +
| [[#FDelete | FDelete]] || FDel || (Flasher only) Delete file on probe
  +
|-
  +
| [[#FSize | FSize]] || FSz || (Flasher only) Display size of file on probe
  +
|-
  +
| [[#FList | FList]] || FList || (Flasher only) List directory on probe
  +
|-
  +
| [[#SecureArea | SecureArea]] || SecureArea || (Flasher only) Creates/Removes secure area on probe
  +
|-
  +
! colspan="3" | Measurement and test commands
  +
|-
  +
| [[#PowerTrace | PowerTrace]] || PowerTrace || Perform power trace (not supported by all models)
  +
|-
  +
| [[#TestWSpeed | TestWSpeed]] || TestW || Measure download speed into target memory
  +
|-
  +
| [[#TestRSpeed | TestRSpeed]] || TestR || Measure upload speed from target memory
  +
|-
  +
| [[#TestCSpeed | TestCSpeed]] || TestC || Measure CPU speed
  +
|-
  +
| [[#TestNWSpeed | TestNWSpeed]] || TestNW || Measure network download speed
  +
|-
  +
| [[#TestNRSpeed | TestNRSpeed]] || TestNR || Measure network upload speed
  +
|-
  +
| [[#MR | MR]] || MR || Measure RTCK react time
  +
|-
  +
! colspan="3" | J-Link Pin control
  +
|-
  +
| [[#Clock | Clock]] || C || Output clock(s) on the TCK pin
  +
|-
  +
| [[#Clock00 | Clock00]] || C00 || Output clock(s) on the TCK pin, with TDI == 0 and TMS == 0
  +
|-
  +
| [[#ClrTCK | ClrTCK]] || TCK0 || Clear TCK pin
  +
|-
  +
| [[#SetTCK | SetTCK]] || TCK1 || Set TCK pin
  +
|-
  +
| [[#ClrTDI | ClrTDI]] || TDI0 || Clear TDI pin
  +
|-
  +
| [[#SetTDI | SetTDI]] || TDI1 || Set TDI pin
  +
|-
  +
| [[#ClrTMS | ClrTMS]] || TMS0 || Clear TMS pin
  +
|-
  +
| [[#SetTMS | SetTMS]] || TMS1 || Set TMS pin
  +
|-
  +
| [[#ClrTRST | ClrTRST]] || TRST0 || Clear TRST pin
  +
|-
  +
| [[#SetTRST | SetTRST]] || TRST1 || Set TRST pin
  +
|-
  +
| [[#ClrRESET | ClrRESET]] || R0 || Clear RESET pin
  +
|-
  +
| [[#SetRESET | SetRESET]] || R1 || Set RESET pin
 
|-
 
|-
| ''NumBytes'' || Maximum number of bytes to read.
 
 
|}
 
|}
   
  +
=== ? ===
'''Example'''<br>
 
  +
Show information about all commands or one specific command.
fshow Flasher.dat
 
  +
==== Syntax ====
 
  +
<tt>? [<Command>]</tt>
==== fsize ====
 
On emulators which support file I/O this command gets the size of a specific file.
 
Currently, only Flasher models support file I/O.
 
 
'''Syntax'''<br>
 
fsize <FileName>]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
  +
| ''<Command>'' || (optional) Command, specific information is required for.
| ''FileName'' || Source file name to read from the Flasher.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>? Connect</tt>
   
  +
=== Exit ===
'''Example'''<br>
 
  +
Close target device connection, J-Link connection and closes the application.
fsize Flasher.dat
 
  +
==== Syntax ====
 
  +
<tt>Exit</tt>
==== fwrite ====
 
On emulators which support file I/O this command writes a specific file.
 
Currently, only Flasher models support file I/O. NumBytes is limited to 512 bytes at once.
 
This means, if you want to write e.g. 1024 bytes, you have to send the command twice,
 
using an appropriate offset when sending it the second time. Offset applies to both destination and source file.
 
 
'''Syntax'''<br>
 
fwrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]]
 
   
  +
=== ExitOnError ===
  +
Toggle exit J-Link Commander on error.
  +
==== Short command ====
  +
<tt>EoE</tt>
  +
==== Syntax ====
  +
<tt>EoE <1/0></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''EmuFile'' || File name to write to.
+
| ''0'' || Exit on error is off.
 
|-
 
|-
| ''HostFile'' || Source file on the host
+
| ''1'' || Exit on error is on.
  +
|}
  +
  +
=== Sleep ===
  +
Waits the given time. Usually used for J-Link Command Scripts.
  +
==== Syntax ====
  +
<tt>Sleep <Delay></tt>
  +
{| class="wikitable"
 
|-
 
|-
  +
! Parameter !! Meaning
| ''Offset'' || Specifies the offset in the file, at which data writing is started.
 
  +
|-
  +
| Delay || Amount of time to sleep in ms.
 
|-
 
|-
| ''NumBytes'' || Maximum number of bytes to write.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>Sleep 100</tt>
   
  +
=== Log ===
'''Example'''<br>
 
  +
Enables log to file.
fwrite Flasher.dat C:\Project\Flasher.dat
 
  +
==== Syntax ====
 
  +
<tt>Log <filename></tt>
==== go ====
 
Starts the CPU. In order to avoid setting breakpoints it allows to define a maximum number of instructions which can be simulated/emulated.
 
This is particularly useful when the program is located in flash and flash breakpoints are used. Simulating instructions avoids to reprogram the flash and speeds up (single) stepping.
 
 
'''Syntax'''<br>
 
go [<NumSteps> [<Flags>]]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Filename'' || Log filename
| ''NumSteps'' || Maximum number of instructions allowed to be simulated. <br> Instruction simulation stops whenever a breakpointed instruction is hit, an instruction which cannot be simulated/emulated is hit or when NumSteps is reached.
 
|-
 
| ''Flags'' || 0: Do not start the CPU if a BP is in range of NumSteps <br> 1: Overstep BPs
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>Log "C:\Users\User\Desktop\MyLogFile.log"</tt>
   
  +
=== ExpDevList ===
'''Example'''<br>
 
  +
Export device names from DLL internal device list to text file.
go //Simply starts the CPU
 
  +
==== Syntax ====
go 20, 1
 
  +
<tt>ExpDevList <Filename></tt>
 
==== halt ====
 
Halts the CPU Core. If successful, shows the current CPU registers.
 
 
'''Syntax'''<br>
 
halt
 
 
==== hwinfo ====
 
This command can be used to get information about the power consumption of the target (if the target is powered via J-Link). It also gives the information if an overcurrent happened.
 
 
'''Syntax'''<br>
 
hwinfo
 
 
==== ip ====
 
Closes any existing connection to J-Link and opens a new one via TCP/IP. If no IP Address is specified, the Emulator selection dialog shows up.
 
 
'''Syntax'''<br>
 
ip [<Addr>]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Filename'' || Path to text file destination.
| ''Addr'' || Valid values:<br> IP Address: Connects the J-Link with the specified IP-Address <br> Host Name: Resolves the host name and connects to it. <br> *: Invokes the Emulator selection dialog.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>ExpDevList "C:\Users\User\Desktop\JLinkSuppDev.txt"</tt>
   
  +
=== ExpDevListXML ===
'''Example'''<br>
 
  +
Export device names from DLL internal device list to XML file.
ip 192.168.6.3
 
  +
==== Syntax ====
 
  +
<tt>ExpDevListXML <Filename></tt>
==== is ====
 
This command returns information about the length of the scan chain select register.
 
 
'''Syntax'''<br>
 
is
 
 
==== loadfile ====
 
This command programs a given data file to a specified destination address. Currently supported data files are:
 
* *.mot
 
* *.srec
 
* *.s19
 
* *.s
 
* *.hex
 
* *.bin
 
 
'''Syntax'''<br>
 
loadfile <Filename> [<Addr>]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Filename'' || Source filename
+
| ''Filename'' || Path to XML file destination.
|-
 
| ''Addr'' || Destination address. If not passed, 0x0 is assumed. '''Only used for .bin files. Ignored for other formats.'''
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>ExpDevListXML "C:\Users\User\Desktop\JLinkSuppDev.xml"</tt>
   
  +
=== USB ===
'''Example'''<br>
 
  +
Connect to J-Link via USB. Opens the USB selection dialog if no port or SN is passed.
loadfile C:\Work\test.bin 0x20000000
 
  +
==== Syntax ====
 
  +
<tt>USB [<SN>]</tt>
==== log ====
 
Set path to logfile allowing the DLL to output logging information. If the logfile already exists, the contents of the current logfile will be overwritten.
 
 
'''Syntax'''<br>
 
log <Filename>
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''SN'' || (optional) Serial number of the J-Link to connect to.
| ''Filename'' || Log filename
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>USB 600100000</tt>
   
  +
=== IP ===
'''Example'''<br>
 
  +
Connect to J-Link via TCP/IP or to Remote Server.
log C:\Work\log.txt
 
  +
Opens the IP selection dialog if no parameter is passed.
 
==== mem ====
+
==== Syntax ====
  +
<tt>IP [<IPAddr|RemoteServerString>]</tt>
The command reads memory from the target system. If necessary, the target CPU is halted in order to read memory. Zone names will be displayed on first connect to target with J-Link commander if available.
 
 
'''Syntax'''<br>
 
mem [<Zone>:]<Addr>, <NumBytes> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''Zone'' || Name of memory zone to access.
+
| ''IPAddr'' || (optional) IP Address of the J-Link to connect to.
|-
 
| ''Addr'' || Start address.
 
 
|-
 
|-
  +
| ''RemoteServerString'' || (optional) Remote server string of the J-Link remote server session to connect to.
| ''Numbytes'' || Number of bytes to read. Maximum is 0x100000.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>IP tunnel:SomeTestName::jlink-europe.segger.com</tt>
   
  +
=== SelectProbe ===
'''Example'''<br>
 
  +
Show list of all connected probes via specified interface.
mem 0x0, 0x100
 
  +
The Probe to communicate with can then be selected.
or
 
  +
==== Short command ====
mem AHB-AP (AP1):0x20000000, 0x100
 
  +
<tt>SelPrb</tt>
 
==== mem8 ====
+
==== Syntax ====
  +
<tt>SelectProbe [<Interface0> <Interface1> ...]</tt>
The command reads memory from the target system in units of bytes. If necessary, the target CPU is halted in order to read memory.
 
 
'''Syntax'''<br>
 
mem [<Zone>:]<Addr>, <NumBytes> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''Zone'' || Name of memory zone to access.
+
| ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP).
  +
|}
  +
==== Example ====
  +
<tt>SelectProbe USB IP</tt>
  +
  +
=== ShowEmuList ===
  +
Show list of all connected probes via specified interface (e.g. USB/IP)
  +
==== Syntax ====
  +
<tt>ShowEmuList [<Interface0> <Interface1> ...]</tt>
  +
{| class="wikitable"
 
|-
 
|-
| ''Addr'' || Start address.
+
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP).
| ''Numbytes'' || Number of bytes to read. Maximum is 0x100000.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>ShowEmuList USB IP</tt>
   
  +
=== Power ===
'''Example'''<br>
 
  +
Switch power supply for target (J-Link pin 19, 5V-Supply) on or off, permanently or until next power-cycle.
mem8 0, 100
 
  +
==== Syntax ====
 
  +
<tt>Power <State> [perm]</tt>
==== mem16 ====
 
The command reads memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory.
 
 
'''Syntax'''<br>
 
mem [<Zone>:]<Addr>, <NumItems> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''Zone'' || Name of memory zone to access.
+
| ''State'' || On: Power supply on.<br>Off: Power supply off.
 
|-
 
|-
| ''Addr'' || Start address.
+
| ''perm'' || Sets the specified State value as default.
|-
 
| ''NumItems'' || Number of halfwords to read. Maximum is 0x80000.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>Power on</tt>
   
  +
=== VTREF ===
'''Example'''<br>
 
  +
Set fixed value for VTref on J-Link (0 == Auto detection).
mem16 0, 100
 
  +
==== Syntax ====
 
  +
<tt>VTREF <Value[mV]></tt>
==== mem32 ====
 
The command reads memory from the target system in units of 32-bits. If necessary, the target CPU is halted in order to read memory.
 
 
'''Syntax'''<br>
 
mem [<Zone>:]<Addr>, <NumItems> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
|-
 
| ''Zone'' || Name of memory zone to access.
 
|-
 
| ''Addr'' || Start address.
 
 
|-
 
|-
| ''NumItems'' || Number of words to read. Maximum is 0x40000.
+
| ''Value[mV]'' || Value, VTref is supposed to be set to in millivolt.
 
|}
 
|}
  +
==== Example ====
  +
<tt>VTREF 3300</tt>
   
  +
=== VCOM ===
'''Example'''<br>
 
  +
Enable/disable VCOM. Takes effect after power cycle of the Probe.
mem32 0, 100
 
  +
==== Syntax ====
  +
<tt>VCOM <enable|disable></tt>
  +
==== Example ====
  +
<tt>VCOM enable</tt>
   
==== mem64 ====
+
=== ShowFWInfo ===
  +
Show firmware info.
The command reads memory from the target system in units of 64-bits. If necessary, the target CPU is halted in order to read memory.
 
  +
==== Short command ====
  +
<tt>F</tt>
   
  +
=== ShowHWStatus ===
'''Syntax'''<br>
 
  +
Show hardware status.
mem [<Zone>:]<Addr>, <NumItems> (hex)
 
  +
==== Short command ====
  +
<tt>St</tt>
   
  +
=== License ===
  +
Execute license command. if no command is passed:
  +
Show a list of all available license commands.
  +
==== Syntax ====
  +
<tt>License [Command]</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter ''Command'' !! Meaning
 
|-
 
|-
| ''Zone'' || Name of memory zone to access.
+
| ''add'' || Store a custom license on J-Link. Syntax: LicAdd <LicName>
 
|-
 
|-
| ''Addr'' || Start address.
+
| ''erase'' || Erase all custom licenses on J-Link.
 
|-
 
|-
  +
| ''show'' || Show all licenses stored on J-Link.
| ''NumItems'' || Number ofdouble words to read. Maximum is 0x20000.
 
 
|}
 
|}
   
  +
=== IPAddr ===
'''Example'''<br>
 
  +
Show/Assign IP address and subnetmask of/to connected Probe.
mem64 0, 100
 
  +
==== Syntax ====
  +
<!-- FF xxx improve syntax!! -->
  +
<tt>IPAddr</tt>
  +
  +
=== GWAddr ===
  +
Show/Assign network gateway address of/to connected Probe.
  +
==== Syntax ====
  +
<!-- FF xxx improve syntax!! -->
  +
<tt>GWAddr</tt>
  +
  +
=== DNSAddr ===
  +
Show/Assign network DNS server address of/to connected Probe.
  +
==== Syntax ====
  +
<!-- FF xxx improve syntax!! -->
  +
<tt>DNSAddr</tt>
  +
  +
=== ShowConf ===
  +
Show configuration of the connected Probe.
  +
==== Short command ====
  +
<tt>Conf</tt>
   
==== mr====
+
=== Calibrate ===
  +
Calibrate the target current measurement.
Measure reaction time of RTCK pin.
 
  +
==== Short command ====
  +
<tt>Calib</tt>
   
  +
=== Connect ===
'''Syntax'''<br>
 
  +
Connect to target device.
mr [<RepCount>]
 
  +
If no device was preselected, the user is asked to provide the missing information about the connected device.
  +
==== Short command ====
  +
<tt>Con</tt>
   
  +
=== Device ===
  +
Select specific device J-Link shall connect to.
  +
If ? is passed: Show device selection dialog.
  +
==== Syntax ====
  +
<tt>Device <DeviceName></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''RepCount'' || Number of times the test is repeated (Default: 1).
+
| ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows device selection dialog.
 
|}
 
|}
  +
==== Example ====
  +
<tt>Device STM32F407VE</tt>
   
  +
=== SelectInterface ===
'''Example'''<br>
 
  +
Select target interface.
mr 3
 
  +
==== Short command ====
 
  +
<tt>SI</tt>
==== ms ====
 
  +
==== Syntax ====
Measures the number of bits in the specified scan chain.
 
  +
<tt>SelectInterface <Interface></tt>
 
'''Syntax'''<br>
 
ms <ScanChain>
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Interface'' || Any supported target interface (e.g SWD, JTAG, ICSP, FINE, ...)
| ''ScanChain'' || Scan chain to be measured.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>SelectInterface SWD</tt>
   
  +
=== Speed ===
'''Example'''<br>
 
  +
Set target interface speed.
ms 1
 
  +
==== Syntax ====
 
  +
<tt>Speed <Setting></tt>
==== power ====
 
This command sets the status of the power supply over pin 19 of the JTAG connector. The KS(Kickstart) versions of J-Link have the 5V supply over pin 19 activated by default. This feature is useful for some targets that can be powered over the JTAG connector.
 
 
'''Syntax'''<br>:
 
power <State> [perm]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Setting'' || Decimal value: Interface speed in kHz.<br>auto: Interface speed is selected automatically.<br>adaptive: Interface speed is set to adaptive.
| ''State'' || Valid values: On, Off
 
|-
 
| ''perm'' || Sets the specified State value as default.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>Speed 4000</tt>
   
  +
=== LE ===
'''Example'''<br>
 
  +
Change mode to little endian.
power on perm
 
   
==== r ====
+
=== BE ===
  +
Change mode to big endian.
Resets and halts the target.
 
 
'''Syntax'''<br>
 
r
 
   
==== readAP ====
+
=== Halt ===
  +
Halt CPU.
Reads from a CoreSight AP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG) this command performs the additional dummy read request automatically.
 
  +
==== Short command ====
  +
<tt>H</tt>
   
  +
=== IsHalted ===
'''Syntax'''<br>
 
  +
Return current CPU state.
ReadAP <RegIndex>
 
  +
==== Short command ====
  +
<tt>IH</tt>
   
  +
=== WaitHalt ===
  +
Wait until CPU is halted or timeout is reached.
  +
If no timeout (in ms) is provided, a default timeout of 1000 ms is used.
  +
==== Short command ====
  +
<tt>WH</tt>
  +
==== Syntax ====
  +
<tt>WaitHalt [<TimeoutMs>]</tt></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Index of AP register to read
+
| ''TimeoutMs'' || (optional) Timeout in milliseconds.
 
|}
 
|}
  +
==== Example ====
  +
<tt>WaitHalt 100</tt></tt>
   
  +
=== Go ===
'''Example'''<br>
 
  +
Start CPU if halted.
//
 
  +
==== Short command ====
// Read AP[0], IDR (register 3, bank 15)
 
  +
<tt>G</tt>
//
 
WriteDP 2, 0x000000F0 // Select AP[0] bank 15
 
ReadAP 3 // Read AP[0] IDR
 
   
==== readcsr ====
+
=== Reset ===
  +
Reset CPU.
Reads a specific CSR (Control Status Register) on a RISC-V based target.
 
  +
==== Short command ====
 
  +
<tt>R</tt>
'''Syntax'''<br>
 
readcsr <RegIndex>[,<RegSizeBytes>]
 
   
  +
=== ResetX ===
  +
Reset CPU with delay after reset. This function is useful for some target devices which already contain an application or a boot loader and therefore need some time before the core is stopped,
  +
for example to initialize hardware, the memory management unit (MMU) or the external bus interface.
  +
==== Short command ====
  +
<tt>RX</tt>
  +
==== Syntax ====
  +
<tt>ResetX <DelayAfterReset></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Index of CSR register to read
+
| ''DelayAfterReset'' || Delay in ms.
|-
 
| ''RegSizeBytes'' || Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64).
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>RX 1000</tt>
   
  +
=== RSetType ===
'''Example'''<br>
 
  +
Set the current reset type.
readcsr 0x300
 
  +
==== Short command ====
or
 
  +
<tt>Rst</tt>
readcsr 0x300, 8
 
  +
==== Syntax ====
 
  +
<tt>RSetType [<Type>]</tt>
==== readDP ====
 
Reads from a CoreSight DP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG) this command performs the additional dummy read request automatically.
 
 
'''Syntax'''<br>
 
ReadDP <RegIndex>
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
  +
| ''Type'' || Desired reset type. If no type is provided, a list of all available types is printed.
| ''RegIndex'' || Index of DP register to read
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>RSetType 0</tt>
   
  +
=== Step ===
'''Example'''<br>
 
  +
Execute step(s) on the CPU and show the executed instructions.
//
 
  +
If no number of steps is provided, one step is executed.
// Read DP-CtrlStat
 
  +
==== Short command ====
//
 
  +
<tt>S</tt>
ReadDP 1
 
  +
==== Syntax ====
 
  +
<tt>Step [<NumSteps> (decimal)]</tt>
==== regs ====
 
  +
==== Example ====
Shows all current register values.
 
  +
<tt>Step 10</tt>
 
'''Syntax'''<br>
 
regs
 
 
==== rnh ====
 
This command performs a reset but without halting the device.
 
 
'''Syntax'''<br>
 
rnh
 
 
==== rreg ====
 
The function prints the value of the specified CPU register.
 
   
  +
=== IS ===
'''Syntax'''<br>
 
  +
Identify length of scan chain select register.
rreg <RegIndex>
 
   
  +
=== MS ===
  +
Measure length of scan chain.
  +
==== Syntax ====
  +
<!-- FF xxx improve syntax!! -->
  +
<tt>MS <ScanChain></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Register to read.
+
| ''ScanChain'' || Scan chain to be measured.
 
|}
 
|}
   
  +
=== Regs ===
'''Example'''<br>
 
  +
Display CPU register contents.
rreg 15
 
 
==== rx ====
 
Resets and halts the target. It is possible to define a delay in milliseconds after reset. This function is useful for some target devices which already contain an application or a boot loader and therefore need some time before the core is stopped, for example to initialize hardware, the memory management unit (MMU) or the external bus interface.
 
 
'''Syntax'''<br>
 
rx <DelayAfterReset>
 
   
  +
=== RReg ===
  +
Read register.
  +
If no register name is passed, all available register names are printed.
  +
==== Syntax ====
  +
<tt>RReg <RegName></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''DelayAfterReset'' || Delay in ms.
+
| ''RegIndex'' || Register to read.
 
|}
 
|}
  +
==== Example ====
  +
<tt>RReg R15 (PC)</tt>
   
  +
=== WReg ===
'''Example'''<br>
 
  +
Write register.
rx 10
 
  +
==== Short command ====
 
  +
<tt>WReg</tt>
==== savebin ====
 
  +
==== Syntax ====
Saves target memory into binary file.
 
  +
<tt>WReg <RegName>, <Value></tt>
 
'''Syntax'''<br>
 
savebin <Filename>, <Addr>, <NumBytes> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Filename'' || Destination file
+
| ''RegName'' || Register to write to.
 
|-
 
|-
| ''Addr'' || Source address.
+
| ''Data'' || Data to write to the specified register.
|-
 
| ''NumBytes'' || Number of bytes to read.
 
 
|}
 
|}
  +
==== Example ====
  +
<tt>WReg R15 (PC), 0x20000000</tt>
   
  +
=== MoE ===
'''Example'''<br>
 
  +
Shows mode-of-entry (Reason why CPU is halted).
savebin C:\Work\test.bin 0x0000000 0x100
 
 
==== setBP ====
 
This command sets a breakpoint of a specific type at a specified address. Which breakpoint modes are available depends on the CPU that is used.
 
 
'''Syntax'''<br>
 
setBP <Addr> [[A/T]/[W/H]] [S/H]
 
   
  +
=== SetBP ===
  +
Set breakpoint.
  +
==== Syntax ====
  +
<tt>SetBP <addr> [<A/T>/<W/H>] [S/H]</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 753: Line 712:
 
|}
 
|}
   
  +
=== ClearBP ===
'''Example'''<br>
 
  +
Clear breakpoint.
setBP 0x8000036
 
  +
==== Short command ====
  +
<tt>ClrBP</tt>
  +
==== Syntax ====
  +
<tt>ClearBP <BP_Handle></tt>
   
==== setPC ====
+
=== SetWP ===
  +
Set Watchpoint.
Sets the PC to the specified value.
 
  +
==== Syntax ====
  +
<tt>SetWP <Addr(hex)> [<AccessType>] [<Size>] [<Data(hex)> [<DataMask(hex)> [<AddrMask(hex)>]]]</tt>
  +
{| class="wikitable"
  +
! Parameter !! Meaning
  +
|-
  +
| ''Addr'' || Address to be breakpointed.
  +
|-
  +
| ''AccessType'' || Trigger on:<br><ul><li><tt>R</tt>: Read access</li><li><tt>W</tt>: Write access</li><li><tt>ANY</tt>: Any access</li></ul>
  +
|-
  +
| ''Size'' || <ul><li><tt>S8</tt>: 8-bit size</li><li><tt>S16</tt>: 16-bit size</li><li><tt>S32</tt>: 32-bit size</li><li><tt>ANY</tt>: Any size</li>
  +
|-
  +
| ''DataMask'' || Ignore data bits set to 1.
  +
|-
  +
| ''AddrMask'' || Ignore address bits set to 1.
  +
|}
  +
==== Example ====
  +
// Stop if value 0x1000 is written to address 0x20000000 (32-bit access):
  +
SetWP 0x20000000 W S32 0x1000 0 0
   
  +
=== ClearWP ===
'''Syntax'''<br>
 
  +
Clear watchpoint.
setpc <Addr>
 
  +
==== Short command ====
  +
<tt>ClrWP</tt>
  +
==== Syntax ====
  +
<tt>ClearWP <WP_Handle></tt>
   
  +
=== VCatch ===
  +
Write vector catch.
  +
==== Short command ====
  +
<tt>VC</tt>
  +
==== Syntax ====
  +
<tt>VCatch <Value></tt>
  +
  +
=== SetPC ===
  +
Set the PC to specified value.
  +
==== Syntax ====
  +
<tt>SetPC <Addr></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 769: Line 765:
 
|}
 
|}
   
  +
=== ReadAP ===
'''Example'''<br>
 
  +
Reads from a CoreSight AP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received.
setpc 0x59C
 
  +
In case actual read data is returned on the next read request (this is the case for example with interface JTAG)
 
  +
this command performs the additional dummy read request automatically.
==== SetTimeoutCmd ====
 
  +
==== Syntax ====
Set timeout in milliseconds for a specific command.
 
  +
<tt>ReadAP <RegIndex></tt>
 
'''Note'''<br>
 
Right now only stepover is supported
 
 
'''Syntax'''<br>
 
SetTimeoutCmd <Cmd> = <TimeoutMs>
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Cmd'' || Command to set timeout for.
+
| ''RegIndex'' || Index of AP register to read
|-
 
| ''TimeoutMs'' || Timeout in milliseconds.
 
 
|}
 
|}
  +
==== Example ====
  +
//
  +
// Read AP[0], IDR (register 3, bank 15)
  +
//
  +
WriteDP 2, 0x000000F0 // Select AP[0] bank 15
  +
ReadAP 3 // Read AP[0] IDR
   
  +
=== WriteAP ===
'''Example'''<br>
 
  +
Writes to a CoreSight AP register. This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.
SetTimeoutCmd stepover = 5000
 
  +
==== Syntax ====
 
  +
<tt>WriteAP <RegIndex></tt>
==== setWP ====
 
This command inserts a new watchpoint that matches the specified parameters.
 
The enable bit for the watchpoint as well as the data access bit of the watchpoint unit are set automatically by this command.
 
Moreover the bits DBGEXT, CHAIN and the RANGE bit (used to connect one watchpoint with the other one) are automatically masked out.
 
In order to use these bits you have to set the watchpoint by writing the ICE registers directly.
 
 
'''Syntax'''<br>
 
setWP <Addr> [<AccessType>] [<Size>] [<Data> [<DataMask> [<AddrMask>]]]
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Addr'' || Address to be watchpointed.
+
| ''RegIndex'' || Index of AP register to write
 
|-
 
|-
  +
| ''Data32Hex'' || Data to write
| ''Accesstype'' || Specifies the control data on which data event has been set: <br> R: read access <br> W: write access
 
|-
 
| ''Size'' || Valid values: S8 &vert; S16 &vert; S32 <br> Specifies to monitor an n-bit access width at the selected address.
 
|-
 
| ''Data'' || Specifies the Data on which watchpoint has been set.
 
|-
 
| ''DataMask'' || Specifies data mask used for comparison. Bits set to 1 are masked out, so not taken into consideration during data comparison. Please note that for certain cores not all Bit-Mask combinations are supported by the core-debug logic. On some cores only complete bytes can be masked out (e.g. PIC32) or similar.
 
|-
 
| ''AddrMask'' || Specifies the address mask used for comparison. Bits set to 1 are masked out, so not taken into consideration during address comparison. Please note that for certain cores not all Bit-Mask combinations are supported by the core-debug logic. On some cores only complete bytes can be masked out (e.g. PIC32) or similar.
 
 
|}
 
|}
   
  +
=== ReadDP ===
'''Example'''<br>
 
  +
Reads from a CoreSight DP register.
setWP 0x20000000 W S8 0xFF
 
  +
This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received.
 
  +
In case actual read data is returned on the next read request (this is the case for example with interface JTAG, not with SWD) this command performs the additional dummy read request automatically.
==== sleep ====
 
  +
==== Syntax ====
Waits the given time (in milliseconds).
 
  +
<tt>ReadDP <RegIndex></tt>
 
'''Syntax'''<br>
 
sleep <Delay>
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Delay'' || Amount of time to sleep in ms.
+
| ''RegIndex'' || Index of DP register to read
 
|}
 
|}
   
  +
=== WriteDP ===
'''Example'''<br>
 
  +
Writes to a CoreSight DP register.
sleep 200
 
  +
This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.
 
==== speed ====
 
This command sets the speed for communication with the CPU core.
 
 
'''Syntax'''<br>
 
speed <Freq>|auto|adaptive
 
   
  +
==== Syntax ====
  +
<tt>WriteDP <RegIndex></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''Freq'' || Specifies the interface frequency in kHz.
+
| ''RegIndex'' || Index of DP register to write
 
|-
 
|-
| ''auto'' || Selects auto detection of the interface speed.
+
| ''Data32Hex'' || Data to write
|-
 
| ''adaptive'' || Selects adaptive clocking as JTAG speed.
 
 
|}
 
|}
  +
==== Example ====
  +
//
  +
// Write DP SELECT register: Select AP 0 bank 15
  +
//
  +
WriteDP 2, 0x000000F0
   
  +
=== RCP15Ex ===
'''Example'''<br>
 
  +
Read CP15 register.
speed 4000
 
  +
==== Short command ====
speed auto
 
  +
<tt>RCE</tt>
  +
==== Syntax ====
  +
<tt>RCE15Ex <Op1>, <CRn>, <CRm>, <Op2></tt>
   
==== st ====
+
=== WCP15Ex ===
  +
Write CP15 register.
This command prints the current hardware status. Prints the current status of TCK, TDI, TDO, TMS, TRES, TRST and the interface speeds supported by the target. Also shows the Target Voltage.
 
  +
==== Short command ====
  +
<tt>WCE</tt>
  +
==== Syntax ====
  +
<tt>WCE15Ex <Op1>, <CRn>, <CRm>, <Op2>, <Data></tt>
   
  +
=== Term ===
'''Syntax'''<br>
 
  +
Visualize printf output using DCC (SEGGER DCC handler running on target).
st
 
   
==== step ====
+
=== Mem ===
  +
Read memory from the target system and show corresponding ASCII values.
Target needs to be halted before calling this command.
 
  +
If necessary, the target CPU is halted in order to read memory.
Executes a single step on the target.
 
  +
Zone names will be displayed on first connect to target with J-Link commander if available.
The instruction is overstepped even if it is breakpointed. Prints out the disassembly of the instruction to be stepped.
 
  +
==== Syntax ====
 
  +
<tt>Mem[<Zone>:]<Addr>, <NumBytes> (hex)</tt>
'''Syntax'''<br>
 
  +
==== Example ====
step
 
  +
<tt>Mem 0x0, 0x100</tt><br>
 
  +
or<br>
==== stepover ====
 
  +
<tt>mem AHB-AP (AP1):0x20000000, 0x100</tt>
Target needs to be halted before calling this command.
 
Executes a stepover on the target, similar how a debugger does it. The instruction is overstepped even if it is breakpointed.
 
Prints out the disassembly of the instruction to be stepped over. By default this command has a timeout of five seconds.
 
 
'''Note'''<br>
 
For more information see [[#SetTimeoutCmd | SetTimeoutCmd]]
 
 
'''Syntax'''<br>
 
stepover
 
 
==== unlock ====
 
This command unlocks a device which has been accidentally locked by malfunction of user software.
 
 
'''Syntax'''<br>
 
unlock <DeviceName>
 
   
  +
=== Mem8 ===
  +
Read memory from the target system in units of 8-bit.
  +
If necessary, the target CPU is halted in order to read memory.
  +
==== Syntax ====
  +
<tt>mem [<Zone>:]<Addr>, <NumItems> (hex)</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''DeviceName'' || Name of the device family to unlock. Supported Devices: <br> LM3Sxxx <br> Kinetis <br> EFM32Gxxx
+
| ''Zone'' || Name of memory zone to access.
|}
 
 
Example
 
unlock Kinetis
 
 
==== usb ====
 
Closes any existing connection to J-Link and opens a new one via USB. It is possible to select a specific J-Link by port number.
 
 
'''Syntax'''<br>
 
usb [<Port>]
 
 
{| class="wikitable"
 
 
|-
 
|-
! Parameter !! Meaning
+
| ''Addr'' || Start address.
 
|-
 
|-
| ''Port'' || Valid values: 0..3
+
| ''NumItems'' || Number of items to read. Maximum is 0x100000.
 
|}
 
|}
   
'''Example'''<br>
+
==== Example ====
  +
<tt>Mem8 0x0, 100</tt>
usb
 
 
==== verifybin ====
 
Verifies if the specified binary is already in the target memory at the specified address.
 
 
'''Syntax'''<br>
 
verifybin <Filename>, <Addr>
 
   
  +
=== Mem16 ===
  +
Read memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory.
  +
==== Syntax ====
  +
<tt>Mem16 [<Zone>:]<Addr>, <NumItems> (hex)</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''Filename'' || Sample bin.
+
| ''Zone'' || Name of memory zone to access.
 
|-
 
|-
| ''Addr'' || Start address of memory to verify.
+
| ''Addr'' || Start address.
  +
|-
  +
| ''NumItems'' || Number of items to read. Maximum is 0x100000.
 
|}
 
|}
   
'''Example'''<br>
+
==== Example ====
  +
<tt>Mem16 0x0, 100</tt>
verifybin C:\Work\test.bin 0x0000000
 
 
==== VTREF ====
 
Sets a fixed value for VTref on J-Link.
 
The Value of VTref can be set between 1200 mV and 3300 mV all values that exceed 3300 mV will be limited to 3300 mV, values smaller than 1200 mV deactivate fixed VTref.
 
Settings of fixed VTref apply nonvolatile after power cycling the probe.
 
 
'''Syntax'''<br>
 
VTREF <ValuemV>
 
   
  +
=== Mem32 ===
  +
Read memory from the target system in units of 32-bits. If necessary, the target CPU is halted in order to read memory.
  +
==== Syntax ====
  +
<tt>Mem32 [<Zone>:]<Addr>, <NumItems> (hex)</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''ValuemV'' || value in Millivolt
+
| ''Zone'' || Name of memory zone to access.
  +
|-
  +
| ''Addr'' || Start address.
  +
|-
  +
| ''NumItems'' || Number of items to read. Maximum is 0x100000.
 
|}
 
|}
  +
==== Example ====
  +
<tt>Mem32 0x0, 100</tt>
   
  +
=== Write1 ===
'''Example'''<br>
 
  +
Write one single byte to the target system.
VTREF 3300
 
  +
==== Short command ====
 
  +
<tt>W1</tt>
'''Note'''<br>
 
  +
==== Syntax ====
The command overrides the VTref pin and once set the pin will be ignored. To activate the pin again call the VTREF command with a voltage of 0V.
 
  +
<tt>W1 [<Zone>:]<Addr>, <Data> (hex)</tt>
 
==== w1 ====
 
The command writes one single byte to the target system.
 
 
'''Syntax'''<br>
 
w1 [<Zone>:]<Addr>, <Data> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 969: Line 926:
 
| ''Addr'' || Start address.
 
| ''Addr'' || Start address.
 
|-
 
|-
| ''Data'' ||8-bits of data to write.
+
| ''Data'' || 8-bits of data to write.
 
|}
 
|}
  +
==== Example ====
  +
<tt>W1 0x0, 01</tt>
   
  +
=== Write2 ===
'''Example'''<br>
 
  +
Write 16-bit items.
w1 0x10, 0xFF
 
  +
==== Short command ====
 
  +
<tt>W2</tt>
==== w2 ====
 
  +
==== Syntax ====
The command writes a unit of 16-bits to the target system.
 
  +
<tt>W2 [<Zone>:]<Addr>, <Data> (hex)</tt>
 
'''Syntax'''<br>
 
w2 [<Zone>:]<Addr>, <Data> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 991: Line 947:
 
| ''Data'' || 16-bits of data to write.
 
| ''Data'' || 16-bits of data to write.
 
|}
 
|}
  +
==== Example ====
  +
<tt>W2 0x0, 0011</tt>
   
  +
=== Write4 ===
'''Example'''<br>
 
  +
Write 32-bit items.
w2 0x0, 0xFFFF
 
  +
==== Short command ====
 
  +
<tt>W4</tt>
==== w4 ====
 
  +
==== Syntax ====
The command writes a unit of 32-bits to the target system.
 
  +
<tt>W4 [<Zone>:]<Addr>, <Data> (hex)</tt>
 
'''Syntax'''<br>
 
w4 [<Zone>:]<Addr>, <Data> (hex)
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 1,012: Line 967:
 
|}
 
|}
   
'''Example'''<br>
+
==== Example ====
w4 0x0, 0xAABBCCFF
+
<tt>W4 0x0, 00112233</tt>
   
==== WebUSBDisable ====
+
=== JTAGConf ===
  +
Configure JTAG scan chain with multiple devices on it.<br>
Disables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe.
 
  +
For more detailed information on how to configure a scan chain with multiple devices please refer to [[UM08001#Determining values for scan chain configuration | Determining values for scan chain configuration]].<br>
  +
==== Syntax ====
  +
{| class="wikitable"
  +
|-
  +
! Parameter !! Meaning
  +
|-
  +
| ''IRPre'' || Sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device.<br>-1 == auto-detection.
  +
|-
  +
| ''DRPre'' || Number of devices closer to TDI.<br>-1 == auto-detection.
  +
|}
  +
==== Example ====
  +
<tt>JTAGConf 4 1 // Select the second device, where there is 1 device in front with IRLen 4</tt>
   
  +
=== JTAGId ===
'''Syntax'''<br>
 
  +
Read JTAG Id.
WebUSBDisable
 
  +
==== Short command ====
  +
<tt>I</tt>
   
==== WebUSBEnable ====
+
=== WJTAGIR ===
  +
Write JTAG command (IR).
Enables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe.
 
  +
If no IRLen is passed, IRLen=4 is used.
 
  +
==== Short command ====
'''Syntax'''<br>
 
  +
<tt>WJIR</tt>
WebUSBEnable
 
  +
==== Syntax ====
 
  +
<tt>WJTAGIR <Insturction(hex)>, [<IRLen(dec)>]</tt>
==== writeAP ====
 
  +
{| class="wikitable"
Writes to a CoreSight AP register. This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.
 
  +
|-
 
  +
! Parameter !! Meaning
'''Syntax'''<br>
 
  +
|-
WriteAP <RegIndex>, <Data32Hex>
 
  +
| ''Insturction'' || Insturction to send as hexadecimal value.
  +
|-
  +
| ''IRLen'' || Instruction register length of the current selected device.
  +
|}
   
  +
=== WJTAGDR ===
  +
Write JTAG data (DR).
  +
==== Short command ====
  +
<tt>WJDR</tt>
  +
==== Syntax ====
  +
<tt>WJTAGDR <Data64(hex)>, <NumBits(dec)></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Index of AP register to write
+
| ''Data64'' || Data to send.
 
|-
 
|-
| ''Data32Hex'' || Data to write
+
| ''NumBits'' || Number of bits to send.
 
|}
 
|}
   
  +
=== WJTAGRaw ===
'''Example'''<br>
 
  +
Write Raw JTAG data.
//
 
  +
==== Short command ====
// Select AHB-AP and configure it
 
  +
<tt>WJR</tt>
//
 
  +
==== Syntax ====
WriteDP 2, 0x00000000 // Select AP[0] (AHB-AP) bank 0
 
  +
<tt>WJTAGRaw</tt>
WriteAP 4, 0x23000010 // Auto-increment, Private access, Access size: word}
 
   
==== writecsr ====
+
=== ResetTAP ===
  +
Reset TAP Controller using state machine (111110).
Writes a specific CSR (Control Status Register) on a RISC-V based target.
 
  +
==== Short command ====
  +
<tt>RTAP</tt>
   
  +
=== ResetTRST ===
'''Note'''<br>
 
  +
Reset TAP Controller using nTRST.
Writes to known CSRs (like X1) may not be written to HW directly but with the next g or s command.
 
  +
==== Short command ====
  +
<tt>RT</tt>
   
  +
=== ICE ===
'''Syntax'''<br>
 
  +
Show state of the embedded ICE macrocell (ICE breaker).
writecsr <RegIndex>, <Data>[,<RegSizeBytes>]
 
   
  +
=== ReadICE ===
  +
Read Ice register.
  +
==== Short command ====
  +
<tt>RI</tt>
  +
==== Syntax ====
  +
<tt>RI <RegIndex>(hex)</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Index of CSR register to write
+
| ''RegIndex'' || Register index of register to read from.
  +
|}
  +
  +
=== WriteICE ===
  +
Write Ice register.
  +
==== Short command ====
  +
<tt>WI</tt>
  +
==== Syntax ====
  +
<tt>WI <RegIndex>, <Data(hex)></tt>
  +
{| class="wikitable"
  +
|-
  +
! Parameter !! Meaning
 
|-
 
|-
  +
| ''RegIndex'' || Register index of register to read from.
| ''Data'' || Data to write
 
 
|-
 
|-
  +
| ''Data'' || Data to write (in hex).
| ''RegSizeBytes'' || Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64).
 
 
|}
 
|}
   
  +
=== TClear ===
'''Example'''<br>
 
  +
Clear trace buffer.
writecsr 0x1001, 0x11223344
 
  +
==== Short command ====
or
 
  +
<tt>TC</tt>
writecsr 0x1001, 0x11223344, 8
 
 
==== writeDP ====
 
Writes to a CoreSight DP register.
 
This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.
 
   
  +
=== TSetSize ===
'''Syntax'''<br>
 
  +
Set size of trace buffer.
WriteDP <RegIndex>, <Data32Hex>
 
  +
==== Short command ====
  +
<tt>TSS</tt>
  +
==== Syntax ====
  +
<tt>TSS <Size(hex)></tt>
   
  +
=== TSetFormat ===
  +
Set trace format Format.
  +
==== Short command ====
  +
<tt>TSF</tt>
  +
==== Syntax ====
  +
<tt>TSF <Format></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter !! Meaning
+
! Parameter !! Meaning
 
|-
 
|-
| ''RegIndex'' || Index of DP register to write
+
| ''Format'' || Trace format. Valid parameter valuse: 4/8/16.
|-
 
| ''Data32Hex'' || Data to write
 
 
|}
 
|}
   
  +
=== TShowRegions ===
'''Example'''<br>
 
  +
Show trace regions (and analyze trace buffer).
//
 
  +
==== Short command ====
// Write DP SELECT register: Select AP 0 bank 15
 
  +
<tt>TSR</tt>
//
 
WriteDP 2, 0x000000F0
 
   
==== wreg ====
+
=== TStart ===
  +
Start trace.
Writes into a register. The value is written into the register on CPU start.
 
   
  +
=== TStop ===
'''Syntax'''<br>
 
  +
Stop trace.
wreg <RegName>, <Data>
 
   
  +
=== SWOSpeed ===
  +
Show supported SWO speeds.
  +
  +
=== SWOStart ===
  +
Start SWO.
  +
  +
=== SWOStop ===
  +
Stop SWO.
  +
  +
=== SWOStat ===
  +
Display SWO status.
  +
  +
=== SWORead ===
  +
Read and display SWO data.
  +
  +
=== SWOShow ===
  +
Read, analyze and show SWO data.
  +
  +
=== SWOFlush ===
  +
Flush SWO data.
  +
  +
=== SWOView ===
  +
View SWO terminal data.
  +
  +
=== Erase ===
  +
Erases all flash sectors or a certain flash range of the current device.
  +
A device has to be specified previously. When specified, all flash between the <SAddr> and <EAddr> will be erased.
  +
==== Syntax ====
  +
<tt>Erase [<SAddr>, <EAddr>]</tt>
  +
==== Example ====
  +
<tt>Erase 0x60000000, 0x60001000</tt>
  +
  +
=== LoadFile ===
  +
Program a given data file. For .bin files, a location has to be specified.
  +
Currently supported data files are:
  +
* *.mot
  +
* *.srec
  +
* *.s37
  +
* *.s19
  +
* *.s
  +
* *.hex
  +
* *.bin
  +
==== Syntax ====
  +
<tt>LoadFile <FileName>, [<Addr(.bin only)>].</tt>
  +
{| class="wikitable"
  +
|-
  +
! Parameter !! Meaning
  +
|-
  +
| ''Filename'' || Source filename.
  +
|-
  +
| ''Addr'' || '''Only used for .bin files. Ignored for other formats.'''<br>Destination address. If not passed, 0x0 is assumed.
  +
|}
  +
  +
=== SaveBin ===
  +
Save target memory range into binary file.
  +
==== Syntax ====
  +
<tt>SaveBin <filename>, <addr>, <NumBytes></tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Parameter !! Meaning
 
! Parameter !! Meaning
 
|-
 
|-
| ''RegName'' || Register to write to.
+
| ''Filename'' || Destination file
 
|-
 
|-
| ''Data'' || Data to write to the specified register.
+
| ''Addr'' || Source address.
  +
|-
  +
| ''NumBytes'' || Number of bytes to read.
 
|}
 
|}
  +
==== Example ====
  +
<tt>SaveBin C:\Work\test.bin 0x0000000 0x100</tt>
   
  +
=== VerifyBin ===
'''Example'''<br>
 
  +
Verfy if specified .bin file is at the specified target memory location.
wreg R14, 0xFF
 
  +
==== Syntax ====
 
  +
<tt>VerifyBin <filename>, <addr></tt>
== Command line options ==
 
  +
{| class="wikitable"
J-Link Commander can be started with different command line options for test and automation purposes.
 
  +
|-
In the following, the command line options which are available for J-Link Commander are explained.
 
  +
! Parameter !! Meaning
All command line options are case insensitive.
 
  +
|-
  +
| ''Filename'' || Sample bin.
  +
|-
  +
| ''Addr'' || Start address of memory to verify.
  +
|}
  +
==== Example ====
  +
<tt>VerifyBin C:\Work\test.bin 0x0000000</tt>
   
  +
=== FWrite ===
  +
On probes which support file I/O this command writes a specific file.
  +
Currently, only Flasher models support file I/O. NumBytes is limited to 512 bytes at once.
  +
This means, if you want to write e.g. 1024 bytes, you have to send the command twice,
  +
using an appropriate offset when sending it the second time. Offset applies to both destination and source file.
  +
==== Short command ====
  +
<tt>FWr</tt>
  +
==== Syntax ====
  +
<tt>FWrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt>
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Command !! Explanation
+
! Parameter !! Meaning
 
|-
 
|-
  +
| ''EmuFile'' || File name to write to.
| [[#-AutoConnect | -AutoConnect]] || Automatically start the target connect sequence.
 
 
|-
 
|-
  +
| ''HostFile'' || Source file on the host
| [[#-CommanderScript | -CommanderScript]] || Passes a CommandFile to J-Link
 
 
|-
 
|-
  +
| ''Offset'' || Specifies the offset in the file, at which data writing is started.
| [[#-CommandFile | -CommandFile]] || Passes a CommandFile to J-Link
 
 
|-
 
|-
  +
| ''NumBytes'' || Maximum number of bytes to write.
| [[#-Device | -Device]] || Pre-selects the device J-Link Commander shall connect to
 
  +
|}
  +
==== Example ====
  +
<tt>FWrite Flasher.dat C:\Project\Flasher.dat</tt>
  +
  +
=== FRead ===
  +
On probes which support file I/O this command reads a specific file.
  +
Offset applies to both destination and source file.
  +
==== Short command ====
  +
<tt>FRd</tt>
  +
==== Syntax ====
  +
<tt>FRead <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt>
  +
{| class="wikitable"
 
|-
 
|-
  +
! Parameter !! Meaning
| [[#-ExitOnError | -ExitOnError]] || Commander exits after error
 
 
|-
 
|-
  +
| ''EmuFile'' || File name to read from.
| [[#-If | -If]] || Pre-selects the target interface
 
 
|-
 
|-
  +
| ''HostFile'' || Destination file on the host.
| [[#-IP | -IP]] || Selects IP as host interface
 
 
|-
 
|-
  +
| ''Offset'' || Specifies the offset in the file, at which data reading is started.
| [[#-JLinkScriptFile | -JLinkScriptFile]] || Passes a JLinkScriptFile to J-Link
 
 
|-
 
|-
  +
| ''NumBytes'' || Maximum number of bytes to read.
| [[#-JTAGConf | -JTAGConf]] || Sets IRPre and DRPre
 
  +
|}
  +
==== Example ====
  +
<tt>FRead Flasher.dat C:\Project\Flasher.dat</tt>
  +
  +
=== FShow ===
  +
On probes which support file I/O this command reads and prints a specific file.
  +
Currently, only Flasher models support file I/O.
  +
==== Syntax ====
  +
<tt>FShow <FileName> [-a] [<Offset> [<NumBytes>]]</tt>
  +
{| class="wikitable"
 
|-
 
|-
  +
! Parameter !! Meaning
| [[#-Log | -Log]] || Sets logfile path
 
 
|-
 
|-
  +
| ''FileName'' || Source file name to read from the Flasher.
| [[#-RTTTelnetPort | -RTTTelnetPort]] || Sets the RTT Telnetport
 
 
|-
 
|-
  +
| ''-a'' || If set, Input will be parsed as text instead of being shown as hex.
| [[#-USB | -USB]] || Connects to a J-Link with a specific S/N over USB.
 
 
|-
 
|-
  +
| ''Offset'' || Specifies the offset in the file, at which data reading is started.
| [[#-SettingsFile | -SettingsFile]] || Passes a SettingsFile to J-Link
 
 
|-
 
|-
  +
| ''NumBytes'' || Maximum number of bytes to read.
| [[#-Speed | -Speed]] || Starts J-Link Commander with a given initial speed
 
  +
|}
  +
==== Example ====
  +
<tt>FShow Flasher.dat</tt>
  +
  +
=== FDelete ===
  +
On probes which support file I/O this command deletes a specific file.
  +
==== Short command ====
  +
<tt>FDel</tt>
  +
==== Syntax ====
  +
<tt>fdelete <FileName></tt>
  +
{| class="wikitable"
 
|-
 
|-
  +
! Parameter !! Meaning
  +
|-
  +
| ''FileName'' || File to delete from the Flasher.
 
|}
 
|}
  +
==== Example ====
  +
<tt>FDelete Flasher.dat</tt>
   
=== Detailed description ===
+
=== FSize ===
  +
On probes which support file I/O this command gets the size of a specific file.
Following is a detailed description with syntax and examples of the command lines listed above.
 
  +
Currently, only Flasher models support file I/O.
  +
==== Short command ====
  +
<tt>FSz</tt>
  +
==== Syntax ====
  +
<tt>FSize <FileName></tt>
  +
{| class="wikitable"
  +
|-
  +
! Parameter !! Meaning
  +
|-
  +
| ''FileName'' || Source file name to read from the Flasher.
  +
|}
   
==== -AutoConnect ====
+
=== FList ===
  +
On probes which support file I/O this command shows the directory tree of the Flasher.
This command can be used to let J-Link Commander automatically start the connect sequence for connecting to the target when entering interactive mode.
 
   
  +
=== SecureArea ===
'''Syntax'''<br>
 
  +
On probes which support file I/O this command creates/removes a secure area on the probe.
-autoconnect <1|0>
 
  +
==== Syntax ====
  +
<tt>SecureArea <Operation></tt>
   
  +
=== PowerTrace ===
'''Example'''<br>
 
  +
Perform power trace (not supported by all models).
JLink.exe -autoconnect 1
 
  +
==== Syntax ====
  +
<tt>PowerTrace <LogFile> [<ChannelMask> <RefCountSel>]</tt>
   
==== -CommanderScript ====
+
=== TestWSpeed ===
  +
Measure download speed into target memory.
Similar to [[#-CommandFile | -CommandFile]].
 
  +
==== Short command ====
  +
<tt>TestW</tt>
  +
==== Syntax ====
  +
<tt>TestWSpeed [<Addr> [<Size>]]</tt>
   
==== -CommandFile ====
+
=== TestRSpeed ===
  +
Measure upload speed from target memory.
Selects a command file and starts J-Link Commander in batch mode. The batch mode of J-Link Commander is similar to the execution of a batch file.
 
  +
==== Short command ====
The command file is parsed line by line and one command is executed at a time.
 
  +
<tt>TestR</tt>
  +
==== Syntax ====
  +
<tt>TestRSpeed [<Addr> [<Size>] [<NumBlocks>]]</tt>
   
  +
=== TestCSpeed ===
'''Syntax'''<br>
 
  +
Measure CPU speed.
  +
==== Short command ====
  +
<tt>TestC</tt>
  +
==== Syntax ====
  +
<tt>TestCSpeed [<RAMAddr>]</tt>
   
  +
=== TestNWSpeed ===
-CommandFile <CommandFilePath>
 
  +
Measure network download speed (probes with ethernet support only).
  +
==== Short command ====
  +
<tt>TestNW</tt>
  +
==== Syntax ====
  +
<tt>TestNWSpeed [<NumBytes> [<NumReps>]]</tt>
   
  +
=== TestNRSpeed ===
'''Example'''<br>
 
  +
Measure network upload speed (probes with ethernet support only).
  +
==== Short command ====
  +
<tt>TestNR</tt>
  +
==== Syntax ====
  +
<tt>TestNRSpeed [<NumBytes> [<NumReps>]]</tt>
   
  +
=== MR ===
See [[#Using J-Link Command Files | Using J-Link Command FIles]].
 
  +
Measure RTCK reaction time.
  +
==== Syntax ====
  +
<tt>mr [<RepCount>]</tt>
  +
{| class="wikitable"
  +
|-
  +
! Parameter !! Meaning
  +
|-
  +
| ''RepCount'' || Number of times the test is repeated (Default: 1).
  +
|}
  +
==== Example ====
  +
<tt>mr 3</tt>
   
==== -Device ====
+
=== Clock ===
Pre-selects the device J-Link Commander shall connect to.
+
Output clock(s) on the TCK pin (J-Link pin 9).
  +
==== Short command ====
For some devices, J-Link already needs to know the device at the time of connecting, since special handling is required for some of them.
 
  +
<tt>C</tt>
For a list of all supported device names, please refer to [[#List of supported target devices | List of supported target devices].
 
  +
==== Syntax ====
  +
<tt>Clock [NumClocks]</tt>
   
  +
=== Clock00 ===
'''Syntax'''<br>
 
  +
Output clock(s) on the TCK pin (J-Link pin 9), with TDI == 0 and TMS == 0.
  +
==== Short command ====
  +
<tt>C00</tt>
  +
==== Syntax ====
  +
<tt>Clock00 [NumClocks]</tt>
   
  +
=== ClrTCK ===
-Device <DeviceName>
 
  +
Clear TCK pin (J-Link pin 9).
  +
==== Short command ====
  +
<tt>TCK0</tt>
   
  +
=== SetTCK ===
'''Example'''<br>
 
  +
Set TCK pin (J-Link pin 9).
  +
==== Short command ====
  +
<tt>TCK1</tt>
   
  +
=== ClrTDI ===
JLink.exe -Device STM32F103ZE
 
  +
Clear TDI pin (J-Link pin 5).
  +
==== Short command ====
  +
<tt>TDI0</tt>
   
==== -ExitOnError ====
+
=== SetTDI ===
  +
Set TDI pin (J-Link pin 5).
Similar to the [[#exitonerror | exitonerror]] command.
 
  +
==== Short command ====
  +
<tt>TDI1</tt>
   
==== -If ====
+
=== ClrTMS ===
  +
Clear TMS pin (J-Link pin 7).
Selects the target interface J-Link shall use to connect to the target.
 
  +
==== Short command ====
By default, J-Link Commander first tries to connect to the target using the target interface which is currently selected in the J-Link firmware.
 
  +
<tt>TMS0</tt>
If connecting fails, J-Link Commander goes through all target interfaces supported by the connected J-Link and tries to connect to the device.
 
   
  +
=== SetTMS ===
'''Syntax'''<br>
 
  +
Set TMS pin (J-Link pin 7).
-If <TargetInterface>
 
  +
==== Short command ====
  +
<tt>TMS1</tt>
   
  +
=== ClrTRST ===
'''Example'''<br>
 
  +
Clear TRST pin (J-Link pin 3).
JLink.exe -If SWD
 
  +
==== Short command ====
  +
<tt>TRST0</tt>
   
==== -IP ====
+
=== SetTRST ===
  +
Set TRST pin (J-Link pin 3).
Selects IP as host interface to connect to J-Link. Default host interface is USB.
 
  +
==== Short command ====
  +
<tt>TRST1</tt>
   
  +
=== ClrRESET ===
'''Syntax'''<br>
 
  +
Clear RESET pin (J-Link pin 15).
-IP <IPAddr>
 
  +
==== Short command ====
  +
<tt>R0</tt>
   
  +
=== SetRESET ===
'''Example'''<br>
 
  +
Set RESET pin (J-Link pin 15).
JLink.exe -IP 192.168.1.17
 
  +
==== Short command ====
 
  +
<tt>R1</tt>
'''Additional information'''<br>
 
To select from a list of all available emulators on Ethernet, please use * as ''<IPAddr>''.
 
 
==== -JLinkScriptFile ====
 
Passes the path of a J-Link script file to the J-Link Commander.
 
J-Link scriptfiles are mainly used to connect to targets which need a special connection sequence before communication with the core is possible.
 
For more information about J-Link script files, please refer to [[J-Link_script_files | J-Link Script Files]].
 
 
'''Syntax'''<br>
 
JLink.exe -JLinkScriptFile <File>
 
 
'''Example'''<br>
 
JLink.exe -JLinkScriptFile “C:\My Projects\Default.JLinkScript”
 
 
==== -JTAGConf ====
 
Passes IRPre and DRPre in order to select a specific device in a JTAG-chain. “-1,-1” can be used to let J-Link select a device automatically.
 
 
'''Syntax'''<br>
 
-JTAGConf <IRPre>,<DRPre>
 
 
'''Example'''<br>
 
JLink.exe -JTAGConf 4,1
 
JLink.exe -JTAGConf -1,-1
 
 
==== -Log ====
 
Set path to LogFilePath allowing the DLL to output logging information.
 
If the logfile already exists, the contents of the current logfile will be overwritten.
 
 
'''Syntax'''<br>
 
-Log <LogFilePath>
 
 
'''Example'''<br>
 
JLink.exe -Log C:\Work\log.txt
 
 
==== -RTTTelnetPort ====
 
This command alters the RTT telnet port. Default is 19021.
 
 
'''Syntax'''<br>
 
-RTTTelnetPort <Port>
 
 
'''Example'''<br>
 
JLink.exe -RTTTelnetPort 9100
 
 
==== USB ====
 
Connect to a J-Link with a specific serial number via USB.
 
Useful if multiple J-Links are connected to the same PC and multiple instances of J-Link Commander shall run and each connects to another J-Link.
 
 
'''Syntax'''<br>
 
USB <SerialNo>
 
 
'''Example'''<br>
 
JLink.exe USB 580011111
 
 
==== -SettingsFile ====
 
Select a J-Link settings file to be used for the target device.
 
The settings file can contain all configurable options of the Settings tab in J-Link Control panel.
 
 
'''Syntax'''<br>
 
-SettingsFile <PathToFile>
 
 
'''Example'''<br>
 
JLink.exe -SettingsFile “C:\Work\settings.txt”
 
 
==== -Speed ====
 
Starts J-Link Commander with a given initial speed. Available parameters are “adaptive”, “auto” or a freely selectable integer value in kHz.
 
It is recommended to use either a fixed speed or, if it is available on the target, adaptive speeds.
 
Default interface speed is 100kHz.
 
 
'''Syntax'''<br>
 
-Speed <Speed_kHz>
 
 
'''Example'''<br>
 
JLink.exe -Speed 4000
 
   
 
== Using J-Link Command Files ==
 
== Using J-Link Command Files ==
Line 1,327: Line 1,447:
 
! Command line option !! Explanation
 
! Command line option !! Explanation
 
|-
 
|-
  +
!colspan="2"| Batch mode specific
| -device <DeviceName> || Selects the target device.
 
 
|-
 
|-
| -if <TargetInterface> || Configures the target interface.
+
| <tt>-AutoConnect <Value></tt> || Value==1: Forces the J-Link Commander to connect to the target, automatically.
 
|-
 
|-
  +
| <tt>-CommandFile <CommandFilePath></tt> || Selects a [[#Using_J-Link_Command_Files | J-Link Command file]] which contains the commands for batch mode / auto execution.
| -speed <InterfaceSpeed> || Configures the target interface speed.
 
 
|-
 
|-
  +
| <tt>-ExitOnError <Value></tt> || Value==1: Exit J-Link Commander on Error.
| -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).
 
 
|-
 
|-
| -autoconnect <Value> || Value==1: Forces the J-Link Commander to connect to the target, automatically.
+
| <tt>-NoGui <Value></tt> || Value==1: Suppresses GUI dialogs.
 
|-
 
|-
  +
!colspan="2"| J-Link connection specific
| -CommanderScript <ScriptPath> || Selects a J-Link Commander Command file which contains the commands for the batch mode.
 
  +
|-
  +
| <tt>-IP <IP/Tunnel/Nickname></tt> || Selects a specific J-Link (via IP/Tunnel/Nickname) to connect to via TCP/IP.
  +
|-
  +
| <tt>-USB <SerialNo></tt> || Selects a specific J-Link (via its serial number) to connect to. Used in case multiple J-Links are connected to the same PC via USB.
 
|-
 
|-
  +
!colspan="2"| Device connection specific
| -SelectEmuBySN <SerialNo> || Selects a specific J-Link (via its serial number) to connect to. Used in case multiple J-Links are connected to the same PC via USB.
 
  +
|-
  +
| <tt>-Device <DeviceName></tt> || Selects the target device.
  +
|-
  +
| <tt>-If <TargetInterface></tt> || Configures the target interface.
  +
|-
  +
| <tt>-JLinkScriptFile <ScriptFilePath></tt> || Selects a specific [[J-Link script files | J-Link script file]] to use.
  +
|-
  +
| <tt>-JTAGConf <IRPre,DRPre></tt> || 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).
  +
|-
  +
| <tt>-Speed <InterfaceSpeed></tt> || Configures the target interface speed.
  +
|-
  +
!colspan="2"| Misc
  +
|-
  +
| <tt>-Log <LogFilePath></tt> || Sets a path a J-Link log file is to be created.
  +
|-
  +
| <tt>-RTTTelnetPort <PortNo></tt> || Set the [[RTT#TELNET_channel_of_J-Link_software | J-Link RTT Telnet]] port to <PortNo>
 
|}
 
|}
   
Line 1,367: Line 1,507:
   
 
== Using J-Link Command Strings ==
 
== Using J-Link Command Strings ==
In order to use J-Link Command Strings in J-Link Commander, the native J-Link Commander command ''exec'' supplemented by one of the available J-Link Command Strings can be used.
+
In order to use [[J-Link Command Strings]] in J-Link Commander, the native J-Link Commander command ''exec'' supplemented by one of the available J-Link Command Strings can be used.
   
 
[[File:JLinkCommander_JLinkCommandStrings.png|link=]]
 
[[File:JLinkCommander_JLinkCommandStrings.png|link=]]
Line 1,375: Line 1,515:
 
exec map reset
 
exec map reset
 
exec map exclude 0x10000000-0x3FFFFFFF
 
exec map exclude 0x10000000-0x3FFFFFFF
  +
  +
== Changing J-Link Reset Strategy ==
  +
The reset strategy can be changed by executing the '''RSetType = <ResetStrategy>''' J-Link Command String:
  +
exec RSetType = 12
   
 
== Connecting to a specific J-Link ==
 
== Connecting to a specific J-Link ==

Revision as of 09:28, 2 December 2021

J-Link Commander (JLink.exe / JLinkExe) 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 Pack, which is available for download on the SEGGER webpage.

The sources of the J-Link Commander are available as part of the J-Link SDK.

Contents

Commands

The table below lists the available commands of J-Link Commander. Detailed descriptions of the commands can be found in the sections below. All commands are accepted case insensitive.

Note:

This list is only valid for the latest version of the J-Link Commander. In case of doubt, use the ? command.

Command (long) Command (short) Explanation
Basic
 ? ? Show information about all or specific commands
Exit Exit Close J-Link connection and quit
ExitOnError EoE Exit on error
Sleep Sleep Waits the given time (in milliseconds)
Log Log Enables log to file
ExpDevList ExpDevList Export device names from DLL internal device list to text file
ExpDevListXML ExpDevListXML Export device names from DLL internal device list to XML file
Configuration - J-Link
USB USB Connect to J-Link via USB
IP IP Connect to J-Link via TCP/IP or to Remote Server
SelectProbe SelPrb Show list of all connected probes via specified interface. The Probe to communicate with can then be selected
ShowEmuList ShowEmuList Show list of all connected probes via specified interface
Power Power Switch power supply for target (5V-Supply pin) on or off
VTREF VTREF Set fixed value for VTref on J-Link
VCOM VCOM Enable/disable VCOM Takes effect after power cycle of the Probe
ShowFWInfo F Show firmware info
ShowHWStatus St Show hardware status
License License Show list of all available license commands
IPAddr IPAddr Show/Assign IP address and subnetmask of/to connected Probe
GWAddr GWAddr Show/Assign network gateway address of/to connected Probe
DNSAddr DNSAddr Show/Assign network DNS server address of/to connected Probe
ShowConf Conf Show configuration of the connected Probe
Calibrate Calib Calibrate the target current measurement
Configuration - Target (CPU)
Connect Con Connect to target device
Device Device Select specific device J-Link shall connect to
SelectInterface SI Select target interface
Speed Speed Set target interface speed
LE LE Change mode to little endian
BE BE Change mode to big endian
Debugging
Halt H Halt CPU
IsHalted IH Return current CPU state
WaitHalt WH Wait until CPU is halted or timeout is reached
Go G Start CPU if halted
Reset R Reset CPU
ResetX RX Reset CPU with delay after reset
RSetType Rst Set the current reset type
Step S Execute step(s) on the CPU
IS IS Identify length of scan chain select register
MS MS Measure length of scan chain
Regs Regs Display CPU register contents
RReg RReg Read register
WReg WReg Write register
MoE MoE Shows mode-of-entry (CPU halt reason)
SetBP SetBP Set breakpoint
ClearBP ClrBP Clear breakpoint
SetWP SetWP Set watchpoint
ClearWP ClrWP Clear watchpoint
VCatch VC Write vector catch
SetPC SetPC Set the PC to specified value
ReadAP ReadAP Read CoreSight AP register
WriteAP WriteAP Write CoreSight AP register
ReadDP ReadDP Read CoreSight DP register
WriteDP WriteDP Write CoreSight DP register
RCP15Ex RCE Read CP15 register
WCP15Ex WCE Write CP15 register
Term Term Visualize printf output using DCC (SEGGER DCC handler running on target)
Debugging - Memory operation
Mem Mem Read memory and show corresponding ASCII values
Mem8 Mem8 Read 8-bit items
Mem16 Mem16 Read 16-bit items
Mem32 Mem32 Read 32-bit items
Write1 W1 Write 8-bit items
Write2 W2 Write 16-bit items
Write4 W4 Write 32-bit items
Debugging - JTAG related
JTAGConf JTAGConf Set number of IR/DR bits before Target device
JTAGId I Read JTAG Id
WJTAGIR WJIR Write JTAG command (IR)
WJTAGDR WJDR Write JTAG data (DR)
WJTAGRaw WJR Write Raw JTAG data
ResetTAP RTAP Reset TAP Controller using state machine (111110)
ResetTRST RT Reset TAP Controller using nTRST
Debugging - ICE
ICE ICE Show state of the embedded ICE macrocell (ICE breaker)
ReadICE RI Read Ice register
WriteICE WI Write Ice register
TRACE
TClear TC Clear TRACE buffer
TSetSize TSS Set TRACE size of trace buffer
TSetFormat TSF Set TRACE Format
TShowRegions TSR Show TRACE Regions (and analyze trace buffer)
TStart TStart Start TRACE
TStop TStop Stop TRACE
SWO
SWOSpeed SWOSpeed Show supported SWO speeds
SWOStart SWOStart Start SWO
SWOStop SWOStop Stop SWO
SWOStat SWOStat Display SWO status
SWORead SWORead Read and display SWO data
SWOShow SWOShow Read and analyze SWO data
SWOFlush SWOFlush Flush SWO data
SWOView SWOView View SWO terminal data
Flash programming
Erase Erase Erase flash (range) of selected device
LoadFile LoadFile Load data file into target memory
SaveBin SaveBin Save target memory range into binary file
VerifyBin VerifyBin Verfy if specified bin file is at the specified target memory location
Flasher File I/O Commands
FWrite FWr (Flasher only) Write file to probe
FRead FRd (Flasher only) Read file from probe
FShow FShow (Flasher only) Read and display file from probe
FDelete FDel (Flasher only) Delete file on probe
FSize FSz (Flasher only) Display size of file on probe
FList FList (Flasher only) List directory on probe
SecureArea SecureArea (Flasher only) Creates/Removes secure area on probe
Measurement and test commands
PowerTrace PowerTrace Perform power trace (not supported by all models)
TestWSpeed TestW Measure download speed into target memory
TestRSpeed TestR Measure upload speed from target memory
TestCSpeed TestC Measure CPU speed
TestNWSpeed TestNW Measure network download speed
TestNRSpeed TestNR Measure network upload speed
MR MR Measure RTCK react time
J-Link Pin control
Clock C Output clock(s) on the TCK pin
Clock00 C00 Output clock(s) on the TCK pin, with TDI == 0 and TMS == 0
ClrTCK TCK0 Clear TCK pin
SetTCK TCK1 Set TCK pin
ClrTDI TDI0 Clear TDI pin
SetTDI TDI1 Set TDI pin
ClrTMS TMS0 Clear TMS pin
SetTMS TMS1 Set TMS pin
ClrTRST TRST0 Clear TRST pin
SetTRST TRST1 Set TRST pin
ClrRESET R0 Clear RESET pin
SetRESET R1 Set RESET pin

?

Show information about all commands or one specific command.

Syntax

? [<Command>]

Parameter Meaning
<Command> (optional) Command, specific information is required for.

Example

? Connect

Exit

Close target device connection, J-Link connection and closes the application.

Syntax

Exit

ExitOnError

Toggle exit J-Link Commander on error.

Short command

EoE

Syntax

EoE <1/0>

Parameter Meaning
0 Exit on error is off.
1 Exit on error is on.

Sleep

Waits the given time. Usually used for J-Link Command Scripts.

Syntax

Sleep <Delay>

Parameter Meaning
Delay Amount of time to sleep in ms.

Example

Sleep 100

Log

Enables log to file.

Syntax

Log <filename>

Parameter Meaning
Filename Log filename

Example

Log "C:\Users\User\Desktop\MyLogFile.log"

ExpDevList

Export device names from DLL internal device list to text file.

Syntax

ExpDevList <Filename>

Parameter Meaning
Filename Path to text file destination.

Example

ExpDevList "C:\Users\User\Desktop\JLinkSuppDev.txt"

ExpDevListXML

Export device names from DLL internal device list to XML file.

Syntax

ExpDevListXML <Filename>

Parameter Meaning
Filename Path to XML file destination.

Example

ExpDevListXML "C:\Users\User\Desktop\JLinkSuppDev.xml"

USB

Connect to J-Link via USB. Opens the USB selection dialog if no port or SN is passed.

Syntax

USB [<SN>]

Parameter Meaning
SN (optional) Serial number of the J-Link to connect to.

Example

USB 600100000

IP

Connect to J-Link via TCP/IP or to Remote Server. Opens the IP selection dialog if no parameter is passed.

Syntax

IP [<IPAddr|RemoteServerString>]

Parameter Meaning
IPAddr (optional) IP Address of the J-Link to connect to.
RemoteServerString (optional) Remote server string of the J-Link remote server session to connect to.

Example

IP tunnel:SomeTestName::jlink-europe.segger.com

SelectProbe

Show list of all connected probes via specified interface. The Probe to communicate with can then be selected.

Short command

SelPrb

Syntax

SelectProbe [<Interface0> <Interface1> ...]

Parameter Meaning
Interface (optional) Interface, J-Links are supposed to be located at (USB, IP).

Example

SelectProbe USB IP

ShowEmuList

Show list of all connected probes via specified interface (e.g. USB/IP)

Syntax

ShowEmuList [<Interface0> <Interface1> ...]

Parameter Meaning
Interface (optional) Interface, J-Links are supposed to be located at (USB, IP).

Example

ShowEmuList USB IP

Power

Switch power supply for target (J-Link pin 19, 5V-Supply) on or off, permanently or until next power-cycle.

Syntax

Power <State> [perm]

Parameter Meaning
State On: Power supply on.
Off: Power supply off.
perm Sets the specified State value as default.

Example

Power on

VTREF

Set fixed value for VTref on J-Link (0 == Auto detection).

Syntax

VTREF <Value[mV]>

Parameter Meaning
Value[mV] Value, VTref is supposed to be set to in millivolt.

Example

VTREF 3300

VCOM

Enable/disable VCOM. Takes effect after power cycle of the Probe.

Syntax

VCOM <enable|disable>

Example

VCOM enable

ShowFWInfo

Show firmware info.

Short command

F

ShowHWStatus

Show hardware status.

Short command

St

License

Execute license command. if no command is passed: Show a list of all available license commands.

Syntax

License [Command]

Parameter Command Meaning
add Store a custom license on J-Link. Syntax: LicAdd <LicName>
erase Erase all custom licenses on J-Link.
show Show all licenses stored on J-Link.

IPAddr

Show/Assign IP address and subnetmask of/to connected Probe.

Syntax

IPAddr

GWAddr

Show/Assign network gateway address of/to connected Probe.

Syntax

GWAddr

DNSAddr

Show/Assign network DNS server address of/to connected Probe.

Syntax

DNSAddr

ShowConf

Show configuration of the connected Probe.

Short command

Conf

Calibrate

Calibrate the target current measurement.

Short command

Calib

Connect

Connect to target device. If no device was preselected, the user is asked to provide the missing information about the connected device.

Short command

Con

Device

Select specific device J-Link shall connect to. If ? is passed: Show device selection dialog.

Syntax

Device <DeviceName>

Parameter Meaning
DeviceName Valid device name: Device is selected.
 ?: Shows device selection dialog.

Example

Device STM32F407VE

SelectInterface

Select target interface.

Short command

SI

Syntax

SelectInterface <Interface>

Parameter Meaning
Interface Any supported target interface (e.g SWD, JTAG, ICSP, FINE, ...)

Example

SelectInterface SWD

Speed

Set target interface speed.

Syntax

Speed <Setting>

Parameter Meaning
Setting Decimal value: Interface speed in kHz.
auto: Interface speed is selected automatically.
adaptive: Interface speed is set to adaptive.

Example

Speed 4000

LE

Change mode to little endian.

BE

Change mode to big endian.

Halt

Halt CPU.

Short command

H

IsHalted

Return current CPU state.

Short command

IH

WaitHalt

Wait until CPU is halted or timeout is reached. If no timeout (in ms) is provided, a default timeout of 1000 ms is used.

Short command

WH

Syntax

WaitHalt [<TimeoutMs>]

Parameter Meaning
TimeoutMs (optional) Timeout in milliseconds.

Example

WaitHalt 100

Go

Start CPU if halted.

Short command

G

Reset

Reset CPU.

Short command

R

ResetX

Reset CPU with delay after reset. This function is useful for some target devices which already contain an application or a boot loader and therefore need some time before the core is stopped, for example to initialize hardware, the memory management unit (MMU) or the external bus interface.

Short command

RX

Syntax

ResetX <DelayAfterReset>

Parameter Meaning
DelayAfterReset Delay in ms.

Example

RX 1000

RSetType

Set the current reset type.

Short command

Rst

Syntax

RSetType [<Type>]

Parameter Meaning
Type Desired reset type. If no type is provided, a list of all available types is printed.

Example

RSetType 0

Step

Execute step(s) on the CPU and show the executed instructions. If no number of steps is provided, one step is executed.

Short command

S

Syntax

Step [<NumSteps> (decimal)]

Example

Step 10

IS

Identify length of scan chain select register.

MS

Measure length of scan chain.

Syntax

MS <ScanChain>

Parameter Meaning
ScanChain Scan chain to be measured.

Regs

Display CPU register contents.

RReg

Read register. If no register name is passed, all available register names are printed.

Syntax

RReg <RegName>

Parameter Meaning
RegIndex Register to read.

Example

RReg R15 (PC)

WReg

Write register.

Short command

WReg

Syntax

WReg <RegName>, <Value>

Parameter Meaning
RegName Register to write to.
Data Data to write to the specified register.

Example

WReg R15 (PC), 0x20000000

MoE

Shows mode-of-entry (Reason why CPU is halted).

SetBP

Set breakpoint.

Syntax

SetBP <addr> [<A/T>/<W/H>] [S/H]

Parameter Meaning
Addr Address to be breakpointed.
A/T Only for ARM7/9/11 and Cortex-R4 devices:
A: ARM mode
T: THUMB mode
W/H Only for MIPS devices:
W: MIPS32 mode (Word)
H: MIPS16 mode (Half-word)
S/H S: Force software BP
H: Force hardware BP

ClearBP

Clear breakpoint.

Short command

ClrBP

Syntax

ClearBP <BP_Handle>

SetWP

Set Watchpoint.

Syntax

SetWP <Addr(hex)> [<AccessType>] [<Size>] [<Data(hex)> [<DataMask(hex)> [<AddrMask(hex)>]]]

Parameter Meaning
Addr Address to be breakpointed.
AccessType Trigger on:
  • R: Read access
  • W: Write access
  • ANY: Any access
Size
  • S8: 8-bit size
  • S16: 16-bit size
  • S32: 32-bit size
  • ANY: Any size
DataMask Ignore data bits set to 1.
AddrMask Ignore address bits set to 1.

Example

// Stop if value 0x1000 is written to address 0x20000000 (32-bit access):
SetWP 0x20000000 W S32 0x1000 0 0

ClearWP

Clear watchpoint.

Short command

ClrWP

Syntax

ClearWP <WP_Handle>

VCatch

Write vector catch.

Short command

VC

Syntax

VCatch <Value>

SetPC

Set the PC to specified value.

Syntax

SetPC <Addr>

Parameter Meaning
Addr Address the PC should be set to.

ReadAP

Reads from a CoreSight AP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG) this command performs the additional dummy read request automatically.

Syntax

ReadAP <RegIndex>

Parameter Meaning
RegIndex Index of AP register to read

Example

//
// Read AP[0], IDR (register 3, bank 15)
//
WriteDP 2, 0x000000F0 // Select AP[0] bank 15
ReadAP 3              // Read AP[0] IDR

WriteAP

Writes to a CoreSight AP register. This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.

Syntax

WriteAP <RegIndex>

Parameter Meaning
RegIndex Index of AP register to write
Data32Hex Data to write

ReadDP

Reads from a CoreSight DP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG, not with SWD) this command performs the additional dummy read request automatically.

Syntax

ReadDP <RegIndex>

Parameter Meaning
RegIndex Index of DP register to read

WriteDP

Writes to a CoreSight DP register. This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.

Syntax

WriteDP <RegIndex>

Parameter Meaning
RegIndex Index of DP register to write
Data32Hex Data to write

Example

//
// Write DP SELECT register: Select AP 0 bank 15
//
WriteDP 2, 0x000000F0

RCP15Ex

Read CP15 register.

Short command

RCE

Syntax

RCE15Ex <Op1>, <CRn>, <CRm>, <Op2>

WCP15Ex

Write CP15 register.

Short command

WCE

Syntax

WCE15Ex <Op1>, <CRn>, <CRm>, <Op2>,

Term

Visualize printf output using DCC (SEGGER DCC handler running on target).

Mem

Read memory from the target system and show corresponding ASCII values. If necessary, the target CPU is halted in order to read memory. Zone names will be displayed on first connect to target with J-Link commander if available.

Syntax

Mem[<Zone>:]<Addr>, <NumBytes> (hex)

Example

Mem 0x0, 0x100
or
mem AHB-AP (AP1):0x20000000, 0x100

Mem8

Read memory from the target system in units of 8-bit. If necessary, the target CPU is halted in order to read memory.

Syntax

mem [<Zone>:]<Addr>, <NumItems> (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
NumItems Number of items to read. Maximum is 0x100000.

Example

Mem8 0x0, 100

Mem16

Read memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory.

Syntax

Mem16 [<Zone>:]<Addr>, <NumItems> (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
NumItems Number of items to read. Maximum is 0x100000.

Example

Mem16 0x0, 100

Mem32

Read memory from the target system in units of 32-bits. If necessary, the target CPU is halted in order to read memory.

Syntax

Mem32 [<Zone>:]<Addr>, <NumItems> (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
NumItems Number of items to read. Maximum is 0x100000.

Example

Mem32 0x0, 100

Write1

Write one single byte to the target system.

Short command

W1

Syntax

W1 [<Zone>:]<Addr>, (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
Data 8-bits of data to write.

Example

W1 0x0, 01

Write2

Write 16-bit items.

Short command

W2

Syntax

W2 [<Zone>:]<Addr>, (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
Data 16-bits of data to write.

Example

W2 0x0, 0011

Write4

Write 32-bit items.

Short command

W4

Syntax

W4 [<Zone>:]<Addr>, (hex)

Parameter Meaning
Zone Name of memory zone to access.
Addr Start address.
Data 32-bits of data to write.

Example

W4 0x0, 00112233

JTAGConf

Configure JTAG scan chain with multiple devices on it.
For more detailed information on how to configure a scan chain with multiple devices please refer to Determining values for scan chain configuration.

Syntax

Parameter Meaning
IRPre Sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device.
-1 == auto-detection.
DRPre Number of devices closer to TDI.
-1 == auto-detection.

Example

JTAGConf 4 1 // Select the second device, where there is 1 device in front with IRLen 4

JTAGId

Read JTAG Id.

Short command

I

WJTAGIR

Write JTAG command (IR). If no IRLen is passed, IRLen=4 is used.

Short command

WJIR

Syntax

WJTAGIR <Insturction(hex)>, [<IRLen(dec)>]

Parameter Meaning
Insturction Insturction to send as hexadecimal value.
IRLen Instruction register length of the current selected device.

WJTAGDR

Write JTAG data (DR).

Short command

WJDR

Syntax

WJTAGDR <Data64(hex)>, <NumBits(dec)>

Parameter Meaning
Data64 Data to send.
NumBits Number of bits to send.

WJTAGRaw

Write Raw JTAG data.

Short command

WJR

Syntax

WJTAGRaw

ResetTAP

Reset TAP Controller using state machine (111110).

Short command

RTAP

ResetTRST

Reset TAP Controller using nTRST.

Short command

RT

ICE

Show state of the embedded ICE macrocell (ICE breaker).

ReadICE

Read Ice register.

Short command

RI

Syntax

RI <RegIndex>(hex)

Parameter Meaning
RegIndex Register index of register to read from.

WriteICE

Write Ice register.

Short command

WI

Syntax

WI <RegIndex>, <Data(hex)>

Parameter Meaning
RegIndex Register index of register to read from.
Data Data to write (in hex).

TClear

Clear trace buffer.

Short command

TC

TSetSize

Set size of trace buffer.

Short command

TSS

Syntax

TSS <Size(hex)>

TSetFormat

Set trace format Format.

Short command

TSF

Syntax

TSF <Format>

Parameter Meaning
Format Trace format. Valid parameter valuse: 4/8/16.

TShowRegions

Show trace regions (and analyze trace buffer).

Short command

TSR

TStart

Start trace.

TStop

Stop trace.

SWOSpeed

Show supported SWO speeds.

SWOStart

Start SWO.

SWOStop

Stop SWO.

SWOStat

Display SWO status.

SWORead

Read and display SWO data.

SWOShow

Read, analyze and show SWO data.

SWOFlush

Flush SWO data.

SWOView

View SWO terminal data.

Erase

Erases all flash sectors or a certain flash range of the current device. A device has to be specified previously. When specified, all flash between the <SAddr> and <EAddr> will be erased.

Syntax

Erase [<SAddr>, <EAddr>]

Example

Erase 0x60000000, 0x60001000

LoadFile

Program a given data file. For .bin files, a location has to be specified. Currently supported data files are:

  • *.mot
  • *.srec
  • *.s37
  • *.s19
  • *.s
  • *.hex
  • *.bin

Syntax

LoadFile <FileName>, [<Addr(.bin only)>].

Parameter Meaning
Filename Source filename.
Addr Only used for .bin files. Ignored for other formats.
Destination address. If not passed, 0x0 is assumed.

SaveBin

Save target memory range into binary file.

Syntax

SaveBin <filename>, <addr>, <NumBytes>

Parameter Meaning
Filename Destination file
Addr Source address.
NumBytes Number of bytes to read.

Example

SaveBin C:\Work\test.bin 0x0000000 0x100

VerifyBin

Verfy if specified .bin file is at the specified target memory location.

Syntax

VerifyBin <filename>, <addr>

Parameter Meaning
Filename Sample bin.
Addr Start address of memory to verify.

Example

VerifyBin C:\Work\test.bin 0x0000000

FWrite

On probes which support file I/O this command writes a specific file. Currently, only Flasher models support file I/O. NumBytes is limited to 512 bytes at once. This means, if you want to write e.g. 1024 bytes, you have to send the command twice, using an appropriate offset when sending it the second time. Offset applies to both destination and source file.

Short command

FWr

Syntax

FWrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]]

Parameter Meaning
EmuFile File name to write to.
HostFile Source file on the host
Offset Specifies the offset in the file, at which data writing is started.
NumBytes Maximum number of bytes to write.

Example

FWrite Flasher.dat C:\Project\Flasher.dat

FRead

On probes which support file I/O this command reads a specific file. Offset applies to both destination and source file.

Short command

FRd

Syntax

FRead <EmuFile> <HostFile> [<Offset> [<NumBytes>]]

Parameter Meaning
EmuFile File name to read from.
HostFile Destination file on the host.
Offset Specifies the offset in the file, at which data reading is started.
NumBytes Maximum number of bytes to read.

Example

FRead Flasher.dat C:\Project\Flasher.dat

FShow

On probes which support file I/O this command reads and prints a specific file. Currently, only Flasher models support file I/O.

Syntax

FShow <FileName> [-a] [<Offset> [<NumBytes>]]

Parameter Meaning
FileName Source file name to read from the Flasher.
-a If set, Input will be parsed as text instead of being shown as hex.
Offset Specifies the offset in the file, at which data reading is started.
NumBytes Maximum number of bytes to read.

Example

FShow Flasher.dat

FDelete

On probes which support file I/O this command deletes a specific file.

Short command

FDel

Syntax

fdelete <FileName>

Parameter Meaning
FileName File to delete from the Flasher.

Example

FDelete Flasher.dat

FSize

On probes which support file I/O this command gets the size of a specific file. Currently, only Flasher models support file I/O.

Short command

FSz

Syntax

FSize <FileName>

Parameter Meaning
FileName Source file name to read from the Flasher.

FList

On probes which support file I/O this command shows the directory tree of the Flasher.

SecureArea

On probes which support file I/O this command creates/removes a secure area on the probe.

Syntax

SecureArea <Operation>

PowerTrace

Perform power trace (not supported by all models).

Syntax

PowerTrace <LogFile> [<ChannelMask> <RefCountSel>]

TestWSpeed

Measure download speed into target memory.

Short command

TestW

Syntax

TestWSpeed [<Addr> [<Size>]]

TestRSpeed

Measure upload speed from target memory.

Short command

TestR

Syntax

TestRSpeed [<Addr> [<Size>] [<NumBlocks>]]

TestCSpeed

Measure CPU speed.

Short command

TestC

Syntax

TestCSpeed [<RAMAddr>]

TestNWSpeed

Measure network download speed (probes with ethernet support only).

Short command

TestNW

Syntax

TestNWSpeed [<NumBytes> [<NumReps>]]

TestNRSpeed

Measure network upload speed (probes with ethernet support only).

Short command

TestNR

Syntax

TestNRSpeed [<NumBytes> [<NumReps>]]

MR

Measure RTCK reaction time.

Syntax

mr [<RepCount>]

Parameter Meaning
RepCount Number of times the test is repeated (Default: 1).

Example

mr 3

Clock

Output clock(s) on the TCK pin (J-Link pin 9).

Short command

C

Syntax

Clock [NumClocks]

Clock00

Output clock(s) on the TCK pin (J-Link pin 9), with TDI == 0 and TMS == 0.

Short command

C00

Syntax

Clock00 [NumClocks]

ClrTCK

Clear TCK pin (J-Link pin 9).

Short command

TCK0

SetTCK

Set TCK pin (J-Link pin 9).

Short command

TCK1

ClrTDI

Clear TDI pin (J-Link pin 5).

Short command

TDI0

SetTDI

Set TDI pin (J-Link pin 5).

Short command

TDI1

ClrTMS

Clear TMS pin (J-Link pin 7).

Short command

TMS0

SetTMS

Set TMS pin (J-Link pin 7).

Short command

TMS1

ClrTRST

Clear TRST pin (J-Link pin 3).

Short command

TRST0

SetTRST

Set TRST pin (J-Link pin 3).

Short command

TRST1

ClrRESET

Clear RESET pin (J-Link pin 15).

Short command

R0

SetRESET

Set RESET pin (J-Link pin 15).

Short command

R1

Using J-Link Command Files

J-Link commander can also be used in batch mode which allows the user to use J-Link commander for batch processing and without user interaction. Please do not confuse J-Link Command Files file with J-Link Script Files. When using J-Link commander in batch mode, the path to a command file is passed to it. The syntax in the command file is the same as when using regular commands in J-Link commander (one line per command). SEGGER recommends to always pass the device name via command line option due some devices need special handling on connect/reset in order to guarantee proper function.

Example

JLink.exe -device STM32F103ZE -CommandFile C:\\CommandFile.jlink

Contents of CommandFile.jlink:

si 1
speed 4000
r
h
loadbin C:\firmware.bin,0x08000000

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
Batch mode specific
-AutoConnect <Value> Value==1: Forces the J-Link Commander to connect to the target, automatically.
-CommandFile <CommandFilePath> Selects a J-Link Command file which contains the commands for batch mode / auto execution.
-ExitOnError <Value> Value==1: Exit J-Link Commander on Error.
-NoGui <Value> Value==1: Suppresses GUI dialogs.
J-Link connection specific
-IP <IP/Tunnel/Nickname> Selects a specific J-Link (via IP/Tunnel/Nickname) to connect to via TCP/IP.
-USB <SerialNo> Selects a specific J-Link (via its serial number) to connect to. Used in case multiple J-Links are connected to the same PC via USB.
Device connection specific
-Device <DeviceName> Selects the target device.
-If <TargetInterface> Configures the target interface.
-JLinkScriptFile <ScriptFilePath> Selects a specific J-Link script file to use.
-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).
-Speed <InterfaceSpeed> Configures the target interface speed.
Misc
-Log <LogFilePath> Sets a path a J-Link log file is to be created.
-RTTTelnetPort <PortNo> Set the J-Link RTT Telnet port to <PortNo>

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

Using J-Link Command Strings

In order to use J-Link Command Strings in J-Link Commander, the native J-Link Commander command exec supplemented by one of the available J-Link Command Strings can be used.

JLinkCommander JLinkCommandStrings.png

Example:

exec SupplyPower = 1
exec map reset
exec map exclude 0x10000000-0x3FFFFFFF

Changing J-Link Reset Strategy

The reset strategy can be changed by executing the RSetType = <ResetStrategy> J-Link Command String:

exec RSetType = 12

Connecting to a specific J-Link

It is possible to have multiple J-Links connected to the PC at the same time (for more information, see here. To connect to a specific J-Link in an automated way (no user interaction required), J-Link Commander needs to be told the S/N of the J-Link to connect to. This can be done via two different methods:

  • Specify the S/N directly via command line. See -SelectEmuBySN above for more information.
  • Specify "SelectEmuBySN <SN>" (without quotes) as first command in the J-Link command file that is passed to J-Link Commander via command line

Setup External CFI NOR Flash

J-Link Commander supports downloading bin files into external CFI flash memory. In the following, it is explained which steps are necessary to prepare J-Link Commander for download into external CFI flash memory based on a sample sequence for a ST STM32F103ZE device:

r
speed 1000
exec setcfiflash 0x64000000 - 0x64FFFFFF
exec setworkram 0x20000000 - 0x2000FFFF
w4 0x40021014, 0x00000114 // RCC_AHBENR, FSMC clock enable
w4 0x40021018, 0x000001FD // GPIOD~G clock enable
w4 0x40011400, 0xB4BB44BB // GPIOD low config, NOE, NWE => Output, NWAIT => Input
w4 0x40011404, 0xBBBBBBBB // GPIOD high config, A16-A18
w4 0x40011800, 0xBBBBBBBB // GPIOE low config, A19-A23
w4 0x40011804, 0xBBBBBBBB // GPIOE high config, D5-D12
w4 0x40011C00, 0x44BBBBBB // GPIOF low config, A0-A5
w4 0x40011C04, 0xBBBB4444 // GPIOF high config, A6-A9
w4 0x40012000, 0x44BBBBBB // GPIOG low config, A10-A15
w4 0x40012004, 0x444B4BB4 // GPIOG high config, NE2 => output
w4 0xA0000008, 0x00001059 // CS control reg 2, 16-bit, write enable, Type: NOR flash
w4 0xA000000C, 0x10000505 // CS2 timing reg (read access)
w4 0xA000010C, 0x10000505 // CS2 timing reg (write access)
speed 4000
mem 0x64000000,100
loadfile C:\STMB672_STM32F103ZE_TestBlinky.bin,0x64000000
mem 0x64000000,100

Command specifics

Verifybin command

The verifybin command in J-Link Commander executes a simple read of memory and compares the data against the data in the specified bin file. Note that *no* initialization of any flash interface etc. is done on this command. For external QSPI flash for example this means that the pins and the QSPI controller of the target MCU have to be already initialized etc. for this command to succeed. This is different for "loadbin" which may trigger a flash download implicitly where a flash loader is started that takes care of the initialization. Also note that executing a "loadbin" command in advance, does not guarantee that a "verifybin" succeeds because the loadbin commands restores the controller state after it is done. So if the QSPI controller and/or pins were not initialized before the "loadbin" command, they are not after it either. They are only available while "loadbin" is active.