Difference between revisions of "J-Link Commander"
(→Commands) |
m |
||
(84 intermediate revisions by 9 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 |
+ | [https://www.segger.com/products/debug-probes/j-link/tools/j-link-commander/?mtm_campaign=kb&mtm_kwd=J-link-commander J-Link Commander] (JLink.exe / JLinkExe) is a free, command line based utility that can be used for verifying proper functionality of [https://www.segger.com/products/debug-probes/j-link/?mtm_campaign=kb&mtm_kwd=J-link-commander 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/downloads/jlink/?mtm_campaign=kb&mtm_kwd=J-link-commander 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/?mtm_campaign=kb&mtm_kwd=J-link-commander J-Link SDK]. |
||
+ | |||
+ | <div class="toclimit-2"> |
||
__TOC__ |
__TOC__ |
||
+ | </div> |
||
− | = Commands = |
+ | == Commands == |
− | The table below lists the available commands of J-Link Commander |
+ | The table below lists the available commands of J-Link Commander. |
− | Detailed descriptions of the commands can be found in the sections |
+ | 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 ( |
+ | ! Command (long) !! Command (short) !! Explanation |
|- |
|- |
||
− | ! colspan=" |
+ | ! colspan="3" | Basic |
|- |
|- |
||
− | | [[# |
+ | | [[#? | ?]] || ? || Show information about all or specific commands |
− | |- |
||
− | | [[#clrWP | clrWP]] || Clear watchpoint. |
||
|- |
|- |
||
− | | [[# |
+ | | [[#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 || Exit on error |
|- |
|- |
||
− | | [[# |
+ | | [[#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. |
||
|- |
|- |
||
− | | [[# |
+ | | [[#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. |
||
|- |
|- |
||
− | | [[# |
+ | | [[#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 |
||
|- |
|- |
||
− | | [[# |
+ | | [[#Reboot | Reboot]] || Reboot || Reboot the connected probe. |
|- |
|- |
||
+ | | [[#Uptime | Uptime]] || Uptime || Show Probe uptime since boot. |
||
− | | [[#WebUSBDisable | WebUSBDisable]] || Disables WebUSB on J-Link. |
||
|- |
|- |
||
+ | | [[#ShowFWInfo | ShowFWInfo]] || F || Show firmware info |
||
− | | [[#WebUSBEnable | WebUSBEnable]] || Enables WebUSB on J-Link. |
||
+ | |- |
||
+ | | [[#ShowHWStatus | ShowHWStatus]] || St || Show hardware status |
||
+ | |- |
||
+ | | [[#License | License]] || License || Show list of all available license commands |
||
+ | |- |
||
+ | | [[#IPAddr | IPAddr]] || IPAddr || Show/Assign IP address and subnetmask of/to connected Probe |
||
+ | |- |
||
+ | | [[#GWAddr | GWAddr]] || GWAddr || Show/Assign network gateway address of/to connected Probe |
||
+ | |- |
||
+ | | [[#DNSAddr | DNSAddr]] || DNSAddr || Show/Assign network DNS server address of/to connected Probe |
||
+ | |- |
||
+ | | [[#ShowConf | ShowConf]] || Conf || Show configuration of the connected Probe |
||
+ | |- |
||
+ | | [[#Calibrate | Calibrate]] || Calib || Calibrate the target current measurement |
||
+ | |- |
||
+ | ! colspan="3" | Configuration - Target (CPU) |
||
+ | |- |
||
+ | | [[#Connect | Connect]] || Con || Connect to target device |
||
+ | |- |
||
+ | | [[#Device | Device]] || Device || Select specific device J-Link shall connect to |
||
+ | |- |
||
+ | | [[#SelectInterface | SelectInterface]] || SI || Select target interface |
||
+ | |- |
||
+ | | [[#Speed | Speed]] || Speed || Set target interface speed |
||
+ | |- |
||
+ | | [[#LE | LE]] || LE || Change mode to little endian |
||
+ | |- |
||
+ | | [[#BE | BE]] || BE || Change mode to big endian |
||
+ | |- |
||
+ | ! colspan="3" | Debugging |
||
+ | |- |
||
+ | | [[#Halt | Halt]] || H || Halt CPU |
||
+ | |- |
||
+ | | [[#IsHalted | IsHalted]] || IH || Return current CPU state |
||
+ | |- |
||
+ | | [[#WaitHalt | WaitHalt]] || WH || Wait until CPU is halted or timeout is reached |
||
+ | |- |
||
+ | | [[#Go | Go]] || G || Start CPU if halted |
||
+ | |- |
||
+ | | [[#Reset | Reset]] || R || Reset CPU |
||
+ | |- |
||
+ | | [[#ResetX | ResetX]] || RX || Reset CPU with delay after reset |
||
+ | |- |
||
+ | | [[#RSetType | RSetType]] || Rst || Set the current reset type |
||
+ | |- |
||
+ | | [[#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) |
||
+ | |- |
||
+ | | [[#SetBP | SetBP]] || SetBP || Set breakpoint |
||
+ | |- |
||
+ | | [[#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 |
||
+ | |- |
||
+ | | [[#Write8 | Write8]] || W8 || Write 64-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" | STRACE |
||
+ | |- |
||
+ | | [[#STraceStart | STraceStart]] || STStart || Starts STRACE |
||
+ | |- |
||
+ | | [[#STraceStop | STraceStop]] || STStop || Stops STRACE |
||
+ | |- |
||
+ | | [[#STraceRead | STraceRead]] || STRead || Reads collected STRACE data |
||
+ | |- |
||
+ | ! 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 |
||
|- |
|- |
||
|} |
|} |
||
− | == |
+ | === ? === |
+ | Show information about all commands or one specific command. |
||
− | This command removes a breakpoint set by J-Link. |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>? [<Command>]</tt> |
||
− | '''Syntax'''<br> |
||
− | clrBP <BP_Handle> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''<Command>'' || (optional) Command, specific information is required for. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>? Connect</tt> |
||
+ | === Exit === |
||
− | '''Example'''<br> |
||
+ | Close target device connection, J-Link connection and closes the application. |
||
− | clrBP 1 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Exit</tt> |
||
− | == clrWP == |
||
− | This command removes a watchpoint set by J-Link. |
||
− | |||
− | '''Syntax'''<br> |
||
− | clrWP <WP_Handle> |
||
+ | === 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 |
||
|- |
|- |
||
− | | '' |
+ | | ''0'' || Exit on error is off. |
+ | |- |
||
+ | | ''1'' || Exit on error is on. |
||
|} |
|} |
||
+ | === Sleep === |
||
− | '''Example'''<br> |
||
+ | Waits the given time. Usually used for J-Link Command Scripts. |
||
− | clrWP 0x2 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Sleep <Delay></tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | Delay || Amount of time to sleep in ms. |
||
− | | ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows a device selection dialog. |
||
+ | |- |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Sleep 100</tt> |
||
+ | === Log === |
||
− | '''Example'''<br> |
||
+ | Enables log to file. |
||
− | device stm32f407ig |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Log <filename></tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''Filename'' || Log filename |
||
− | | ''Command'' || J-Link Command String to be executed. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Log "C:\Users\User\Desktop\MyLogFile.log"</tt> |
||
+ | === ExpDevList === |
||
− | '''Example'''<br> |
||
+ | Export device names from DLL internal device list to text file. |
||
− | exec SupplyPower = 1 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>ExpDevList <Filename></tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''Filename'' || Path to text file destination. |
||
− | | ''1/0'' || 1: J-Link Commander will now exit on Error. <br> 0: J-Link Commander will no longer exit on Error. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>ExpDevList "C:\Users\User\Desktop\JLinkSuppDev.txt"</tt> |
||
+ | === ExpDevListXML === |
||
− | '''Example'''<br> |
||
+ | Export device names from DLL internal device list to XML file. |
||
− | eoe 1 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>ExpDevListXML <Filename></tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Filename'' || Path to XML file destination. |
|} |
|} |
||
+ | ==== 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, SN or nickname (available from V7.92d) is passed. |
||
− | fdelete Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>USB [<SN/Nickname>]</tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''SN/Nickname'' || (optional) Serial number or nickname (available from V7.92d) of the J-Link to connect to. |
||
− | | ''EmuFile'' || File name to read from. |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>USB 600100000</tt><br> |
||
+ | <tt>USB J-Link</tt><br> |
||
+ | <tt>USB "My J-Link"</tt><br> |
||
+ | |||
+ | === IP === |
||
+ | Connect to J-Link via TCP/IP or to Remote Server. |
||
+ | Opens the IP selection dialog if no parameter is passed. |
||
+ | ==== Syntax ==== |
||
+ | <tt>IP [<IPAddr|RemoteServerString>]</tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | ''HostFile'' || Destination file on the host. |
||
|- |
|- |
||
+ | | ''IPAddr'' || (optional) IP Address of the J-Link to connect to. |
||
− | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
||
|- |
|- |
||
+ | | ''RemoteServerString'' || (optional) Remote server string of the J-Link remote server session to connect to. |
||
− | | ''NumBytes'' || Maximum number of bytes to read. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>IP tunnel:SomeTestName::jlink-europe.segger.com</tt> |
||
+ | === SelectProbe === |
||
− | '''Example'''<br> |
||
+ | Show list of all connected probes via specified interface. |
||
− | fread Flasher.dat C:\Project\Flasher.dat |
||
+ | The Probe to communicate with can then be selected. |
||
− | |||
− | == |
+ | ==== Short command ==== |
+ | <tt>SelPrb</tt> |
||
− | On emulators which support file I/O this command reads and prints a specific file. |
||
+ | ==== Syntax ==== |
||
− | Currently, only Flasher models support file I/O. |
||
+ | <tt>SelectProbe [<Interface0> <Interface1> ...]</tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | fshow <FileName> [-a] [<Offset> [<NumBytes>]] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP). |
− | |- |
||
− | | ''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 ==== |
||
+ | <tt>SelectProbe USB IP</tt> |
||
+ | === ShowEmuList === |
||
− | '''Example'''<br> |
||
+ | Show list of all connected probes via specified interface (e.g. USB/IP) |
||
− | fshow Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>ShowEmuList [<Interface0> <Interface1> ...]</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 |
|- |
|- |
||
− | | '' |
+ | | ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP). |
|} |
|} |
||
+ | ==== 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. |
||
− | fsize Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Power <State> [perm]</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>]] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''State'' || On: Power supply on.<br>Off: Power supply off. |
|- |
|- |
||
− | | '' |
+ | | ''perm'' || Sets the specified State value as default. |
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>Power on</tt> |
||
+ | |||
+ | === VTREF === |
||
+ | Set fixed value for VTref on J-Link (0 == Auto detection). |
||
+ | ==== Syntax ==== |
||
+ | <tt>VTREF <Value[mV]></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | ''Offset'' || Specifies the offset in the file, at which data writing is started. |
||
|- |
|- |
||
− | | '' |
+ | | ''Value[mV]'' || Value, VTref is supposed to be set to in millivolt. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>VTREF 3300</tt> |
||
+ | === Reboot === |
||
− | '''Example'''<br> |
||
+ | Reboot the connected probe and reconnect to it. If connection cannot be established in <Timeout>ms, an error is assumed. |
||
− | fwrite Flasher.dat C:\Project\Flasher.dat |
||
+ | ==== Syntax ==== |
||
+ | <tt>Reboot [<Timeout[ms]>]</tt> |
||
+ | ==== Example ==== |
||
+ | Reboot // Reboot with default timeout. |
||
+ | Reboot 10000 // Reboot with 10 sec. timeout. |
||
− | == |
+ | === Uptime === |
+ | Show current uptime of the connected Probe since boot. |
||
− | Starts the CPU. In order to avoid setting breakpoints it allows to define a maximum number of instructions which can be simulated/emulated. |
||
+ | ==== Syntax ==== |
||
− | 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. |
||
+ | <tt>Uptime</tt> |
||
+ | ==== Example ==== |
||
+ | <tt>Uptime</tt> |
||
+ | === VCOM === |
||
− | '''Syntax'''<br> |
||
+ | Enable/disable VCOM. Takes effect after power cycle of the Probe. |
||
− | go [<NumSteps> [<Flags>]] |
||
+ | ==== Syntax ==== |
||
+ | <tt>VCOM <enable|disable></tt> |
||
+ | ==== Example ==== |
||
+ | <tt>VCOM enable</tt> |
||
+ | === ShowFWInfo === |
||
+ | Show firmware info. |
||
+ | ==== Short command ==== |
||
+ | <tt>F</tt> |
||
+ | |||
+ | === ShowHWStatus === |
||
+ | Show hardware status. |
||
+ | ==== 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 |
+ | ! Parameter ''Command'' !! Meaning |
|- |
|- |
||
+ | | ''add'' || Store a custom license on J-Link. Syntax: LicAdd <LicName> |
||
− | | ''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. |
||
|- |
|- |
||
− | | '' |
+ | | ''erase'' || Erase all custom licenses on J-Link. |
+ | |- |
||
+ | | ''show'' || Show all licenses stored on J-Link. |
||
|} |
|} |
||
+ | === IPAddr === |
||
− | '''Example'''<br> |
||
+ | Show/Assign IP address and subnetmask of/to connected Probe. |
||
− | go //Simply starts the CPU |
||
+ | ==== Syntax ==== |
||
− | go 20, 1 |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>IPAddr</tt> |
||
− | == |
+ | === GWAddr === |
+ | Show/Assign network gateway address of/to connected Probe. |
||
− | Halts the CPU Core. If successful, shows the current CPU registers. |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>GWAddr</tt> |
||
+ | === DNSAddr === |
||
− | '''Syntax'''<br> |
||
+ | Show/Assign network DNS server address of/to connected Probe. |
||
− | halt |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>DNSAddr</tt> |
||
− | == |
+ | === ShowConf === |
+ | Show configuration of the connected Probe. |
||
− | 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. |
||
+ | ==== Short command ==== |
||
+ | <tt>Conf</tt> |
||
+ | === Calibrate === |
||
− | '''Syntax'''<br> |
||
+ | Calibrate the target current measurement. |
||
− | hwinfo |
||
+ | ==== Short command ==== |
||
+ | <tt>Calib</tt> |
||
− | == |
+ | === Connect === |
+ | Connect to target device. |
||
− | 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. |
||
+ | If no device was preselected, the user is asked to provide the missing information about the connected device. |
||
+ | ==== Short command ==== |
||
+ | <tt>Con</tt> |
||
+ | === Device === |
||
− | '''Syntax'''<br> |
||
+ | Select specific device J-Link shall connect to. |
||
− | ip [<Addr>] |
||
+ | If ? is passed: Show device selection dialog. |
||
+ | ==== Syntax ==== |
||
+ | <tt>Device <DeviceName></tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows device selection dialog. |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>Device STM32F407VE</tt> |
||
+ | === SelectInterface === |
||
+ | Select target interface. |
||
+ | ==== Short command ==== |
||
+ | <tt>SI</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>SelectInterface <Interface></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''Interface'' || Any supported target interface (e.g SWD, JTAG, ICSP, FINE, ...) |
||
− | | ''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>SelectInterface SWD</tt> |
||
+ | === Speed === |
||
− | '''Example'''<br> |
||
+ | Set target interface speed. |
||
− | ip 192.168.6.3 |
||
+ | ==== Syntax ==== |
||
+ | <tt>Speed <Setting></tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''Setting'' || Decimal value: Interface speed in kHz.<br>auto: Interface speed is selected automatically.<br>adaptive: Interface speed is set to adaptive. |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>Speed 4000</tt> |
||
− | == |
+ | === LE === |
+ | Change mode to little endian. |
||
− | This command returns information about the length of the scan chain select register. |
||
+ | === BE === |
||
− | '''Syntax'''<br> |
||
+ | Change mode to big endian. |
||
− | is |
||
− | == |
+ | === Halt === |
+ | Halt CPU. |
||
− | This command programs a given data file to a specified destination address. Currently supported data files are: |
||
+ | ==== Short command ==== |
||
− | * *.mot |
||
+ | <tt>H</tt> |
||
− | * *.srec |
||
− | * *.s19 |
||
− | * *.s |
||
− | * *.hex |
||
− | * *.bin |
||
+ | === IsHalted === |
||
− | '''Syntax'''<br> |
||
+ | Return current CPU state. |
||
− | loadfile <Filename> [<Addr>] |
||
+ | ==== 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 |
|- |
|- |
||
+ | | ''TimeoutMs'' || (optional) Timeout in milliseconds. |
||
− | | ''Filename'' | Source filename |
||
− | |- |
||
− | | ''Addr'' | Destination address (Required for *.bin files) |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>WaitHalt 100</tt></tt> |
||
+ | === Go === |
||
− | '''Example'''<br> |
||
+ | Start CPU if halted. |
||
− | loadfile C:\Work\test.bin 0x20000000 |
||
+ | ==== Short command ==== |
||
+ | <tt>G</tt> |
||
− | == |
+ | === Reset === |
+ | Reset CPU. |
||
− | 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. |
||
+ | ==== Short command ==== |
||
+ | <tt>R</tt> |
||
+ | === ResetX === |
||
− | '''Syntax'''<br> |
||
+ | 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, |
||
− | log <Filename> |
||
+ | 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" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''DelayAfterReset'' || Delay in ms. |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>RX 1000</tt> |
||
+ | === RSetType === |
||
+ | Set the current reset type. |
||
+ | ==== Short command ==== |
||
+ | <tt>Rst</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>RSetType [<Type>]</tt> |
||
{| 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. |
||
− | | ''Filename'' || Log filename |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>RSetType 0</tt> |
||
+ | === Step === |
||
− | '''Example'''<br> |
||
+ | Execute step(s) on the CPU and show the executed instructions. |
||
− | log C:\Work\log.txt |
||
+ | If no number of steps is provided, one step is executed. |
||
+ | ==== Short command ==== |
||
+ | <tt>S</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>Step [<NumSteps> (decimal)]</tt> |
||
+ | ==== Example ==== |
||
+ | <tt>Step 10</tt> |
||
− | == |
+ | === IS === |
+ | Identify length of scan chain select register. |
||
− | 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) |
||
+ | === MS === |
||
+ | Measure length of scan chain. |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>MS <ScanChain></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
− | |- |
||
− | | ''Zone'' || Name of memory zone to access. |
||
− | |- |
||
− | | ''Addr'' || Start address. |
||
|- |
|- |
||
− | | '' |
+ | | ''ScanChain'' || Scan chain to be measured. |
|} |
|} |
||
+ | === Regs === |
||
− | '''Example'''<br> |
||
+ | Display CPU register contents. |
||
− | mem 0x0, 0x100 |
||
− | or |
||
− | mem AHB-AP (AP1):0x20000000, 0x100 |
||
− | |||
− | == mem8 == |
||
− | 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) |
||
+ | === 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 |
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Register to read. |
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>RReg "R15 (PC)"</tt> |
||
+ | |||
+ | === WReg === |
||
+ | Write register. |
||
+ | ==== Short command ==== |
||
+ | <tt>WReg</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WReg <RegName> <Value></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
− | + | ! Parameter !! Meaning |
|
|- |
|- |
||
− | | '' |
+ | | ''RegName'' || Register to write to. |
+ | |- |
||
+ | | ''Data'' || Data to write to the specified register. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>WReg "R15 (PC)" 0x20000000</tt> |
||
+ | === MoE === |
||
− | '''Example'''<br> |
||
+ | Shows mode-of-entry (Reason why CPU is halted). |
||
− | mem8 0, 100 |
||
− | |||
− | == 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) |
||
+ | === SetBP === |
||
+ | Set breakpoint. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SetBP <addr> [<A/T>/<W/H>] [S/H]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Addr'' || Address to be breakpointed. |
|- |
|- |
||
+ | | ''A/T'' || Only for ARM7/9/11 and Cortex-R4 devices: <br> A: ARM mode <br> T: THUMB mode |
||
− | | ''Addr'' || Start address. |
||
|- |
|- |
||
+ | | ''W/H'' || Only for MIPS devices: <br> W: MIPS32 mode (Word) <br> H: MIPS16 mode (Half-word) |
||
− | | ''NumItems'' || Number of halfwords to read. Maximum is 0x80000. |
||
+ | |- |
||
+ | | ''S/H'' || S: Force software BP <br> H: Force hardware BP |
||
|} |
|} |
||
+ | === ClearBP === |
||
− | '''Example'''<br> |
||
+ | Clear breakpoint. |
||
− | mem16 0, 100 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>ClrBP</tt> |
||
− | == mem32 == |
||
+ | ==== Syntax ==== |
||
− | 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. |
||
+ | <tt>ClearBP <BP_Handle></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | mem [<Zone>:]<Addr>, <NumItems> (hex) |
||
+ | === SetWP === |
||
+ | Set Watchpoint. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SetWP <Addr(hex)> [<AccessType>] [<Size>] [<Data(hex)> [<DataMask(hex)> [<AddrMask(hex)>]]]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
+ | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Addr'' || Address to be breakpointed. |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''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> |
||
− | | ''Zone'' || Name of memory zone to access. |
||
|- |
|- |
||
+ | | ''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> |
||
− | | ''Addr'' || Start address. |
||
|- |
|- |
||
− | | '' |
+ | | ''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 === |
||
− | '''Example'''<br> |
||
+ | Clear watchpoint. |
||
− | mem32 0, 100 |
||
+ | ==== Short command ==== |
||
+ | <tt>ClrWP</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>ClearWP <WP_Handle></tt> |
||
− | == |
+ | === VCatch === |
+ | Write vector catch. |
||
− | 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>VC</tt> |
||
− | '''Syntax'''<br> |
||
+ | ==== Syntax ==== |
||
− | mem [<Zone>:]<Addr>, <NumItems> (hex) |
||
+ | <tt>VCatch <Value></tt> |
||
+ | === SetPC === |
||
+ | Set the PC to specified value. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SetPC <Addr></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! 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 ==== |
||
+ | <tt>ReadAP <RegIndex></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
− | + | ! Parameter !! Meaning |
|
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of AP register to read |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | * See: [[#Reading from another MEM-AP|Reading from another MEM-AP]] |
||
+ | * Read AP[0], IDR (register 3, bank 15):<br><source> |
||
+ | WriteDP 2 0x000000F0 // Select AP[0] bank 15 |
||
+ | ReadAP 3 // Read AP[0] IDR</source> |
||
+ | === 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. |
||
− | mem64 0, 100 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>WriteAP <RegIndex></tt> |
||
− | == mr== |
||
− | Measure reaction time of RTCK pin. |
||
− | |||
− | '''Syntax'''<br> |
||
− | mr [<RepCount>] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of AP register to write |
+ | |- |
||
+ | | ''Data32Hex'' || Data to write |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | See: [[#Reading from another MEM-AP|Reading from another MEM-AP]] |
||
+ | === ReadDP === |
||
− | '''Example'''<br> |
||
+ | Reads from a CoreSight DP register. |
||
− | mr 3 |
||
+ | 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. |
||
− | == ms == |
||
+ | ==== Syntax ==== |
||
− | Measures the number of bits in the specified scan chain. |
||
+ | <tt>ReadDP <RegIndex></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | ms <ScanChain> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of DP register to read |
|} |
|} |
||
+ | === WriteDP === |
||
− | '''Example'''<br> |
||
+ | Writes to a CoreSight DP register. |
||
− | ms 1 |
||
+ | 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. |
||
− | |||
− | == 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] |
||
+ | ==== Syntax ==== |
||
+ | <tt>WriteDP <RegIndex></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of DP register to write |
|- |
|- |
||
− | | '' |
+ | | ''Data32Hex'' || Data to write |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | See: [[#Reading from another MEM-AP|Reading from another MEM-AP]] |
||
+ | === RCP15Ex === |
||
− | '''Example'''<br> |
||
+ | Read CP15 register. |
||
− | power on perm |
||
+ | ==== Short command ==== |
||
+ | <tt>RCE</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>RCP15Ex <Op1> <CRn> <CRm> <Op2></tt> |
||
− | == |
+ | === WCP15Ex === |
+ | Write CP15 register. |
||
− | Resets and halts the target. |
||
+ | ==== Short command ==== |
||
+ | <tt>WCE</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WCP15Ex <Op1> <CRn> <CRm> <Op2> <Data></tt> |
||
+ | === Term === |
||
− | '''Syntax'''<br> |
||
+ | Visualize printf output using DCC (SEGGER DCC handler running on target). |
||
− | r |
||
− | == |
+ | === Mem === |
+ | Read memory from the target system and show corresponding ASCII values. |
||
− | 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. |
||
+ | 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> |
||
+ | ==== Syntax ==== |
||
− | ReadAP <RegIndex> |
||
+ | <tt>Mem[<Zone>:]<Addr> <NumBytes> (hex)</tt> |
||
+ | ==== Example ==== |
||
+ | <tt>Mem 0x0 0x100</tt><br> |
||
+ | or<br> |
||
+ | <tt>mem AHB-AP (AP1):0x20000000 0x100</tt> |
||
+ | === 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 |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
+ | |- |
||
+ | | ''Addr'' || Start address. |
||
+ | |- |
||
+ | | ''NumItems'' || Number of items to read. Maximum is 0x100000. |
||
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>Mem8 0x0 100</tt> |
||
− | // |
||
− | // Read AP[0], IDR (register 3, bank 15) |
||
− | // |
||
− | WriteDP 2, 0x000000F0 // Select AP[0] bank 15 |
||
− | ReadAP 3 // Read AP[0] IDR |
||
− | |||
− | == readcsr == |
||
− | Reads a specific CSR (Control Status Register) on a RISC-V based target. |
||
− | |||
− | '''Syntax'''<br> |
||
− | readcsr <RegIndex>[,<RegSizeBytes>] |
||
+ | === 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 |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
+ | |- |
||
+ | | ''Addr'' || Start address. |
||
|- |
|- |
||
+ | | ''NumItems'' || Number of items to read. Maximum is 0x100000. |
||
− | | ''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>Mem16 0x0 100</tt> |
||
− | readcsr 0x300 |
||
− | or |
||
− | readcsr 0x300, 8 |
||
− | |||
− | == 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> |
||
+ | === 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 |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''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. |
||
− | // |
||
+ | ==== Short command ==== |
||
− | // Read DP-CtrlStat |
||
+ | <tt>W1</tt> |
||
− | // |
||
+ | ==== Syntax ==== |
||
− | ReadDP 1 |
||
+ | <tt>W1 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | |||
− | == regs == |
||
− | Shows all current register values. |
||
− | |||
− | '''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. |
||
− | |||
− | '''Syntax'''<br> |
||
− | rreg <RegIndex> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
+ | |- |
||
+ | | ''Addr'' || Start address. |
||
+ | |- |
||
+ | | ''Data'' || 8-bits of data to write. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>W1 0x0 01</tt> |
||
+ | === Write2 === |
||
− | '''Example'''<br> |
||
+ | Write 16-bit items. |
||
− | rreg 15 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>W2</tt> |
||
− | == rx == |
||
+ | ==== Syntax ==== |
||
− | 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. |
||
+ | <tt>W2 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | rx <DelayAfterReset> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
+ | |- |
||
+ | | ''Addr'' || Start address. |
||
+ | |- |
||
+ | | ''Data'' || 16-bits of data to write. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>W2 0x0 0011</tt> |
||
+ | === Write4 === |
||
− | '''Example'''<br> |
||
+ | Write 32-bit items. |
||
− | rx 10 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>W4</tt> |
||
− | == savebin == |
||
+ | ==== Syntax ==== |
||
− | Saves target memory into binary file. |
||
+ | <tt>W4 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | savebin <Filename>, <Addr>, <NumBytes> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
|- |
|- |
||
− | | ''Addr'' || |
+ | | ''Addr'' || Start address. |
|- |
|- |
||
− | | '' |
+ | | ''Data'' || 32-bits of data to write. |
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>W4 0x0 00112233</tt> |
||
− | savebin C:\Work\test.bin 0x0000000 0x100 |
||
− | == |
+ | === Write8 === |
+ | Write 64-bit items. |
||
− | 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. |
||
+ | {{ Note|1= |
||
+ | Supported since V7.86b |
||
+ | }} |
||
+ | ==== Short command ==== |
||
− | '''Syntax'''<br> |
||
+ | <tt>W8</tt> |
||
− | setBP <Addr> [[A/T]/[W/H]] [S/H] |
||
+ | ==== Syntax ==== |
||
+ | <tt>W8 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
|- |
|- |
||
+ | | ''Addr'' || Start address. |
||
− | | ''A/T'' || Only for ARM7/9/11 and Cortex-R4 devices: <br> A: ARM mode <br> T: THUMB mode |
||
|- |
|- |
||
+ | | ''Data'' || 64-bits of data to write. |
||
− | | ''W/H'' || Only for MIPS devices: <br> W: MIPS32 mode (Word) <br> H: MIPS16 mode (Half-word) |
||
− | |- |
||
− | | ''S/H'' || S: Force software BP <br> H: Force hardware BP |
||
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>W8 0x0 0x0011223344556677</tt> |
||
− | setBP 0x8000036 |
||
− | |||
− | == setPC == |
||
− | Sets the PC to the specified value. |
||
− | |||
− | '''Syntax'''<br> |
||
− | setpc <Addr> |
||
+ | === JTAGConf === |
||
+ | Configure JTAG scan chain with multiple devices on it.<br> |
||
+ | 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" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''IRPre'' || Sum of IRLens of all devices closer to TDO, where IRLen is the number of bits in the IR (Instruction Register) of one device.<br>-1 == auto-detection. |
||
− | | ''Addr'' || Address the PC should be set to. |
||
+ | |- |
||
+ | | ''DRPre'' || Number of devices closer to TDO.<br>-1 == auto-detection. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <source lang="c"> |
||
+ | // |
||
+ | // JTAG chain: TDI -> TAP#3 -> TAP#2 -> TAP#1 -> TAP#0 |
||
+ | // TAP#3 (ARM DAP): IRLen = 4-bit |
||
+ | // TAP#2 (RISC-V): IRLen = 5-bit |
||
+ | // TAP#1 (RISC-V): IRLen = 5-bit |
||
+ | // TAP#0 (custom): IRLen = 7-bit |
||
+ | // |
||
+ | Connect to TAP#1 (RISC-V): |
||
+ | JTAGConf 7 1 // IRPre = 7, DRPre = 1 |
||
+ | Connect to TAP#2 (RISC-V): |
||
− | '''Example'''<br> |
||
+ | JTAGConf 12 2 // IRPre = 7 + 5, DRPre = 1 + 1 |
||
− | setpc 0x59C |
||
+ | </source> |
||
− | |||
− | == SetTimeoutCmd == |
||
− | Set timeout in milliseconds for a specific command. |
||
− | |||
− | '''Note'''<br> |
||
− | Right now only stepover is supported |
||
+ | === JTAGId === |
||
− | '''Syntax'''<br> |
||
+ | Read JTAG Id. |
||
− | SetTimeoutCmd <Cmd> = <TimeoutMs> |
||
+ | ==== Short command ==== |
||
+ | <tt>I</tt> |
||
+ | === WJTAGIR === |
||
+ | Write JTAG command (IR). |
||
+ | If no IRLen is passed, IRLen=4 is used. |
||
+ | ==== Short command ==== |
||
+ | <tt>WJIR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WJTAGIR <Insturction(hex)> [<IRLen(dec)>]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Insturction'' || Insturction to send as hexadecimal value. |
|- |
|- |
||
+ | | ''IRLen'' || Instruction register length of the current selected device. |
||
− | | ''TimeoutMs'' || Timeout in milliseconds. |
||
|} |
|} |
||
+ | === WJTAGDR === |
||
− | '''Example'''<br> |
||
+ | Write JTAG data (DR). |
||
− | SetTimeoutCmd stepover = 5000 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>WJDR</tt> |
||
− | == setWP == |
||
+ | ==== Syntax ==== |
||
− | This command inserts a new watchpoint that matches the specified parameters. |
||
+ | <tt>WJTAGDR <Data64(hex)> <NumBits(dec)></tt> |
||
− | 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 |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Data64'' || Data to send. |
|- |
|- |
||
+ | | ''NumBits'' || Number of bits to send. |
||
− | | ''Accesstype'' || Specifies the control data on which data event has been set: <br> R: read access <br> W: write access |
||
+ | |} |
||
+ | |||
+ | === WJTAGRaw === |
||
+ | Write Raw JTAG data. |
||
+ | ==== Short command ==== |
||
+ | <tt>WJR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WJTAGRaw <NumBits(dec)> <TMS(hex)> <TDI(hex)></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | ''Size'' || Valid values: S8 | S16 | S32 <br> Specifies to monitor an n-bit access width at the selected address. |
||
|- |
|- |
||
+ | | ''NumBits'' || Number of bits to send. |
||
− | | ''Data'' || Specifies the Data on which watchpoint has been set. |
||
|- |
|- |
||
+ | | ''TMS'' || TMS Data to send (hex) in reverse bit order. |
||
− | | ''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. |
||
|- |
|- |
||
+ | | ''TDI'' || TDI Data to send (hex) in reverse bit order. |
||
− | | ''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. |
||
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | Execute SWD => JTAG switching sequence and read the IDCODE: |
||
− | setWP 0x20000000 W S8 0xFF |
||
+ | J-Link>wjr 88, 0x00FFE73CFFFFFFFFFFFFFF, 00000000000000000000000 // SWD=>JTAG Switching sequence |
||
+ | TDO: 0000000000000000000000 |
||
+ | J-Link>wjr 56, 0x30000000007003, 0x00000000000FE0 // Read IDCODE |
||
+ | TDO: 00974008EE0110 |
||
− | == |
+ | === ResetTAP === |
+ | Reset TAP Controller using state machine (111110). |
||
− | Waits the given time (in milliseconds). |
||
+ | ==== Short command ==== |
||
+ | <tt>RTAP</tt> |
||
+ | === ResetTRST === |
||
− | '''Syntax'''<br> |
||
+ | Reset TAP Controller using nTRST. |
||
− | sleep <Delay> |
||
+ | ==== Short command ==== |
||
+ | <tt>RT</tt> |
||
+ | === ICE === |
||
+ | Show state of the embedded ICE macrocell (ICE breaker). |
||
+ | |||
+ | === ReadICE === |
||
+ | Read Ice register. |
||
+ | ==== Short command ==== |
||
+ | <tt>RI</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>RI <RegIndex>(hex)</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Register index of register to read from. |
|} |
|} |
||
+ | === WriteICE === |
||
− | '''Example'''<br> |
||
+ | Write Ice register. |
||
− | sleep 200 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>WI</tt> |
||
− | == speed == |
||
+ | ==== Syntax ==== |
||
− | This command sets the speed for communication with the CPU core. |
||
+ | <tt>WI <RegIndex> <Data(hex)></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | speed <Freq>|auto|adaptive |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Register index of register to read from. |
|- |
|- |
||
− | | '' |
+ | | ''Data'' || Data to write (in hex). |
− | |- |
||
− | | ''adaptive'' || Selects adaptive clocking as JTAG speed. |
||
|} |
|} |
||
+ | === STraceStart === |
||
− | '''Example'''<br> |
||
+ | Starts STRACE. |
||
− | speed 4000 |
||
− | speed auto |
||
− | == |
+ | === STraceStop === |
+ | Stops STRACE. |
||
− | 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. |
||
+ | === STraceRead === |
||
+ | Reads collected STRACE data. |
||
+ | === SWOSpeed === |
||
− | '''Syntax'''<br> |
||
+ | Show supported SWO speeds. |
||
− | st |
||
− | == |
+ | === SWOStart === |
+ | Start SWO. |
||
− | Target needs to be halted before calling this command. |
||
− | Executes a single step on the target. |
||
− | The instruction is overstepped even if it is breakpointed. Prints out the disassembly of the instruction to be stepped. |
||
+ | === SWOStop === |
||
− | '''Syntax'''<br> |
||
+ | Stop SWO. |
||
− | step |
||
− | == |
+ | === SWOStat === |
+ | Display SWO status. |
||
− | 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. |
||
+ | === SWORead === |
||
− | '''Note'''<br> |
||
+ | Read and display SWO data. |
||
− | For more information see [[#SetTimeoutCmd | SetTimeoutCmd]] |
||
+ | === SWOShow === |
||
− | '''Syntax'''<br> |
||
+ | Read, analyze and show SWO data. |
||
− | stepover |
||
− | == |
+ | === SWOFlush === |
+ | Flush SWO data. |
||
− | This command unlocks a device which has been accidentally locked by malfunction of user software. |
||
+ | === SWOView === |
||
− | '''Syntax'''<br> |
||
+ | View SWO terminal data. |
||
− | unlock <DeviceName> |
||
+ | === 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. |
||
+ | By default, the device is being reset before starting the erase operation. This may be skipped by adding "noreset". |
||
+ | ==== Syntax ==== |
||
+ | <tt>Erase [<SAddr> <EAddr>] [<noreset | reset>]</tt> |
||
+ | ==== Examples ==== |
||
+ | <tt>Erase</tt><br> |
||
+ | <tt>Erase 0x60000000 0x60001000</tt><br> |
||
+ | <tt>Erase 0x60000000 0x60001000 noreset</tt><br> |
||
+ | <tt>Erase 0 0 noreset</tt> |
||
+ | |||
+ | === LoadFile === |
||
+ | Program a given data file. For .bin files, a location has to be specified. By default also performs a verification of programmed data. |
||
+ | Currently supported data files are: |
||
+ | * .bin |
||
+ | * .elf |
||
+ | * .hex |
||
+ | * .mot |
||
+ | * .s |
||
+ | * .s19 |
||
+ | * .s37 |
||
+ | * .srec |
||
+ | ==== Syntax ==== |
||
+ | <tt>LoadFile <FileName> [<Addr(.bin only)>] [<noreset | reset>]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''Filename'' || Source filename. |
||
− | | ''DeviceName'' || Name of the device family to unlock. Supported Devices: <br> LM3Sxxx <br> Kinetis <br> EFM32Gxxx |
||
+ | |- |
||
+ | | ''Addr'' || '''Only used for .bin files. Ignored for other formats.'''<br>Destination address. If not passed, 0x0 is assumed. |
||
+ | |- |
||
+ | | ''Reset'' || Used for setting the reset behaviour. "reset" used by default implicitly.<br>'''When Reset is used "Addr" is always required, but the value is ignored for non .bin files.''' |
||
|} |
|} |
||
+ | ==== Examples ==== |
||
+ | <tt>loadfile C:\Work\MyData.hex</tt><br> |
||
+ | <tt>loadfile C:\Work\MyData.bin 0x08000000</tt><br> |
||
+ | <tt>loadfile C:\Work\MyData.hex 0 noreset</tt><br> |
||
+ | <tt>loadfile C:\Work\MyData.bin 0x08000000 noreset</tt><br> |
||
+ | === SaveBin === |
||
− | Example |
||
+ | Save target memory range into binary file. |
||
− | unlock Kinetis |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>SaveBin <filename> <addr> <NumBytes></tt> |
||
− | == 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" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Filename'' || Destination file |
+ | |- |
||
+ | | ''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. |
||
− | usb |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>VerifyBin <filename> <addr></tt> |
||
− | == verifybin == |
||
− | Verifies if the specified binary is already in the target memory at the specified address. |
||
− | |||
− | '''Syntax'''<br> |
||
− | verifybin <Filename>, <Addr> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
Line 924: | Line 1,241: | ||
| ''Addr'' || Start address of memory to verify. |
| ''Addr'' || Start address of memory to verify. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>VerifyBin C:\Work\test.bin 0x0000000</tt> |
||
+ | === FWrite === |
||
− | '''Example'''<br> |
||
+ | On probes which support file I/O this command writes a specific file. |
||
− | verifybin C:\Work\test.bin 0x0000000 |
||
+ | 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, |
||
− | == VTREF == |
||
+ | using an appropriate offset when sending it the second time. Offset applies to both destination and source file. |
||
− | Sets a fixed value for VTref on J-Link. |
||
+ | ==== Short command ==== |
||
− | 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. |
||
+ | <tt>FWr</tt> |
||
− | Settings of fixed VTref apply nonvolatile after power cycling the probe. |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>FWrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt> |
||
− | '''Syntax'''<br> |
||
− | VTREF <ValuemV> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! 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 ==== |
||
+ | <tt>FWrite Flasher.dat C:\Project\Flasher.dat</tt> |
||
+ | === FRead === |
||
− | '''Example'''<br> |
||
+ | On probes which support file I/O this command reads a specific file. |
||
− | VTREF 3300 |
||
+ | Offset applies to both destination and source file. |
||
− | |||
+ | ==== Short command ==== |
||
− | '''Note'''<br> |
||
+ | <tt>FRd</tt> |
||
− | 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. |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>FRead <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt> |
||
− | == w1 == |
||
− | The command writes one single byte to the target system. |
||
− | |||
− | '''Syntax'''<br> |
||
− | w1 [<Zone>:]<Addr>, <Data> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! 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 ==== |
||
+ | <tt>FRead Flasher.dat C:\Project\Flasher.dat</tt> |
||
+ | === FShow === |
||
− | '''Example'''<br> |
||
+ | On probes which support file I/O this command reads and prints a specific file. |
||
− | w1 0x10, 0xFF |
||
+ | Currently, only Flasher models support file I/O. |
||
− | |||
− | == |
+ | ==== Syntax ==== |
+ | <tt>FShow <FileName> [-a] [<Offset> [<NumBytes>]]</tt> |
||
− | The command writes a unit of 16-bits to the target system. |
||
− | |||
− | '''Syntax'''<br> |
||
− | w2 [<Zone>:]<Addr>, <Data> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! 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. |
||
− | | ''Addr'' || Start address. |
||
|- |
|- |
||
− | | '' |
+ | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
+ | |- |
||
+ | | ''NumBytes'' || Maximum number of bytes to read. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>FShow Flasher.dat</tt> |
||
+ | === FDelete === |
||
− | '''Example'''<br> |
||
+ | On probes which support file I/O this command deletes a specific file. |
||
− | w2 0x0, 0xFFFF |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>FDel</tt> |
||
− | == w4 == |
||
+ | ==== Syntax ==== |
||
− | The command writes a unit of 32-bits to the target system. |
||
+ | <tt>fdelete <FileName></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | w4 [<Zone>:]<Addr>, <Data> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''FileName'' || File to delete from the Flasher. |
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>FDelete Flasher.dat</tt> |
||
+ | |||
+ | === 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 ==== |
||
+ | <tt>FSz</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>FSize <FileName></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | ''Addr'' || Start address. |
||
|- |
|- |
||
− | | '' |
+ | | ''FileName'' || Source file name to read from the Flasher. |
|} |
|} |
||
+ | === FList === |
||
− | '''Example'''<br> |
||
+ | On probes which support file I/O this command shows the directory tree of the Flasher. |
||
− | w4 0x0, 0xAABBCCFF |
||
− | == |
+ | === SecureArea === |
+ | On probes which support file I/O this command creates/removes a secure area on the probe. |
||
− | Disables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SecureArea <Operation></tt> |
||
+ | === PowerTrace === |
||
− | '''Syntax'''<br> |
||
+ | Perform power trace (not supported by all models). |
||
− | WebUSBDisable |
||
+ | ==== Syntax ==== |
||
+ | <tt>PowerTrace <LogFile> [<ChannelMask> <RefCountSel>]</tt> |
||
− | == |
+ | === TestWSpeed === |
+ | Measure download speed into target memory. |
||
− | Enables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestW</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestWSpeed [<Addr> [<Size>]]</tt> |
||
+ | === TestRSpeed === |
||
− | '''Syntax'''<br> |
||
+ | Measure upload speed from target memory. |
||
− | WebUSBEnable |
||
+ | ==== Short command ==== |
||
+ | <tt>TestR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestRSpeed [<Addr> [<Size>] [<NumBlocks>]]</tt> |
||
− | == |
+ | === TestCSpeed === |
+ | Measure CPU speed. |
||
− | 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. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestC</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestCSpeed [<RAMAddr>]</tt> |
||
+ | |||
+ | === TestNWSpeed === |
||
+ | Measure network download speed between the host and the probe.<br> |
||
+ | For a probe that is connected via USB, the USB download speed is measured.<br> |
||
+ | For a probe that is connected via TCP/IP, the TCP/IP download speed is measured. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestNW</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestNWSpeed [<NumBytes> [<NumReps>]]</tt> |
||
+ | === TestNRSpeed === |
||
− | '''Syntax'''<br> |
||
+ | Measure network upload speed between the probe and the host.<br> |
||
− | WriteAP <RegIndex>, <Data32Hex> |
||
+ | For a probe that is connected via USB, the USB upload speed is measured.<br> |
||
+ | For a probe that is connected via TCP/IP, the TCP/IP upload speed is measured. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestNR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestNRSpeed [<NumBytes> [<NumReps>]]</tt> |
||
+ | === MR === |
||
+ | Measure RTCK reaction time. |
||
+ | ==== Syntax ==== |
||
+ | <tt>mr [<RepCount>]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''RepCount'' || Number of times the test is repeated (Default: 1). |
− | |- |
||
− | | ''Data32Hex'' || Data to write |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>mr 3</tt> |
||
+ | === Clock === |
||
− | '''Example'''<br> |
||
+ | Output clock(s) on the TCK pin (J-Link pin 9). |
||
− | // |
||
+ | ==== Short command ==== |
||
− | // Select AHB-AP and configure it |
||
+ | <tt>C</tt> |
||
− | // |
||
+ | ==== Syntax ==== |
||
− | WriteDP 2, 0x00000000 // Select AP[0] (AHB-AP) bank 0 |
||
+ | <tt>Clock [NumClocks]</tt> |
||
− | WriteAP 4, 0x23000010 // Auto-increment, Private access, Access size: word} |
||
− | == |
+ | === Clock00 === |
+ | Output clock(s) on the TCK pin (J-Link pin 9), with TDI == 0 and TMS == 0. |
||
− | Writes a specific CSR (Control Status Register) on a RISC-V based target. |
||
+ | ==== Short command ==== |
||
+ | <tt>C00</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>Clock00 [NumClocks]</tt> |
||
+ | === ClrTCK === |
||
− | '''Note'''<br> |
||
+ | Clear TCK pin (J-Link pin 9). |
||
− | Writes to known CSRs (like X1) may not be written to HW directly but with the next g or s command. |
||
+ | ==== Short command ==== |
||
+ | <tt>TCK0</tt> |
||
+ | === SetTCK === |
||
− | '''Syntax'''<br> |
||
+ | Set TCK pin (J-Link pin 9). |
||
− | writecsr <RegIndex>, <Data>[,<RegSizeBytes>] |
||
+ | ==== Short command ==== |
||
+ | <tt>TCK1</tt> |
||
+ | === ClrTDI === |
||
− | {| class="wikitable" |
||
+ | Clear TDI pin (J-Link pin 5). |
||
− | |- |
||
+ | ==== Short command ==== |
||
− | ! Parameter !! Meaning |
||
+ | <tt>TDI0</tt> |
||
− | |- |
||
− | | ''RegIndex'' || Index of CSR register to write |
||
− | |- |
||
− | | ''Data'' || Data to write |
||
− | |- |
||
− | | ''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). |
||
− | |} |
||
+ | === SetTDI === |
||
− | '''Example'''<br> |
||
+ | Set TDI pin (J-Link pin 5). |
||
− | writecsr 0x1001, 0x11223344 |
||
+ | ==== Short command ==== |
||
− | or |
||
+ | <tt>TDI1</tt> |
||
− | writecsr 0x1001, 0x11223344, 8 |
||
− | == |
+ | === ClrTMS === |
+ | Clear TMS pin (J-Link pin 7). |
||
− | Writes to a CoreSight DP register. |
||
+ | ==== Short command ==== |
||
− | 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. |
||
+ | <tt>TMS0</tt> |
||
+ | === SetTMS === |
||
− | '''Syntax'''<br> |
||
+ | Set TMS pin (J-Link pin 7). |
||
− | WriteDP <RegIndex>, <Data32Hex> |
||
+ | ==== Short command ==== |
||
+ | <tt>TMS1</tt> |
||
+ | === ClrTRST === |
||
− | {| class="wikitable" |
||
+ | Clear TRST pin (J-Link pin 3). |
||
− | |- |
||
+ | ==== Short command ==== |
||
− | ! Parameter !! Meaning |
||
+ | <tt>TRST0</tt> |
||
− | |- |
||
− | | ''RegIndex'' || Index of DP register to write |
||
− | |- |
||
− | | ''Data32Hex'' || Data to write |
||
− | |} |
||
+ | === SetTRST === |
||
− | '''Example'''<br> |
||
+ | Set TRST pin (J-Link pin 3). |
||
− | // |
||
+ | ==== Short command ==== |
||
− | // Write DP SELECT register: Select AP 0 bank 15 |
||
+ | <tt>TRST1</tt> |
||
− | // |
||
− | WriteDP 2, 0x000000F0 |
||
− | == |
+ | === ClrRESET === |
+ | Clear RESET pin (J-Link pin 15). |
||
− | Writes into a register. The value is written into the register on CPU start. |
||
+ | ==== Short command ==== |
||
+ | <tt>R0</tt> |
||
+ | === SetRESET === |
||
− | '''Syntax'''<br> |
||
+ | Set RESET pin (J-Link pin 15). |
||
− | wreg <RegName>, <Data> |
||
+ | ==== Short command ==== |
||
+ | <tt>R1</tt> |
||
+ | == Command sequence examples == |
||
− | {| class="wikitable" |
||
+ | This section provides some examples for the [[#Commands | J-Link Commander Commands]] |
||
− | |- |
||
+ | === Reading from another MEM-AP === |
||
− | ! Parameter !! Meaning |
||
+ | This example shows how to read data via a MEM-AP. |
||
− | |- |
||
+ | ==== Assumptions ==== |
||
− | | ''RegName'' || Register to write to. |
||
+ | * MCU with a core AP & another AP for background memory access |
||
− | |- |
||
+ | * User wants to read data while the device is running, using background memory access. |
||
− | | ''Data'' || Data to write to the specified register. |
||
+ | * AP[0]: AHB-AP: CPU |
||
− | |} |
||
+ | * AP[1]: APB-AP: System AP (for background access) |
||
+ | ==== Commands used ==== |
||
+ | * [[#ReadAP | ReadAP]] |
||
+ | * [[#WriteAP | WriteAP]] |
||
+ | * [[#WriteDP | WriteDP]] |
||
+ | ==== Example sequence ==== |
||
+ | <source lang="c"> |
||
+ | WriteDP 2 0x01000000 // SELECT register: Select AP[1] bank 0 |
||
+ | WriteAP 0 0x80006012 // CSW register: DbgSwEnable: Enable, AddrInc: Increment, Size: 32 bits |
||
+ | WriteAP 1 0x00000000 // TAR register: Select address to start reading from |
||
+ | ReadAP 3 // DRW register: Read @0x0000_0000 |
||
+ | ReadAP 3 // DRW register: Read @0x0000_0004 |
||
+ | ... |
||
+ | </source> |
||
+ | |||
+ | == 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 | 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. |
||
+ | J-Link Command Files support C-Style comments. |
||
'''Example'''<br> |
'''Example'''<br> |
||
+ | JLink.exe -device STM32F103ZE -CommandFile C:\\CommandFile.jlink |
||
− | wreg R14, 0xFF |
||
+ | ''Contents of CommandFile.jlink:''<br> |
||
− | = Perform flash download = |
||
+ | si 1 // Select interface |
||
+ | speed 4000 // Select speed |
||
+ | /* Perform reset and halt */ |
||
+ | r |
||
+ | h |
||
+ | loadfile C:\firmware.bin 0x08000000 // Load data file |
||
+ | |||
+ | == Perform flash download == |
||
J-Link Commander allows to download data files of different types into the flash memory of the target systems. |
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 J-Link to the PC |
||
Line 1,120: | Line 1,522: | ||
[[File:JLinkCommander_FlashDownload.png]] |
[[File:JLinkCommander_FlashDownload.png]] |
||
+ | == Command line options == |
||
− | = Batch processing = |
||
+ | The table below describes the different command line options, which are supported by J-Link Commander: |
||
− | 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: |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Command line option !! Explanation |
! Command line option !! Explanation |
||
|- |
|- |
||
+ | !colspan="2"| Batch mode specific |
||
− | | -device <DeviceName> || Selects the target device. |
||
|- |
|- |
||
− | | - |
+ | | <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). |
||
|- |
|- |
||
− | | - |
+ | | <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/Nickname></tt> || Selects a specific J-Link (via its serial number) or nickname (available from V7.92d) 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> |
||
|} |
|} |
||
Example: |
Example: |
||
− | JLink.exe -device CC2538SF53 -if JTAG -speed 4000 -jtagconf -1,-1 -autoconnect 1 - |
+ | JLink.exe -device CC2538SF53 -if JTAG -speed 4000 -jtagconf -1,-1 -autoconnect 1 -CommandFile C:\Work\JLinkCommandFile.jlink |
+ | |||
+ | == Batch processing == |
||
+ | While J-Link Commander is mainly designed to be used in interactive mode (so the user manually enters commands), as a verification utility, it can also be automated.<br> |
||
+ | For this, a command file may be specified and passed via the [[#Command_line_options | -CommandFile command line parameter]] to J-Link Commander. |
||
+ | |||
+ | A command file is a simple file that contains 1 [[#Commands | command]] per line, as if they were entered manually in the terminal. |
||
+ | |||
+ | '''Example:''' |
||
+ | |||
+ | Call: |
||
+ | <source> |
||
+ | JLink.exe -CommandFile C:\Work\JLinkCommandFile.jlink |
||
+ | </source> |
||
+ | Command file contents: |
||
− | = JLink.exe return value = |
||
+ | <source> |
||
+ | device CC2538SF53 |
||
+ | si JTAG |
||
+ | speed 4000 |
||
+ | jtagconf -1,-1 |
||
+ | connect |
||
+ | </source> |
||
+ | |||
+ | == JLink.exe return value == |
||
The return value of the J-Link Commander application (JLink.exe) can be read out int the environment variable ERRORLEVEL. |
The return value of the J-Link Commander application (JLink.exe) can be read out int the environment variable ERRORLEVEL. |
||
Line 1,168: | Line 1,610: | ||
== 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,177: | Line 1,619: | ||
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 | RSetType command]]: |
||
+ | 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 [[Multiple J-Links at the same PC | 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: |
It is possible to have multiple J-Links connected to the PC at the same time (for more information, see [[Multiple J-Links at the same PC | 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 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 |
* 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 = |
+ | == 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: |
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 |
r |
||
Line 1,188: | Line 1,634: | ||
exec setcfiflash 0x64000000 - 0x64FFFFFF |
exec setcfiflash 0x64000000 - 0x64FFFFFF |
||
exec setworkram 0x20000000 - 0x2000FFFF |
exec setworkram 0x20000000 - 0x2000FFFF |
||
− | w4 0x40021014 |
+ | w4 0x40021014 0x00000114 // RCC_AHBENR, FSMC clock enable |
− | w4 0x40021018 |
+ | w4 0x40021018 0x000001FD // GPIOD~G clock enable |
− | w4 0x40011400 |
+ | w4 0x40011400 0xB4BB44BB // GPIOD low config, NOE, NWE => Output, NWAIT => Input |
− | w4 0x40011404 |
+ | w4 0x40011404 0xBBBBBBBB // GPIOD high config, A16-A18 |
− | w4 0x40011800 |
+ | w4 0x40011800 0xBBBBBBBB // GPIOE low config, A19-A23 |
− | w4 0x40011804 |
+ | w4 0x40011804 0xBBBBBBBB // GPIOE high config, D5-D12 |
− | w4 0x40011C00 |
+ | w4 0x40011C00 0x44BBBBBB // GPIOF low config, A0-A5 |
− | w4 0x40011C04 |
+ | w4 0x40011C04 0xBBBB4444 // GPIOF high config, A6-A9 |
− | w4 0x40012000 |
+ | w4 0x40012000 0x44BBBBBB // GPIOG low config, A10-A15 |
− | w4 0x40012004 |
+ | w4 0x40012004 0x444B4BB4 // GPIOG high config, NE2 => output |
− | w4 0xA0000008 |
+ | w4 0xA0000008 0x00001059 // CS control reg 2, 16-bit, write enable, Type: NOR flash |
− | w4 0xA000000C |
+ | w4 0xA000000C 0x10000505 // CS2 timing reg (read access) |
− | w4 0xA000010C |
+ | w4 0xA000010C 0x10000505 // CS2 timing reg (write access) |
speed 4000 |
speed 4000 |
||
− | mem 0x64000000 |
+ | mem 0x64000000 100 |
− | loadfile C:\STMB672_STM32F103ZE_TestBlinky.bin |
+ | loadfile C:\STMB672_STM32F103ZE_TestBlinky.bin 0x64000000 |
− | mem 0x64000000 |
+ | mem 0x64000000 100 |
− | = Command specifics = |
+ | == Command specifics == |
− | == Verifybin command == |
+ | === 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 " |
+ | 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 "loadfile" which may trigger a flash download implicitly where a flash loader is started that takes care of the initialization. |
− | Also note that executing a " |
+ | Also note that executing a "loadfile" command in advance, does not guarantee that a "verifybin" succeeds because the loadfile commands restores the controller state after it is done. So if the QSPI controller and/or pins were not initialized before the "loadfile" command, they are not after it either. They are only available while "loadfile" is active. |
Latest revision as of 12:04, 22 April 2024
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
- 1 Commands
- 1.1 ?
- 1.2 Exit
- 1.3 ExitOnError
- 1.4 Sleep
- 1.5 Log
- 1.6 ExpDevList
- 1.7 ExpDevListXML
- 1.8 USB
- 1.9 IP
- 1.10 SelectProbe
- 1.11 ShowEmuList
- 1.12 Power
- 1.13 VTREF
- 1.14 Reboot
- 1.15 Uptime
- 1.16 VCOM
- 1.17 ShowFWInfo
- 1.18 ShowHWStatus
- 1.19 License
- 1.20 IPAddr
- 1.21 GWAddr
- 1.22 DNSAddr
- 1.23 ShowConf
- 1.24 Calibrate
- 1.25 Connect
- 1.26 Device
- 1.27 SelectInterface
- 1.28 Speed
- 1.29 LE
- 1.30 BE
- 1.31 Halt
- 1.32 IsHalted
- 1.33 WaitHalt
- 1.34 Go
- 1.35 Reset
- 1.36 ResetX
- 1.37 RSetType
- 1.38 Step
- 1.39 IS
- 1.40 MS
- 1.41 Regs
- 1.42 RReg
- 1.43 WReg
- 1.44 MoE
- 1.45 SetBP
- 1.46 ClearBP
- 1.47 SetWP
- 1.48 ClearWP
- 1.49 VCatch
- 1.50 SetPC
- 1.51 ReadAP
- 1.52 WriteAP
- 1.53 ReadDP
- 1.54 WriteDP
- 1.55 RCP15Ex
- 1.56 WCP15Ex
- 1.57 Term
- 1.58 Mem
- 1.59 Mem8
- 1.60 Mem16
- 1.61 Mem32
- 1.62 Write1
- 1.63 Write2
- 1.64 Write4
- 1.65 Write8
- 1.66 JTAGConf
- 1.67 JTAGId
- 1.68 WJTAGIR
- 1.69 WJTAGDR
- 1.70 WJTAGRaw
- 1.71 ResetTAP
- 1.72 ResetTRST
- 1.73 ICE
- 1.74 ReadICE
- 1.75 WriteICE
- 1.76 STraceStart
- 1.77 STraceStop
- 1.78 STraceRead
- 1.79 SWOSpeed
- 1.80 SWOStart
- 1.81 SWOStop
- 1.82 SWOStat
- 1.83 SWORead
- 1.84 SWOShow
- 1.85 SWOFlush
- 1.86 SWOView
- 1.87 Erase
- 1.88 LoadFile
- 1.89 SaveBin
- 1.90 VerifyBin
- 1.91 FWrite
- 1.92 FRead
- 1.93 FShow
- 1.94 FDelete
- 1.95 FSize
- 1.96 FList
- 1.97 SecureArea
- 1.98 PowerTrace
- 1.99 TestWSpeed
- 1.100 TestRSpeed
- 1.101 TestCSpeed
- 1.102 TestNWSpeed
- 1.103 TestNRSpeed
- 1.104 MR
- 1.105 Clock
- 1.106 Clock00
- 1.107 ClrTCK
- 1.108 SetTCK
- 1.109 ClrTDI
- 1.110 SetTDI
- 1.111 ClrTMS
- 1.112 SetTMS
- 1.113 ClrTRST
- 1.114 SetTRST
- 1.115 ClrRESET
- 1.116 SetRESET
- 2 Command sequence examples
- 3 Using J-Link Command Files
- 4 Perform flash download
- 5 Command line options
- 6 Batch processing
- 7 JLink.exe return value
- 8 Using J-Link Command Strings
- 9 Changing J-Link Reset Strategy
- 10 Connecting to a specific J-Link
- 11 Setup External CFI NOR Flash
- 12 Command specifics
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.
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 |
Reboot | Reboot | Reboot the connected probe. |
Uptime | Uptime | Show Probe uptime since boot. |
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 |
Write8 | W8 | Write 64-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 |
STRACE | ||
STraceStart | STStart | Starts STRACE |
STraceStop | STStop | Stops STRACE |
STraceRead | STRead | Reads collected STRACE data |
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, SN or nickname (available from V7.92d) is passed.
Syntax
USB [<SN/Nickname>]
Parameter | Meaning |
---|---|
SN/Nickname | (optional) Serial number or nickname (available from V7.92d) of the J-Link to connect to. |
Example
USB 600100000
USB J-Link
USB "My J-Link"
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
Reboot
Reboot the connected probe and reconnect to it. If connection cannot be established in <Timeout>ms, an error is assumed.
Syntax
Reboot [<Timeout[ms]>]
Example
Reboot // Reboot with default timeout. Reboot 10000 // Reboot with 10 sec. timeout.
Uptime
Show current uptime of the connected Probe since boot.
Syntax
Uptime
Example
Uptime
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:
|
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
- See: Reading from another MEM-AP
- 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 |
Example
See: Reading from another MEM-AP
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
See: Reading from another MEM-AP
RCP15Ex
Read CP15 register.
Short command
RCE
Syntax
RCP15Ex <Op1> <CRn> <CRm> <Op2>
WCP15Ex
Write CP15 register.
Short command
WCE
Syntax
WCP15Ex <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
Write8
Write 64-bit items.
Supported since V7.86b
Short command
W8
Syntax
W8 [<Zone>:]<Addr> (hex)
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
Data | 64-bits of data to write. |
Example
W8 0x0 0x0011223344556677
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 TDO, where IRLen is the number of bits in the IR (Instruction Register) of one device. -1 == auto-detection. |
DRPre | Number of devices closer to TDO. -1 == auto-detection. |
Example
//
// JTAG chain: TDI -> TAP#3 -> TAP#2 -> TAP#1 -> TAP#0
// TAP#3 (ARM DAP): IRLen = 4-bit
// TAP#2 (RISC-V): IRLen = 5-bit
// TAP#1 (RISC-V): IRLen = 5-bit
// TAP#0 (custom): IRLen = 7-bit
//
Connect to TAP#1 (RISC-V):
JTAGConf 7 1 // IRPre = 7, DRPre = 1
Connect to TAP#2 (RISC-V):
JTAGConf 12 2 // IRPre = 7 + 5, DRPre = 1 + 1
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 <NumBits(dec)> <TMS(hex)> <TDI(hex)>
Parameter | Meaning |
---|---|
NumBits | Number of bits to send. |
TMS | TMS Data to send (hex) in reverse bit order. |
TDI | TDI Data to send (hex) in reverse bit order. |
Example
Execute SWD => JTAG switching sequence and read the IDCODE:
J-Link>wjr 88, 0x00FFE73CFFFFFFFFFFFFFF, 00000000000000000000000 // SWD=>JTAG Switching sequence TDO: 0000000000000000000000 J-Link>wjr 56, 0x30000000007003, 0x00000000000FE0 // Read IDCODE TDO: 00974008EE0110
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). |
STraceStart
Starts STRACE.
STraceStop
Stops STRACE.
STraceRead
Reads collected STRACE 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. By default, the device is being reset before starting the erase operation. This may be skipped by adding "noreset".
Syntax
Erase [<SAddr> <EAddr>] [<noreset | reset>]
Examples
Erase
Erase 0x60000000 0x60001000
Erase 0x60000000 0x60001000 noreset
Erase 0 0 noreset
LoadFile
Program a given data file. For .bin files, a location has to be specified. By default also performs a verification of programmed data. Currently supported data files are:
- .bin
- .elf
- .hex
- .mot
- .s
- .s19
- .s37
- .srec
Syntax
LoadFile <FileName> [<Addr(.bin only)>] [<noreset | reset>]
Parameter | Meaning |
---|---|
Filename | Source filename. |
Addr | Only used for .bin files. Ignored for other formats. Destination address. If not passed, 0x0 is assumed. |
Reset | Used for setting the reset behaviour. "reset" used by default implicitly. When Reset is used "Addr" is always required, but the value is ignored for non .bin files. |
Examples
loadfile C:\Work\MyData.hex
loadfile C:\Work\MyData.bin 0x08000000
loadfile C:\Work\MyData.hex 0 noreset
loadfile C:\Work\MyData.bin 0x08000000 noreset
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 between the host and the probe.
For a probe that is connected via USB, the USB download speed is measured.
For a probe that is connected via TCP/IP, the TCP/IP download speed is measured.
Short command
TestNW
Syntax
TestNWSpeed [<NumBytes> [<NumReps>]]
TestNRSpeed
Measure network upload speed between the probe and the host.
For a probe that is connected via USB, the USB upload speed is measured.
For a probe that is connected via TCP/IP, the TCP/IP upload speed is measured.
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
Command sequence examples
This section provides some examples for the J-Link Commander Commands
Reading from another MEM-AP
This example shows how to read data via a MEM-AP.
Assumptions
- MCU with a core AP & another AP for background memory access
- User wants to read data while the device is running, using background memory access.
- AP[0]: AHB-AP: CPU
- AP[1]: APB-AP: System AP (for background access)
Commands used
Example sequence
WriteDP 2 0x01000000 // SELECT register: Select AP[1] bank 0
WriteAP 0 0x80006012 // CSW register: DbgSwEnable: Enable, AddrInc: Increment, Size: 32 bits
WriteAP 1 0x00000000 // TAR register: Select address to start reading from
ReadAP 3 // DRW register: Read @0x0000_0000
ReadAP 3 // DRW register: Read @0x0000_0004
...
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. J-Link Command Files support C-Style comments.
Example
JLink.exe -device STM32F103ZE -CommandFile C:\\CommandFile.jlink
Contents of CommandFile.jlink:
si 1 // Select interface speed 4000 // Select speed /* Perform reset and halt */ r h loadfile C:\firmware.bin 0x08000000 // Load data file
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.
Command line options
The table below describes the different command line options, which are supported by J-Link Commander:
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/Nickname> | Selects a specific J-Link (via its serial number) or nickname (available from V7.92d) 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 -CommandFile C:\Work\JLinkCommandFile.jlink
Batch processing
While J-Link Commander is mainly designed to be used in interactive mode (so the user manually enters commands), as a verification utility, it can also be automated.
For this, a command file may be specified and passed via the -CommandFile command line parameter to J-Link Commander.
A command file is a simple file that contains 1 command per line, as if they were entered manually in the terminal.
Example:
Call:
JLink.exe -CommandFile C:\Work\JLinkCommandFile.jlink
Command file contents:
device CC2538SF53
si JTAG
speed 4000
jtagconf -1,-1
connect
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.
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 command:
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 "loadfile" which may trigger a flash download implicitly where a flash loader is started that takes care of the initialization. Also note that executing a "loadfile" command in advance, does not guarantee that a "verifybin" succeeds because the loadfile commands restores the controller state after it is done. So if the QSPI controller and/or pins were not initialized before the "loadfile" command, they are not after it either. They are only available while "loadfile" is active.