Difference between revisions of "J-Link Commander"
(→-USB) |
m |
||
(57 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
− | J-Link Commander (JLink.exe / JLinkExe) is a free, command line based utility that can be used for verifying proper functionality of J-Link as well as for simple analysis of the target system with J-Link. It supports some simple commands, such as memory dump, halt, step, go etc. to verify the target connection. The J-Link Commander is part of the [[J-Link Software and Documentation Pack]], which is available for download on the [https://www.segger.com/jlink- |
+ | [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/ J-Link SDK]. |
+ | 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- |
+ | <div class="toclimit-2"> |
__TOC__ |
__TOC__ |
||
</div> |
</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 |
|- |
|- |
||
− | | [[# |
+ | | [[#ExitOnError | ExitOnError]] || EoE || Exit on error |
− | |- |
||
− | | [[#erase | erase]] || Erase internal flash of selected device. |
||
− | |- |
||
− | | [[#exec | exec]] || Execute J-Link Command String. |
||
− | |- |
||
− | | [[#exit | exit]] (qc, q) || Closes J-Link Commander. |
||
|- |
|- |
||
+ | | [[#Sleep | Sleep]] || Sleep || Waits the given time (in milliseconds) |
||
− | | [[#exitonerror | exitonerror]] (eoe) || Commander exits after error. |
||
|- |
|- |
||
− | | [[# |
+ | | [[#Log | Log]] || Log || Enables log to file |
− | |- |
||
− | | [[#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. |
||
− | |- |
||
− | | [[#jtagconf | jtagconf]] || Configures a JTAG scan chain with multiple devices on it. |
||
− | |- |
||
− | | [[#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. |
||
− | |- |
||
− | | [[#setWP | setWP]] || Set watchpoint. |
||
− | |- |
||
− | | [[#si | si]] || Select a target interface. |
||
− | |- |
||
− | | [[#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. |
||
|- |
|- |
||
+ | | [[#ExpDevList | ExpDevList]] || ExpDevList || Export device names from DLL internal device list to text file |
||
− | ! colspan="2" | Flasher I/O |
||
|- |
|- |
||
+ | | [[#ExpDevListXML | ExpDevListXML]] || ExpDevListXML || Export device names from DLL internal device list to XML file |
||
− | | [[#fdelete | fdelete]] (fdel) || Delete file on emulator. |
||
|- |
|- |
||
+ | ! colspan="3" | Configuration - J-Link |
||
− | | [[#flist | flist]] || List directory on emulator. |
||
|- |
|- |
||
− | | [[# |
+ | | [[#USB | USB]] || USB || Connect to J-Link via USB |
|- |
|- |
||
− | | [[# |
+ | | [[#IP | IP]] || IP || Connect to J-Link via TCP/IP or to Remote Server |
|- |
|- |
||
+ | | [[#SelectProbe | SelectProbe]] || SelPrb || Show list of all connected probes via specified interface. The Probe to communicate with can then be selected |
||
− | | [[#fsize | fsize]] (fsz) || Display size of file on emulator. |
||
|- |
|- |
||
+ | | [[#ShowEmuList | ShowEmuList]] || ShowEmuList || Show list of all connected probes via specified interface |
||
− | | [[#fwrite | fwrite]] (fwr) || Write file to emulator. |
||
|- |
|- |
||
+ | | [[#Power | Power]] || Power || Switch power supply for target (5V-Supply pin) on or off |
||
− | ! colspan="2" | Connection to J-Link |
||
|- |
|- |
||
+ | | [[#VTREF | VTREF]] || VTREF || Set fixed value for VTref on J-Link |
||
− | | [[#ip | ip]] || Connect to J-Link Pro via TCP/IP. |
||
|- |
|- |
||
+ | | [[#VCOM | VCOM]] || VCOM || Enable/disable VCOM Takes effect after power cycle of the probe |
||
− | | [[#usb | usb]] || Connect to J-Link via USB. |
||
|- |
|- |
||
+ | | [[#Reboot | Reboot]] || Reboot || Reboot the connected probe. |
||
− | ! colspan="2" | Configuration |
||
|- |
|- |
||
− | | [[# |
+ | | [[#Uptime | Uptime]] || Uptime || Show Probe uptime since boot. |
|- |
|- |
||
− | | [[# |
+ | | [[#ShowFWInfo | ShowFWInfo]] || F || Show firmware info |
|- |
|- |
||
+ | | [[#ShowHWStatus | ShowHWStatus]] || St || Show hardware status |
||
− | | [[#WebUSBDisable | WebUSBDisable]] || Disables WebUSB on J-Link. |
||
|- |
|- |
||
+ | | [[#License | License]] || License || Show list of all available license commands |
||
− | | [[#WebUSBEnable | WebUSBEnable]] || Enables WebUSB on J-Link. |
||
|- |
|- |
||
+ | | [[#IPAddr | IPAddr]] || IPAddr || Show/Assign IP address and subnetmask of/to connected Probe |
||
− | |} |
||
− | |||
− | === Detailed description === |
||
− | Following is a detailed description with syntax explaination and examples of the commands listed above. |
||
− | |||
− | ==== clrBP ==== |
||
− | This command removes a breakpoint set by J-Link. |
||
− | |||
− | '''Syntax'''<br> |
||
− | clrBP <BP_Handle> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#GWAddr | GWAddr]] || GWAddr || Show/Assign network gateway address of/to connected Probe |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#DNSAddr | DNSAddr]] || DNSAddr || Show/Assign network DNS server address of/to connected Probe |
||
− | | ''BP_Handle'' || Handle of breakpoint to be removed. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | clrBP 1 |
||
− | |||
− | ==== clrWP ==== |
||
− | This command removes a watchpoint set by J-Link. |
||
− | |||
− | '''Syntax'''<br> |
||
− | clrWP <WP_Handle> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#ShowConf | ShowConf]] || Conf || Show configuration of the connected Probe |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#Calibrate | Calibrate]] || Calib || Calibrate the target current measurement |
||
− | | ''WP_Handle'' || Handle of watchpoint to be removed. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | clrWP 0x2 |
||
− | |||
− | ==== connect ==== |
||
− | This command establishes a connection between J-Link and target. |
||
− | |||
− | '''Note'''<br> |
||
− | If not set already, this command will prompt the user for settings which are needed in order to connect to the target. |
||
− | |||
− | '''Syntax'''<br> |
||
− | connect |
||
− | |||
− | ==== device ==== |
||
− | Selects a specific device J-Link shall connect to and performs a reconnect. |
||
− | In most cases explicit selection of the device is not necessary. |
||
− | Selecting a device enables the user to make use of the J-Link flash programming functionality as well as using unlimited breakpoints in flash memory. |
||
− | For some devices explicit device selection is mandatory in order to allow the DLL to perform special handling needed by the device. |
||
− | Some commands require that a device is set prior to use them. |
||
− | |||
− | '''Syntax'''<br> |
||
− | device <DeviceName> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | ! colspan="3" | Configuration - Target (CPU) |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#Connect | Connect]] || Con || Connect to target device |
||
− | | ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows a device selection dialog. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | device stm32f407ig |
||
− | |||
− | ==== erase ==== |
||
− | Erases all flash sectors of the current device. A device has to be specified previously. |
||
− | |||
− | '''Syntax'''<br> |
||
− | erase |
||
− | |||
− | ==== exec ==== |
||
− | Execute J-Link Command String. For more information about the usage of J-Link Command Strings please refer to J-Link Command Strings. |
||
− | |||
− | '''Syntax'''<br> |
||
− | exec <Command> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#Device | Device]] || Device || Select specific device J-Link shall connect to |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#SelectInterface | SelectInterface]] || SI || Select target interface |
||
− | | ''Command'' || J-Link Command String to be executed. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | exec SupplyPower = 1 |
||
− | |||
− | ==== exit ==== |
||
− | This command closes the target connection, the connection to the J-Link and exits J-Link Commander. |
||
− | |||
− | '''Syntax'''<br> |
||
− | q |
||
− | |||
− | ==== exitonerror ==== |
||
− | This command toggles whether J-Link Commander exits on error or not. |
||
− | |||
− | '''Syntax'''<br> |
||
− | ExitOnError <1|0> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#Speed | Speed]] || Speed || Set target interface speed |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#LE | LE]] || LE || Change mode to little endian |
||
− | | ''1/0'' || 1: J-Link Commander will now exit on Error. <br> 0: J-Link Commander will no longer exit on Error. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | eoe 1 |
||
− | |||
− | ==== f ==== |
||
− | Prints firmware and hardware version info. Please notice that minor hardware revisions may not be displayed, as they do not have any effect on the feature set. |
||
− | |||
− | '''Syntax'''<br> |
||
− | f |
||
− | |||
− | ==== fdelete ==== |
||
− | On emulators which support file I/O this command deletes a specific file. |
||
− | |||
− | '''Syntax'''<br> |
||
− | fdelete <FileName> |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#BE | BE]] || BE || Change mode to big endian |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | ! colspan="3" | Debugging |
||
− | | ''FileName'' || File to delete from the Flasher. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | fdelete Flasher.dat |
||
− | |||
− | ==== flist ==== |
||
− | On emulators which support file I/O this command shows the directory tree of the Flasher. |
||
− | |||
− | '''Syntax'''<br> |
||
− | flist |
||
− | |||
− | ==== fread ==== |
||
− | On emulators which support file I/O this command reads a specific file. |
||
− | Offset applies to both destination and source file. |
||
− | |||
− | '''Syntax'''<br> |
||
− | fread <EmuFile> <HostFile> [<Offset> [<NumBytes>]] |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#Halt | Halt]] || H || Halt CPU |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#IsHalted | IsHalted]] || IH || Return current CPU state |
||
− | | ''EmuFile'' || File name to read from. |
||
|- |
|- |
||
+ | | [[#WaitHalt | WaitHalt]] || WH || Wait until CPU is halted or timeout is reached |
||
− | | ''HostFile'' || Destination file on the host. |
||
|- |
|- |
||
+ | | [[#Go | Go]] || G || Start CPU if halted |
||
− | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
||
|- |
|- |
||
+ | | [[#Reset | Reset]] || R || Reset CPU |
||
− | | ''NumBytes'' || Maximum number of bytes to read. |
||
− | |} |
||
− | |||
− | '''Example'''<br> |
||
− | fread Flasher.dat C:\Project\Flasher.dat |
||
− | |||
− | ==== fshow ==== |
||
− | On emulators which support file I/O this command reads and prints a specific file. |
||
− | Currently, only Flasher models support file I/O. |
||
− | |||
− | '''Syntax'''<br> |
||
− | fshow <FileName> [-a] [<Offset> [<NumBytes>]] |
||
− | |||
− | {| class="wikitable" |
||
|- |
|- |
||
+ | | [[#ResetX | ResetX]] || RX || Reset CPU with delay after reset |
||
− | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | [[#RSetType | RSetType]] || Rst || Set the current reset type |
||
− | | ''FileName'' || Source file name to read from the Flasher. |
||
|- |
|- |
||
+ | | [[#Step | Step]] || S || Execute step(s) on the CPU |
||
− | | ''a'' || If set, Input will be parsed as text instead of being shown as hex. |
||
|- |
|- |
||
+ | | [[#IS | IS]] || IS || Identify length of scan chain select register |
||
− | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
||
+ | |- |
||
+ | | [[#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 |
||
|- |
|- |
||
− | | ''NumBytes'' || Maximum number of bytes to read. |
||
|} |
|} |
||
+ | === ? === |
||
− | '''Example'''<br> |
||
+ | Show information about all commands or one specific command. |
||
− | fshow Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>? [<Command>]</tt> |
||
− | ==== fsize ==== |
||
− | On emulators which support file I/O this command gets the size of a specific file. |
||
− | Currently, only Flasher models support file I/O. |
||
− | |||
− | '''Syntax'''<br> |
||
− | fsize <FileName>] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''<Command>'' || (optional) Command, specific information is required for. |
||
− | | ''FileName'' || Source file name to read from the Flasher. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>? Connect</tt> |
||
+ | === Exit === |
||
− | '''Example'''<br> |
||
+ | Close target device connection, J-Link connection and closes the application. |
||
− | fsize Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Exit</tt> |
||
− | ==== fwrite ==== |
||
− | On emulators which support file I/O this command writes a specific file. |
||
− | Currently, only Flasher models support file I/O. NumBytes is limited to 512 bytes at once. |
||
− | This means, if you want to write e.g. 1024 bytes, you have to send the command twice, |
||
− | using an appropriate offset when sending it the second time. Offset applies to both destination and source file. |
||
− | |||
− | '''Syntax'''<br> |
||
− | fwrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]] |
||
+ | === ExitOnError === |
||
+ | Toggle exit J-Link Commander on error. |
||
+ | ==== Short command ==== |
||
+ | <tt>EoE</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>EoE <1/0></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''0'' || Exit on error is off. |
|- |
|- |
||
− | | '' |
+ | | ''1'' || Exit on error is on. |
− | |- |
||
− | | ''Offset'' || Specifies the offset in the file, at which data writing is started. |
||
− | |- |
||
− | | ''NumBytes'' || Maximum number of bytes to write. |
||
|} |
|} |
||
+ | === Sleep === |
||
− | '''Example'''<br> |
||
+ | Waits the given time. Usually used for J-Link Command Scripts. |
||
− | fwrite Flasher.dat C:\Project\Flasher.dat |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Sleep <Delay></tt> |
||
− | ==== go ==== |
||
− | Starts the CPU. In order to avoid setting breakpoints it allows to define a maximum number of instructions which can be simulated/emulated. |
||
− | This is particularly useful when the program is located in flash and flash breakpoints are used. Simulating instructions avoids to reprogram the flash and speeds up (single) stepping. |
||
− | |||
− | '''Syntax'''<br> |
||
− | go [<NumSteps> [<Flags>]] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | Delay || Amount of time to sleep in ms. |
||
− | | ''NumSteps'' || Maximum number of instructions allowed to be simulated. <br> Instruction simulation stops whenever a breakpointed instruction is hit, an instruction which cannot be simulated/emulated is hit or when NumSteps is reached. |
||
|- |
|- |
||
− | | ''Flags'' || 0: Do not start the CPU if a BP is in range of NumSteps <br> 1: Overstep BPs |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Sleep 100</tt> |
||
+ | === Log === |
||
− | '''Example'''<br> |
||
+ | Enables log to file. |
||
− | go //Simply starts the CPU |
||
+ | ==== Syntax ==== |
||
− | go 20, 1 |
||
+ | <tt>Log <filename></tt> |
||
− | |||
− | ==== halt ==== |
||
− | Halts the CPU Core. If successful, shows the current CPU registers. |
||
− | |||
− | '''Syntax'''<br> |
||
− | halt |
||
− | |||
− | ==== hwinfo ==== |
||
− | This command can be used to get information about the power consumption of the target (if the target is powered via J-Link). It also gives the information if an overcurrent happened. |
||
− | |||
− | '''Syntax'''<br> |
||
− | hwinfo |
||
− | |||
− | ==== ip ==== |
||
− | Closes any existing connection to J-Link and opens a new one via TCP/IP. If no IP Address is specified, the Emulator selection dialog shows up. |
||
− | |||
− | '''Syntax'''<br> |
||
− | ip [<Addr>] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Filename'' || Log filename |
||
− | | ''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>Log "C:\Users\User\Desktop\MyLogFile.log"</tt> |
||
+ | === ExpDevList === |
||
− | '''Example'''<br> |
||
+ | Export device names from DLL internal device list to text file. |
||
− | ip 192.168.6.3 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>ExpDevList <Filename></tt> |
||
− | ==== is ==== |
||
− | This command returns information about the length of the scan chain select register. |
||
− | |||
− | '''Syntax'''<br> |
||
− | is |
||
− | |||
− | ==== jtagconf ==== |
||
− | Configures a 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]]. |
||
− | |||
− | '''Syntax'''<br> |
||
− | jtagconf <IRPre>, <DRPre> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Filename'' || Path to text file destination. |
||
− | | ''IRPre'' || Sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device. |
||
− | |- |
||
− | | ''DRPre'' || Number of devices closer to TDI. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>ExpDevList "C:\Users\User\Desktop\JLinkSuppDev.txt"</tt> |
||
+ | === ExpDevListXML === |
||
− | '''Example'''<br> |
||
− | + | Export device names from DLL internal device list to XML file. |
|
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>ExpDevListXML <Filename></tt> |
||
− | ==== loadfile ==== |
||
− | This command programs a given data file to a specified destination address. Currently supported data files are: |
||
− | * *.mot |
||
− | * *.srec |
||
− | * *.s19 |
||
− | * *.s |
||
− | * *.hex |
||
− | * *.bin |
||
− | |||
− | '''Syntax'''<br> |
||
− | loadfile <Filename> [<Addr>] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | ''Filename'' || |
+ | | ''Filename'' || Path to XML file destination. |
− | |- |
||
− | | ''Addr'' || Destination address. If not passed, 0x0 is assumed. '''Only used for .bin files. Ignored for other formats.''' |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>ExpDevListXML "C:\Users\User\Desktop\JLinkSuppDev.xml"</tt> |
||
+ | === USB === |
||
− | '''Example'''<br> |
||
+ | Connect to J-Link via USB. Opens the USB selection dialog if no port, SN or nickname (available from V7.92d) is passed. |
||
− | loadfile C:\Work\test.bin 0x20000000 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>USB [<SN/Nickname>]</tt> |
||
− | ==== log ==== |
||
− | Set path to logfile allowing the DLL to output logging information. If the logfile already exists, the contents of the current logfile will be overwritten. |
||
− | |||
− | '''Syntax'''<br> |
||
− | log <Filename> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''SN/Nickname'' || (optional) Serial number or nickname (available from V7.92d) of the J-Link to connect to. |
||
− | | ''Filename'' || Log filename |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>USB 600100000</tt><br> |
||
+ | <tt>USB J-Link</tt><br> |
||
+ | <tt>USB "My J-Link"</tt><br> |
||
+ | === IP === |
||
− | '''Example'''<br> |
||
+ | Connect to J-Link via TCP/IP or to Remote Server. |
||
− | log C:\Work\log.txt |
||
+ | Opens the IP selection dialog if no parameter is passed. |
||
− | |||
− | ==== |
+ | ==== Syntax ==== |
+ | <tt>IP [<IPAddr|RemoteServerString>]</tt> |
||
− | The command reads memory from the target system. If necessary, the target CPU is halted in order to read memory. Zone names will be displayed on first connect to target with J-Link commander if available. |
||
− | |||
− | '''Syntax'''<br> |
||
− | mem [<Zone>:]<Addr>, <NumBytes> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''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. |
||
− | | ''Addr'' || Start address. |
||
− | |- |
||
− | | ''Numbytes'' || Number of bytes to read. Maximum is 0x100000. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>IP tunnel:SomeTestName::jlink-europe.segger.com</tt> |
||
+ | === SelectProbe === |
||
− | '''Example'''<br> |
||
+ | Show list of all connected probes via specified interface. |
||
− | mem 0x0, 0x100 |
||
+ | The Probe to communicate with can then be selected. |
||
− | or |
||
+ | ==== Short command ==== |
||
− | mem AHB-AP (AP1):0x20000000, 0x100 |
||
+ | <tt>SelPrb</tt> |
||
− | |||
− | ==== |
+ | ==== Syntax ==== |
+ | <tt>SelectProbe [<Interface0> <Interface1> ...]</tt> |
||
− | The command reads memory from the target system in units of bytes. If necessary, the target CPU is halted in order to read memory. |
||
− | |||
− | '''Syntax'''<br> |
||
− | mem [<Zone>:]<Addr>, <NumBytes> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP). |
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>SelectProbe USB IP</tt> |
||
+ | |||
+ | === ShowEmuList === |
||
+ | Show list of all connected probes via specified interface (e.g. USB/IP) |
||
+ | ==== Syntax ==== |
||
+ | <tt>ShowEmuList [<Interface0> <Interface1> ...]</tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
− | + | ! Parameter !! Meaning |
|
|- |
|- |
||
+ | | ''Interface'' || (optional) Interface, J-Links are supposed to be located at (USB, IP). |
||
− | | ''Numbytes'' || Number of bytes to read. Maximum is 0x100000. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>ShowEmuList USB IP</tt> |
||
+ | === Power === |
||
− | '''Example'''<br> |
||
+ | Switch power supply for target (J-Link pin 19, 5V-Supply) on or off, permanently or until next power-cycle. |
||
− | mem8 0, 100 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Power <State> [perm]</tt> |
||
− | ==== mem16 ==== |
||
− | The command reads memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory. |
||
− | |||
− | '''Syntax'''<br> |
||
− | mem [<Zone>:]<Addr>, <NumItems> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''State'' || On: Power supply on.<br>Off: Power supply off. |
|- |
|- |
||
− | | '' |
+ | | ''perm'' || Sets the specified State value as default. |
− | |- |
||
− | | ''NumItems'' || Number of halfwords to read. Maximum is 0x80000. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Power on</tt> |
||
+ | === VTREF === |
||
− | '''Example'''<br> |
||
+ | Set fixed value for VTref on J-Link (0 == Auto detection). |
||
− | mem16 0, 100 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>VTREF <Value[mV]></tt> |
||
− | ==== mem32 ==== |
||
− | The command reads memory from the target system in units of 32-bits. If necessary, the target CPU is halted in order to read memory. |
||
− | |||
− | '''Syntax'''<br> |
||
− | mem [<Zone>:]<Addr>, <NumItems> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter !! Meaning |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Value[mV]'' || Value, VTref is supposed to be set to in millivolt. |
− | |- |
||
− | | ''Addr'' || Start address. |
||
− | |- |
||
− | | ''NumItems'' || Number of words to read. Maximum is 0x40000. |
||
|} |
|} |
||
+ | ==== 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. |
||
− | mem32 0, 100 |
||
+ | ==== 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. |
||
+ | ==== Syntax ==== |
||
+ | <tt>Uptime</tt> |
||
+ | ==== Example ==== |
||
+ | <tt>Uptime</tt> |
||
+ | |||
+ | === VCOM === |
||
+ | Enable/disable VCOM. Takes effect after power cycle of the Probe. |
||
+ | ==== Syntax ==== |
||
+ | <tt>VCOM <enable|disable></tt> |
||
+ | ==== Example ==== |
||
+ | <tt>VCOM enable</tt> |
||
− | + | === ShowFWInfo === |
|
+ | Show firmware info. |
||
− | The command reads memory from the target system in units of 64-bits. If necessary, the target CPU is halted in order to read memory. |
||
+ | ==== Short command ==== |
||
+ | <tt>F</tt> |
||
+ | === ShowHWStatus === |
||
− | '''Syntax'''<br> |
||
+ | Show hardware status. |
||
− | mem [<Zone>:]<Addr>, <NumItems> (hex) |
||
+ | ==== Short command ==== |
||
+ | <tt>St</tt> |
||
+ | === License === |
||
+ | Execute license command. if no command is passed: |
||
+ | Show a list of all available license commands. |
||
+ | ==== Syntax ==== |
||
+ | <tt>License [Command]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! 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. |
||
− | | ''NumItems'' || Number ofdouble words to read. Maximum is 0x20000. |
||
|} |
|} |
||
+ | === IPAddr === |
||
− | '''Example'''<br> |
||
+ | Show/Assign IP address and subnetmask of/to connected Probe. |
||
− | mem64 0, 100 |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>IPAddr</tt> |
||
+ | |||
+ | === GWAddr === |
||
+ | Show/Assign network gateway address of/to connected Probe. |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>GWAddr</tt> |
||
+ | |||
+ | === DNSAddr === |
||
+ | Show/Assign network DNS server address of/to connected Probe. |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>DNSAddr</tt> |
||
− | + | === ShowConf === |
|
+ | Show configuration of the connected Probe. |
||
− | Measure reaction time of RTCK pin. |
||
+ | ==== Short command ==== |
||
+ | <tt>Conf</tt> |
||
+ | === Calibrate === |
||
− | '''Syntax'''<br> |
||
+ | Calibrate the target current measurement. |
||
− | mr [<RepCount>] |
||
+ | ==== Short command ==== |
||
+ | <tt>Calib</tt> |
||
+ | === 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 ==== |
||
+ | <tt>Con</tt> |
||
+ | |||
+ | === Device === |
||
+ | Select specific device J-Link shall connect to. |
||
+ | If ? is passed: Show device selection dialog. |
||
+ | ==== Syntax ==== |
||
+ | <tt>Device <DeviceName></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''DeviceName'' || Valid device name: Device is selected. <br> ?: Shows device selection dialog. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Device STM32F407VE</tt> |
||
+ | === SelectInterface === |
||
− | '''Example'''<br> |
||
+ | Select target interface. |
||
− | mr 3 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>SI</tt> |
||
− | ==== ms ==== |
||
+ | ==== Syntax ==== |
||
− | Measures the number of bits in the specified scan chain. |
||
+ | <tt>SelectInterface <Interface></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | ms <ScanChain> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Interface'' || Any supported target interface (e.g SWD, JTAG, ICSP, FINE, ...) |
||
− | | ''ScanChain'' || Scan chain to be measured. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>SelectInterface SWD</tt> |
||
+ | === Speed === |
||
− | '''Example'''<br> |
||
+ | Set target interface speed. |
||
− | ms 1 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>Speed <Setting></tt> |
||
− | ==== power ==== |
||
− | This command sets the status of the power supply over pin 19 of the JTAG connector. The KS(Kickstart) versions of J-Link have the 5V supply over pin 19 activated by default. This feature is useful for some targets that can be powered over the JTAG connector. |
||
− | |||
− | '''Syntax''': |
||
− | power <State> [perm] |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Setting'' || Decimal value: Interface speed in kHz.<br>auto: Interface speed is selected automatically.<br>adaptive: Interface speed is set to adaptive. |
||
− | | ''State'' || Valid values: On, Off |
||
− | |- |
||
− | | ''perm'' || Sets the specified State value as default. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Speed 4000</tt> |
||
+ | === LE === |
||
− | '''Example'''<br> |
||
+ | Change mode to little endian. |
||
− | power on perm |
||
− | + | === BE === |
|
+ | Change mode to big endian. |
||
− | Resets and halts the target. |
||
+ | === Halt === |
||
− | '''Syntax'''<br> |
||
+ | Halt CPU. |
||
− | r |
||
+ | ==== Short command ==== |
||
+ | <tt>H</tt> |
||
− | + | === IsHalted === |
|
+ | Return current CPU state. |
||
− | Reads from a CoreSight AP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG) this command performs the additional dummy read request automatically. |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>IH</tt> |
||
− | '''Syntax'''<br> |
||
− | ReadAP <RegIndex> |
||
+ | === 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. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>WaitHalt 100</tt></tt> |
||
+ | === Go === |
||
− | '''Example'''<br> |
||
+ | Start CPU if halted. |
||
− | // |
||
+ | ==== Short command ==== |
||
− | // Read AP[0], IDR (register 3, bank 15) |
||
+ | <tt>G</tt> |
||
− | // |
||
− | WriteDP 2, 0x000000F0 // Select AP[0] bank 15 |
||
− | ReadAP 3 // Read AP[0] IDR |
||
− | |||
− | ==== readcsr ==== |
||
− | Reads a specific CSR (Control Status Register) on a RISC-V based target. |
||
+ | === Reset === |
||
− | '''Syntax'''<br> |
||
+ | Reset CPU. |
||
− | readcsr <RegIndex>[,<RegSizeBytes>] |
||
+ | ==== Short command ==== |
||
+ | <tt>R</tt> |
||
+ | === ResetX === |
||
+ | Reset CPU with delay after reset. This function is useful for some target devices which already contain an application or a boot loader and therefore need some time before the core is stopped, |
||
+ | for example to initialize hardware, the memory management unit (MMU) or the external bus interface. |
||
+ | ==== Short command ==== |
||
+ | <tt>RX</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>ResetX <DelayAfterReset></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''DelayAfterReset'' || Delay in ms. |
− | |- |
||
− | | ''RegSizeBytes'' || Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64). |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>RX 1000</tt> |
||
+ | === RSetType === |
||
− | '''Example'''<br> |
||
+ | Set the current reset type. |
||
− | readcsr 0x300 |
||
+ | ==== Short command ==== |
||
− | or |
||
+ | <tt>Rst</tt> |
||
− | readcsr 0x300, 8 |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>RSetType [<Type>]</tt> |
||
− | ==== readDP ==== |
||
− | Reads from a CoreSight DP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. In case actual read data is returned on the next read request (this is the case for example with interface JTAG) this command performs the additional dummy read request automatically. |
||
− | |||
− | '''Syntax'''<br> |
||
− | ReadDP <RegIndex> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''Type'' || Desired reset type. If no type is provided, a list of all available types is printed. |
||
− | | ''RegIndex'' || Index of DP register to read |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>RSetType 0</tt> |
||
+ | === Step === |
||
− | '''Example'''<br> |
||
+ | Execute step(s) on the CPU and show the executed instructions. |
||
− | // |
||
+ | If no number of steps is provided, one step is executed. |
||
− | // Read DP-CtrlStat |
||
+ | ==== Short command ==== |
||
− | // |
||
+ | <tt>S</tt> |
||
− | ReadDP 1 |
||
+ | ==== Syntax ==== |
||
+ | <tt>Step [<NumSteps> (decimal)]</tt> |
||
+ | ==== Example ==== |
||
+ | <tt>Step 10</tt> |
||
− | + | === IS === |
|
+ | Identify length of scan chain select register. |
||
− | 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> |
||
+ | === MS === |
||
+ | Measure length of scan chain. |
||
+ | ==== Syntax ==== |
||
+ | <!-- FF xxx improve syntax!! --> |
||
+ | <tt>MS <ScanChain></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''ScanChain'' || Scan chain to be measured. |
|} |
|} |
||
+ | === Regs === |
||
− | '''Example'''<br> |
||
+ | Display CPU register contents. |
||
− | rreg 15 |
||
− | |||
− | ==== rx ==== |
||
− | Resets and halts the target. It is possible to define a delay in milliseconds after reset. This function is useful for some target devices which already contain an application or a boot loader and therefore need some time before the core is stopped, for example to initialize hardware, the memory management unit (MMU) or the external bus interface. |
||
− | |||
− | '''Syntax'''<br> |
||
− | rx <DelayAfterReset> |
||
+ | === RReg === |
||
+ | Read register. |
||
+ | If no register name is passed, all available register names are printed. |
||
+ | ==== Syntax ==== |
||
+ | <tt>RReg <RegName></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Register to read. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>RReg "R15 (PC)"</tt> |
||
+ | === WReg === |
||
− | '''Example'''<br> |
||
+ | Write register. |
||
− | rx 10 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>WReg</tt> |
||
− | ==== savebin ==== |
||
+ | ==== Syntax ==== |
||
− | Saves target memory into binary file. |
||
+ | <tt>WReg <RegName> <Value></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | savebin <Filename>, <Addr>, <NumBytes> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegName'' || Register to write to. |
|- |
|- |
||
− | | '' |
+ | | ''Data'' || Data to write to the specified register. |
− | |- |
||
− | | ''NumBytes'' || Number of bytes to read. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>WReg "R15 (PC)" 0x20000000</tt> |
||
+ | === MoE === |
||
− | '''Example'''<br> |
||
+ | Shows mode-of-entry (Reason why CPU is halted). |
||
− | savebin C:\Work\test.bin 0x0000000 0x100 |
||
− | |||
− | ==== setBP ==== |
||
− | This command sets a breakpoint of a specific type at a specified address. Which breakpoint modes are available depends on the CPU that is used. |
||
− | |||
− | '''Syntax'''<br> |
||
− | setBP <Addr> [[A/T]/[W/H]] [S/H] |
||
+ | === SetBP === |
||
+ | Set breakpoint. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SetBP <addr> [<A/T>/<W/H>] [S/H]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
Line 790: | Line 729: | ||
|} |
|} |
||
+ | === ClearBP === |
||
− | '''Example'''<br> |
||
+ | Clear breakpoint. |
||
− | setBP 0x8000036 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>ClrBP</tt> |
||
− | ==== setPC ==== |
||
+ | ==== Syntax ==== |
||
− | Sets the PC to the specified value. |
||
+ | <tt>ClearBP <BP_Handle></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | setpc <Addr> |
||
+ | === 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> |
||
− | | ''Addr'' || Address the PC should be set to. |
||
+ | |- |
||
+ | | ''Size'' || <ul><li><tt>S8</tt>: 8-bit size</li><li><tt>S16</tt>: 16-bit size</li><li><tt>S32</tt>: 32-bit size</li><li><tt>ANY</tt>: Any size</li> |
||
+ | |- |
||
+ | | ''DataMask'' || Ignore data bits set to 1. |
||
+ | |- |
||
+ | | ''AddrMask'' || Ignore address bits set to 1. |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | // Stop if value 0x1000 is written to address 0x20000000 (32-bit access): |
||
+ | SetWP 0x20000000 W S32 0x1000 0 0 |
||
+ | === ClearWP === |
||
− | '''Example'''<br> |
||
+ | Clear watchpoint. |
||
− | setpc 0x59C |
||
+ | ==== Short command ==== |
||
+ | <tt>ClrWP</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>ClearWP <WP_Handle></tt> |
||
− | + | === VCatch === |
|
+ | Write vector catch. |
||
− | Set timeout in milliseconds for a specific command. |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>VC</tt> |
||
− | '''Note'''<br> |
||
+ | ==== Syntax ==== |
||
− | Right now only stepover is supported |
||
+ | <tt>VCatch <Value></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | SetTimeoutCmd <Cmd> = <TimeoutMs> |
||
+ | === 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. |
− | |- |
||
− | | ''TimeoutMs'' || Timeout in milliseconds. |
||
|} |
|} |
||
+ | === ReadAP === |
||
− | '''Example'''<br> |
||
+ | Reads from a CoreSight AP register. This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. |
||
− | SetTimeoutCmd stepover = 5000 |
||
+ | 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. |
||
− | ==== setWP ==== |
||
+ | ==== Syntax ==== |
||
− | This command inserts a new watchpoint that matches the specified parameters. |
||
+ | <tt>ReadAP <RegIndex></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 !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of AP register to read |
− | |- |
||
− | | ''Accesstype'' || Specifies the control data on which data event has been set: <br> R: read access <br> W: write access |
||
− | |- |
||
− | | ''Size'' || Valid values: S8 | S16 | S32 <br> Specifies to monitor an n-bit access width at the selected address. |
||
− | |- |
||
− | | ''Data'' || Specifies the Data on which watchpoint has been set. |
||
− | |- |
||
− | | ''DataMask'' || Specifies data mask used for comparison. Bits set to 1 are masked out, so not taken into consideration during data comparison. Please note that for certain cores not all Bit-Mask combinations are supported by the core-debug logic. On some cores only complete bytes can be masked out (e.g. PIC32) or similar. |
||
− | |- |
||
− | | ''AddrMask'' || Specifies the address mask used for comparison. Bits set to 1 are masked out, so not taken into consideration during address comparison. Please note that for certain cores not all Bit-Mask combinations are supported by the core-debug logic. On some cores only complete bytes can be masked out (e.g. PIC32) or similar. |
||
|} |
|} |
||
+ | ==== 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. |
||
− | setWP 0x20000000 W S8 0xFF |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>WriteAP <RegIndex></tt> |
||
− | ==== si ==== |
||
− | This command selects a target interface. |
||
− | |||
− | '''Syntax'''<br> |
||
− | si <Interface> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''RegIndex'' || Index of AP register to write |
||
− | | ''Interface'' || Can be any supported target interface (e.g SWD, JTAG, ICSP, FINE, ...) |
||
+ | |- |
||
+ | | ''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. |
||
− | si JTAG |
||
+ | This command performs a full-qualified read which means that it tries to read until the read has been accepted or too many WAIT responses have been received. |
||
− | |||
+ | In case actual read data is returned on the next read request (this is the case for example with interface JTAG, not with SWD) this command performs the additional dummy read request automatically. |
||
− | ==== sleep ==== |
||
+ | ==== Syntax ==== |
||
− | Waits the given time (in milliseconds). |
||
+ | <tt>ReadDP <RegIndex></tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | sleep <Delay> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''RegIndex'' || Index of DP register to read |
|} |
|} |
||
+ | === WriteDP === |
||
− | '''Example'''<br> |
||
+ | Writes to a CoreSight DP register. |
||
− | sleep 200 |
||
+ | This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received. |
||
− | |||
− | ==== st ==== |
||
− | 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. |
||
− | |||
− | '''Syntax'''<br> |
||
− | st |
||
− | |||
− | ==== step ==== |
||
− | 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. |
||
− | |||
− | '''Syntax'''<br> |
||
− | step |
||
− | |||
− | ==== stepover ==== |
||
− | Target needs to be halted before calling this command. |
||
− | Executes a stepover on the target, similar how a debugger does it. The instruction is overstepped even if it is breakpointed. |
||
− | Prints out the disassembly of the instruction to be stepped over. By default this command has a timeout of five seconds. |
||
− | |||
− | '''Note'''<br> |
||
− | For more information see [[#SetTimeoutCmd | SetTimeoutCmd]] |
||
− | |||
− | '''Syntax'''<br> |
||
− | stepover |
||
− | |||
− | ==== unlock ==== |
||
− | This command unlocks a device which has been accidentally locked by malfunction of user software. |
||
− | |||
− | '''Syntax'''<br> |
||
− | unlock <DeviceName> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WriteDP <RegIndex></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''RegIndex'' || Index of DP register to write |
||
− | | ''DeviceName'' || Name of the device family to unlock. Supported Devices: <br> LM3Sxxx <br> Kinetis <br> EFM32Gxxx |
||
+ | |- |
||
+ | | ''Data32Hex'' || Data to write |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | See: [[#Reading from another MEM-AP|Reading from another MEM-AP]] |
||
+ | === RCP15Ex === |
||
− | Example |
||
+ | Read CP15 register. |
||
− | unlock Kinetis |
||
+ | ==== Short command ==== |
||
+ | <tt>RCE</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>RCP15Ex <Op1> <CRn> <CRm> <Op2></tt> |
||
− | + | === WCP15Ex === |
|
+ | Write CP15 register. |
||
− | 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. |
||
+ | ==== 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). |
||
− | usb [<Port>] |
||
+ | === 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 ==== |
||
+ | <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> |
||
− | usb |
||
− | |||
− | ==== verifybin ==== |
||
− | Verifies if the specified binary is already in the target memory at the specified address. |
||
− | |||
− | '''Syntax'''<br> |
||
− | verifybin <Filename>, <Addr> |
||
+ | === Mem16 === |
||
+ | Read memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory. |
||
+ | ==== Syntax ==== |
||
+ | <tt>Mem16 [<Zone>:]<Addr> <NumItems> (hex)</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | '' |
+ | | ''Zone'' || Name of memory zone to access. |
|- |
|- |
||
− | | ''Addr'' |
+ | | ''Addr'' || Start address. |
+ | |- |
||
+ | | ''NumItems'' || Number of items to read. Maximum is 0x100000. |
||
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>Mem16 0x0 100</tt> |
||
− | verifybin C:\Work\test.bin 0x0000000 |
||
− | |||
− | ==== VCOM ==== |
||
− | Enables or disables the VCOM of the J-Link (if the probe supports VCOM).<br> |
||
− | After changing the configuration a power cycle of the debug probe is necessary in order for the new configuration to take effect. |
||
− | |||
− | '''Syntax'''<br> |
||
− | VCOM <Configuration> |
||
+ | === 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. |
||
− | | ''Configuration'' || Can be either ''enable'' or ''disable'' |
||
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>Mem32 0x0 100</tt> |
||
+ | === Write1 === |
||
− | '''Example'''<br> |
||
+ | Write one single byte to the target system. |
||
− | VCOM enable |
||
+ | ==== Short command ==== |
||
− | VCOM disable |
||
+ | <tt>W1</tt> |
||
− | |||
− | ==== |
+ | ==== Syntax ==== |
+ | <tt>W1 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | Sets a fixed value for VTref on J-Link. |
||
− | The Value of VTref can be set between 1200 mV and 3300 mV all values that exceed 3300 mV will be limited to 3300 mV, values smaller than 1200 mV deactivate fixed VTref. |
||
− | Settings of fixed VTref apply nonvolatile after power cycling the probe. |
||
− | |||
− | '''Syntax'''<br> |
||
− | VTREF <ValuemV> |
||
− | |||
{| 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. |
||
− | VTREF 3300 |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>W2</tt> |
||
− | '''Note'''<br> |
||
+ | ==== Syntax ==== |
||
− | The command overrides the VTref pin and once set the pin will be ignored. To activate the pin again call the VTREF command with a voltage of 0V. |
||
+ | <tt>W2 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | |||
− | ==== w1 ==== |
||
− | The command writes one single byte to the target system. |
||
− | |||
− | '''Syntax'''<br> |
||
− | w1 [<Zone>:]<Addr>, <Data> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
Line 1,019: | Line 960: | ||
| ''Addr'' || Start address. |
| ''Addr'' || Start address. |
||
|- |
|- |
||
− | | ''Data'' || |
+ | | ''Data'' || 16-bits of data to write. |
|} |
|} |
||
+ | ==== Example ==== |
||
+ | <tt>W2 0x0 0011</tt> |
||
+ | === Write4 === |
||
− | '''Example'''<br> |
||
+ | Write 32-bit items. |
||
− | w1 0x10, 0xFF |
||
+ | ==== Short command ==== |
||
− | |||
+ | <tt>W4</tt> |
||
− | ==== w2 ==== |
||
+ | ==== Syntax ==== |
||
− | The command writes a unit of 16-bits to the target system. |
||
+ | <tt>W4 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
− | |||
− | '''Syntax'''<br> |
||
− | w2 [<Zone>:]<Addr>, <Data> (hex) |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
Line 1,039: | Line 979: | ||
| ''Addr'' || Start address. |
| ''Addr'' || Start address. |
||
|- |
|- |
||
− | | ''Data'' || |
+ | | ''Data'' || 32-bits of data to write. |
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>W4 0x0 00112233</tt> |
||
− | w2 0x0, 0xFFFF |
||
− | + | === Write8 === |
|
+ | Write 64-bit items. |
||
− | The command writes a unit of 32-bits to the target system. |
||
+ | {{ Note|1= |
||
+ | Supported since V7.86b |
||
+ | }} |
||
+ | ==== Short command ==== |
||
− | '''Syntax'''<br> |
||
+ | <tt>W8</tt> |
||
− | w4 [<Zone>:]<Addr>, <Data> (hex) |
||
+ | ==== Syntax ==== |
||
+ | <tt>W8 [<Zone>:]<Addr> <Data> (hex)</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
Line 1,059: | Line 1,004: | ||
| ''Addr'' || Start address. |
| ''Addr'' || Start address. |
||
|- |
|- |
||
− | | ''Data'' || |
+ | | ''Data'' || 64-bits of data to write. |
|} |
|} |
||
− | + | ==== Example ==== |
|
+ | <tt>W8 0x0 0x0011223344556677</tt> |
||
− | w4 0x0, 0xAABBCCFF |
||
− | + | === JTAGConf === |
|
+ | Configure JTAG scan chain with multiple devices on it.<br> |
||
− | Disables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe. |
||
+ | For more detailed information on how to configure a scan chain with multiple devices please refer to [[UM08001#Determining values for scan chain configuration | Determining values for scan chain configuration]].<br> |
||
+ | ==== Syntax ==== |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''IRPre'' || Sum of IRLens of all devices closer to TDO, where IRLen is the number of bits in the IR (Instruction Register) of one device.<br>-1 == auto-detection. |
||
+ | |- |
||
+ | | ''DRPre'' || Number of devices closer to 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): |
||
− | '''Syntax'''<br> |
||
+ | JTAGConf 12 2 // IRPre = 7 + 5, DRPre = 1 + 1 |
||
− | WebUSBDisable |
||
+ | </source> |
||
− | + | === JTAGId === |
|
+ | Read JTAG Id. |
||
− | Enables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe. |
||
+ | ==== Short command ==== |
||
+ | <tt>I</tt> |
||
+ | === WJTAGIR === |
||
− | '''Syntax'''<br> |
||
+ | Write JTAG command (IR). |
||
− | WebUSBEnable |
||
+ | If no IRLen is passed, IRLen=4 is used. |
||
+ | ==== Short command ==== |
||
+ | <tt>WJIR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WJTAGIR <Insturction(hex)> [<IRLen(dec)>]</tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''Insturction'' || Insturction to send as hexadecimal value. |
||
+ | |- |
||
+ | | ''IRLen'' || Instruction register length of the current selected device. |
||
+ | |} |
||
− | + | === WJTAGDR === |
|
+ | Write JTAG data (DR). |
||
− | 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>WJDR</tt> |
||
− | '''Syntax'''<br> |
||
+ | ==== Syntax ==== |
||
− | WriteAP <RegIndex>, <Data32Hex> |
||
+ | <tt>WJTAGDR <Data64(hex)> <NumBits(dec)></tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''Data64'' || Data to send. |
||
+ | |- |
||
+ | | ''NumBits'' || Number of bits to send. |
||
+ | |} |
||
+ | === WJTAGRaw === |
||
+ | Write Raw JTAG data. |
||
+ | ==== Short command ==== |
||
+ | <tt>WJR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WJTAGRaw <NumBits(dec)> <TMS(hex)> <TDI(hex)></tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! 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 |
||
− | // Select AHB-AP and configure it |
||
+ | TDO: 0000000000000000000000 |
||
− | // |
||
+ | J-Link>wjr 56, 0x30000000007003, 0x00000000000FE0 // Read IDCODE |
||
− | WriteDP 2, 0x00000000 // Select AP[0] (AHB-AP) bank 0 |
||
+ | TDO: 00974008EE0110 |
||
− | WriteAP 4, 0x23000010 // Auto-increment, Private access, Access size: word} |
||
− | + | === ResetTAP === |
|
+ | Reset TAP Controller using state machine (111110). |
||
− | Writes a specific CSR (Control Status Register) on a RISC-V based target. |
||
+ | ==== Short command ==== |
||
+ | <tt>RTAP</tt> |
||
+ | === ResetTRST === |
||
− | '''Note'''<br> |
||
+ | Reset TAP Controller using nTRST. |
||
− | Writes to known CSRs (like X1) may not be written to HW directly but with the next g or s command. |
||
+ | ==== Short command ==== |
||
+ | <tt>RT</tt> |
||
+ | === ICE === |
||
− | '''Syntax'''<br> |
||
+ | Show state of the embedded ICE macrocell (ICE breaker). |
||
− | writecsr <RegIndex>, <Data>[,<RegSizeBytes>] |
||
+ | === ReadICE === |
||
+ | Read Ice register. |
||
+ | ==== Short command ==== |
||
+ | <tt>RI</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>RI <RegIndex>(hex)</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! Parameter |
+ | ! Parameter !! Meaning |
|- |
|- |
||
− | | ''RegIndex'' |
+ | | ''RegIndex'' || Register index of register to read from. |
+ | |} |
||
+ | |||
+ | === WriteICE === |
||
+ | Write Ice register. |
||
+ | ==== Short command ==== |
||
+ | <tt>WI</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>WI <RegIndex> <Data(hex)></tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
|- |
|- |
||
+ | | ''RegIndex'' || Register index of register to read from. |
||
− | | ''Data'' || Data to write |
||
|- |
|- |
||
+ | | ''Data'' || Data to write (in hex). |
||
− | | ''RegSizeBytes'' || Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64). |
||
|} |
|} |
||
+ | === STraceStart === |
||
− | '''Example'''<br> |
||
+ | Starts STRACE. |
||
− | writecsr 0x1001, 0x11223344 |
||
− | or |
||
− | writecsr 0x1001, 0x11223344, 8 |
||
− | + | === STraceStop === |
|
+ | Stops STRACE. |
||
− | Writes to a CoreSight DP register. |
||
+ | === STraceRead === |
||
− | 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. |
||
+ | 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 === |
||
− | '''Syntax'''<br> |
||
+ | Erases all flash sectors or a certain flash range of the current device. |
||
− | WriteDP <RegIndex>, <Data32Hex> |
||
+ | 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" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''Filename'' || Source filename. |
||
+ | |- |
||
+ | | ''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 === |
||
+ | Save target memory range into binary file. |
||
+ | ==== Syntax ==== |
||
+ | <tt>SaveBin <filename> <addr> <NumBytes></tt> |
||
{| 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. |
||
− | // |
||
+ | ==== Syntax ==== |
||
− | // Write DP SELECT register: Select AP 0 bank 15 |
||
+ | <tt>VerifyBin <filename> <addr></tt> |
||
− | // |
||
− | WriteDP 2, 0x000000F0 |
||
− | |||
− | ==== wreg ==== |
||
− | Writes into a register. The value is written into the register on CPU start. |
||
− | |||
− | '''Syntax'''<br> |
||
− | wreg <RegName>, <Data> |
||
− | |||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
! Parameter !! Meaning |
! Parameter !! Meaning |
||
|- |
|- |
||
− | | '' |
+ | | ''Filename'' || Sample bin. |
|- |
|- |
||
− | | '' |
+ | | ''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. |
||
− | wreg R14, 0xFF |
||
+ | 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, |
||
− | == Command line options == |
||
+ | using an appropriate offset when sending it the second time. Offset applies to both destination and source file. |
||
− | J-Link Commander can be started with different command line options for test and automation purposes. |
||
+ | ==== Short command ==== |
||
− | In the following, the command line options which are available for J-Link Commander are explained. |
||
+ | <tt>FWr</tt> |
||
− | All command line options are case insensitive. |
||
+ | ==== Syntax ==== |
||
− | |||
+ | <tt>FWrite <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt> |
||
{| class="wikitable" |
{| class="wikitable" |
||
|- |
|- |
||
− | ! |
+ | ! Parameter !! Meaning |
|- |
|- |
||
+ | | ''EmuFile'' || File name to write to. |
||
− | | [[#-AutoConnect | -AutoConnect]] || Automatically start the target connect sequence. |
||
|- |
|- |
||
+ | | ''HostFile'' || Source file on the host |
||
− | | [[#-CommanderScript | -CommanderScript]] || Passes a CommandFile to J-Link |
||
|- |
|- |
||
+ | | ''Offset'' || Specifies the offset in the file, at which data writing is started. |
||
− | | [[#-CommandFile | -CommandFile]] || Passes a CommandFile to J-Link |
||
|- |
|- |
||
+ | | ''NumBytes'' || Maximum number of bytes to write. |
||
− | | [[#-Device | -Device]] || Pre-selects the device J-Link Commander shall connect to |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>FWrite Flasher.dat C:\Project\Flasher.dat</tt> |
||
+ | |||
+ | === FRead === |
||
+ | On probes which support file I/O this command reads a specific file. |
||
+ | Offset applies to both destination and source file. |
||
+ | ==== Short command ==== |
||
+ | <tt>FRd</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>FRead <EmuFile> <HostFile> [<Offset> [<NumBytes>]]</tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | [[#-ExitOnError | -ExitOnError]] || Commander exits after error |
||
|- |
|- |
||
+ | | ''EmuFile'' || File name to read from. |
||
− | | [[#-If | -If]] || Pre-selects the target interface |
||
|- |
|- |
||
+ | | ''HostFile'' || Destination file on the host. |
||
− | | [[#-IP | -IP]] || Selects IP as host interface |
||
|- |
|- |
||
+ | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
||
− | | [[#-JLinkScriptFile | -JLinkScriptFile]] || Passes a JLinkScriptFile to J-Link |
||
|- |
|- |
||
+ | | ''NumBytes'' || Maximum number of bytes to read. |
||
− | | [[#-JTAGConf | -JTAGConf]] || Sets IRPre and DRPre |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>FRead Flasher.dat C:\Project\Flasher.dat</tt> |
||
+ | |||
+ | === FShow === |
||
+ | On probes which support file I/O this command reads and prints a specific file. |
||
+ | Currently, only Flasher models support file I/O. |
||
+ | ==== Syntax ==== |
||
+ | <tt>FShow <FileName> [-a] [<Offset> [<NumBytes>]]</tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | [[#-Log | -Log]] || Sets logfile path |
||
|- |
|- |
||
+ | | ''FileName'' || Source file name to read from the Flasher. |
||
− | | [[#-NoGui | -NoGui]] || Starts J-Link Commander in no GUI mode |
||
|- |
|- |
||
+ | | ''-a'' || If set, Input will be parsed as text instead of being shown as hex. |
||
− | | [[#-RTTTelnetPort | -RTTTelnetPort]] || Sets the RTT Telnetport |
||
|- |
|- |
||
+ | | ''Offset'' || Specifies the offset in the file, at which data reading is started. |
||
− | | [[#-USB | -USB]] || Connects to a J-Link with a specific S/N over USB. |
||
|- |
|- |
||
+ | | ''NumBytes'' || Maximum number of bytes to read. |
||
− | | [[#-SettingsFile | -SettingsFile]] || Passes a SettingsFile to J-Link |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>FShow Flasher.dat</tt> |
||
+ | |||
+ | === FDelete === |
||
+ | On probes which support file I/O this command deletes a specific file. |
||
+ | ==== Short command ==== |
||
+ | <tt>FDel</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>fdelete <FileName></tt> |
||
+ | {| class="wikitable" |
||
|- |
|- |
||
+ | ! Parameter !! Meaning |
||
− | | [[#-Speed | -Speed]] || Starts J-Link Commander with a given initial speed |
||
|- |
|- |
||
+ | | ''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. |
||
− | Following is a detailed description with syntax and examples of the command lines listed above. |
||
+ | Currently, only Flasher models support file I/O. |
||
+ | ==== Short command ==== |
||
+ | <tt>FSz</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>FSize <FileName></tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''FileName'' || Source file name to read from the Flasher. |
||
+ | |} |
||
− | + | === FList === |
|
+ | On probes which support file I/O this command shows the directory tree of the Flasher. |
||
− | This command can be used to let J-Link Commander automatically start the connect sequence for connecting to the target when entering interactive mode. |
||
+ | === SecureArea === |
||
− | '''Syntax'''<br> |
||
+ | On probes which support file I/O this command creates/removes a secure area on the probe. |
||
− | -autoconnect <1|0> |
||
+ | ==== Syntax ==== |
||
+ | <tt>SecureArea <Operation></tt> |
||
+ | === PowerTrace === |
||
− | '''Example'''<br> |
||
+ | Perform power trace (not supported by all models). |
||
− | JLink.exe -autoconnect 1 |
||
+ | ==== Syntax ==== |
||
+ | <tt>PowerTrace <LogFile> [<ChannelMask> <RefCountSel>]</tt> |
||
− | + | === TestWSpeed === |
|
+ | Measure download speed into target memory. |
||
− | Similar to [[#-CommandFile | -CommandFile]]. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestW</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestWSpeed [<Addr> [<Size>]]</tt> |
||
− | + | === TestRSpeed === |
|
+ | Measure upload speed from target memory. |
||
− | Selects a command file and starts J-Link Commander in batch mode. The batch mode of J-Link Commander is similar to the execution of a batch file. |
||
+ | ==== Short command ==== |
||
− | The command file is parsed line by line and one command is executed at a time. |
||
+ | <tt>TestR</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestRSpeed [<Addr> [<Size>] [<NumBlocks>]]</tt> |
||
+ | === TestCSpeed === |
||
− | '''Syntax'''<br> |
||
+ | Measure CPU speed. |
||
+ | ==== Short command ==== |
||
+ | <tt>TestC</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>TestCSpeed [<RAMAddr>]</tt> |
||
+ | === TestNWSpeed === |
||
− | -CommandFile <CommandFilePath> |
||
+ | Measure network download speed 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 === |
||
− | '''Example'''<br> |
||
+ | Measure network upload speed between the probe and the host.<br> |
||
+ | 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 === |
||
− | See [[#Using J-Link Command Files | Using J-Link Command FIles]]. |
||
+ | Measure RTCK reaction time. |
||
+ | ==== Syntax ==== |
||
+ | <tt>mr [<RepCount>]</tt> |
||
+ | {| class="wikitable" |
||
+ | |- |
||
+ | ! Parameter !! Meaning |
||
+ | |- |
||
+ | | ''RepCount'' || Number of times the test is repeated (Default: 1). |
||
+ | |} |
||
+ | ==== Example ==== |
||
+ | <tt>mr 3</tt> |
||
− | + | === Clock === |
|
− | + | Output clock(s) on the TCK pin (J-Link pin 9). |
|
+ | ==== Short command ==== |
||
− | For some devices, J-Link already needs to know the device at the time of connecting, since special handling is required for some of them. |
||
+ | <tt>C</tt> |
||
− | For a list of all supported device names, please refer to [[#List of supported target devices | List of supported target devices]. |
||
+ | ==== Syntax ==== |
||
+ | <tt>Clock [NumClocks]</tt> |
||
+ | === Clock00 === |
||
− | '''Syntax'''<br> |
||
+ | Output clock(s) on the TCK pin (J-Link pin 9), with TDI == 0 and TMS == 0. |
||
+ | ==== Short command ==== |
||
+ | <tt>C00</tt> |
||
+ | ==== Syntax ==== |
||
+ | <tt>Clock00 [NumClocks]</tt> |
||
+ | === ClrTCK === |
||
− | -Device <DeviceName> |
||
+ | Clear TCK pin (J-Link pin 9). |
||
+ | ==== Short command ==== |
||
+ | <tt>TCK0</tt> |
||
+ | === SetTCK === |
||
− | '''Example'''<br> |
||
+ | Set TCK pin (J-Link pin 9). |
||
+ | ==== Short command ==== |
||
+ | <tt>TCK1</tt> |
||
+ | === ClrTDI === |
||
− | JLink.exe -Device STM32F103ZE |
||
+ | Clear TDI pin (J-Link pin 5). |
||
+ | ==== Short command ==== |
||
+ | <tt>TDI0</tt> |
||
− | + | === SetTDI === |
|
+ | Set TDI pin (J-Link pin 5). |
||
− | Similar to the [[#exitonerror | exitonerror]] command. |
||
+ | ==== Short command ==== |
||
+ | <tt>TDI1</tt> |
||
− | + | === ClrTMS === |
|
+ | Clear TMS pin (J-Link pin 7). |
||
− | Selects the target interface J-Link shall use to connect to the target. |
||
+ | ==== Short command ==== |
||
− | By default, J-Link Commander first tries to connect to the target using the target interface which is currently selected in the J-Link firmware. |
||
+ | <tt>TMS0</tt> |
||
− | If connecting fails, J-Link Commander goes through all target interfaces supported by the connected J-Link and tries to connect to the device. |
||
+ | === SetTMS === |
||
− | '''Syntax'''<br> |
||
+ | Set TMS pin (J-Link pin 7). |
||
− | -If <TargetInterface> |
||
+ | ==== Short command ==== |
||
+ | <tt>TMS1</tt> |
||
+ | === ClrTRST === |
||
− | '''Example'''<br> |
||
+ | Clear TRST pin (J-Link pin 3). |
||
− | JLink.exe -If SWD |
||
+ | ==== Short command ==== |
||
+ | <tt>TRST0</tt> |
||
− | + | === SetTRST === |
|
+ | Set TRST pin (J-Link pin 3). |
||
− | Selects IP as host interface to connect to J-Link. Default host interface is USB. |
||
+ | ==== Short command ==== |
||
+ | <tt>TRST1</tt> |
||
+ | === ClrRESET === |
||
− | '''Syntax'''<br> |
||
+ | Clear RESET pin (J-Link pin 15). |
||
− | -IP <IPAddr> |
||
+ | ==== Short command ==== |
||
+ | <tt>R0</tt> |
||
+ | === SetRESET === |
||
− | '''Example'''<br> |
||
+ | Set RESET pin (J-Link pin 15). |
||
− | JLink.exe -IP 192.168.1.17 |
||
+ | ==== Short command ==== |
||
+ | <tt>R1</tt> |
||
+ | == Command sequence examples == |
||
− | '''Additional information'''<br> |
||
+ | This section provides some examples for the [[#Commands | J-Link Commander Commands]] |
||
− | To select from a list of all available emulators on Ethernet, please use * as ''<IPAddr>''. |
||
+ | === Reading from another MEM-AP === |
||
− | |||
+ | This example shows how to read data via a MEM-AP. |
||
− | ==== -JLinkScriptFile ==== |
||
+ | ==== Assumptions ==== |
||
− | Passes the path of a J-Link script file to the J-Link Commander. |
||
+ | * MCU with a core AP & another AP for background memory access |
||
− | J-Link scriptfiles are mainly used to connect to targets which need a special connection sequence before communication with the core is possible. |
||
+ | * User wants to read data while the device is running, using background memory access. |
||
− | For more information about J-Link script files, please refer to [[J-Link_script_files | J-Link Script Files]]. |
||
+ | * AP[0]: AHB-AP: CPU |
||
− | |||
+ | * AP[1]: APB-AP: System AP (for background access) |
||
− | '''Syntax'''<br> |
||
+ | ==== Commands used ==== |
||
− | JLink.exe -JLinkScriptFile <File> |
||
+ | * [[#ReadAP | ReadAP]] |
||
− | |||
+ | * [[#WriteAP | WriteAP]] |
||
− | '''Example'''<br> |
||
+ | * [[#WriteDP | WriteDP]] |
||
− | JLink.exe -JLinkScriptFile “C:\My Projects\Default.JLinkScript” |
||
+ | ==== Example sequence ==== |
||
− | |||
+ | <source lang="c"> |
||
− | ==== -JTAGConf ==== |
||
+ | WriteDP 2 0x01000000 // SELECT register: Select AP[1] bank 0 |
||
− | Passes IRPre and DRPre in order to select a specific device in a JTAG-chain. “-1,-1” can be used to let J-Link select a device automatically. |
||
+ | WriteAP 0 0x80006012 // CSW register: DbgSwEnable: Enable, AddrInc: Increment, Size: 32 bits |
||
− | |||
+ | WriteAP 1 0x00000000 // TAR register: Select address to start reading from |
||
− | '''Syntax'''<br> |
||
+ | ReadAP 3 // DRW register: Read @0x0000_0000 |
||
− | -JTAGConf <IRPre>,<DRPre> |
||
+ | ReadAP 3 // DRW register: Read @0x0000_0004 |
||
− | |||
+ | ... |
||
− | '''Example'''<br> |
||
+ | </source> |
||
− | JLink.exe -JTAGConf 4,1 |
||
− | JLink.exe -JTAGConf -1,-1 |
||
− | |||
− | ==== -Log ==== |
||
− | Set path to LogFilePath allowing the DLL to output logging information. |
||
− | If the logfile already exists, the contents of the current logfile will be overwritten. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -Log <LogFilePath> |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -Log C:\Work\log.txt |
||
− | |||
− | ==== -NoGui ==== |
||
− | Starts the J-Link Commander in "no GUI"-mode. |
||
− | Please note that license dialogs are not suppressed in this mode. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -NoGui 1 |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -NoGui 1 |
||
− | |||
− | '''NOTE:''' |
||
− | This command is not yet available. It will be available for Version 6.71d (beta) and V6.74 (release) or later, of the [[Software_and_Documentation_Pack | Software and Documentation Pack]]. |
||
− | |||
− | ==== -RTTTelnetPort ==== |
||
− | This command alters the RTT telnet port. Default is 19021. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -RTTTelnetPort <Port> |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -RTTTelnetPort 9100 |
||
− | |||
− | ==== -USB ==== |
||
− | Connect to a J-Link with a specific serial number via USB. |
||
− | Useful if multiple J-Links are connected to the same PC and multiple instances of J-Link Commander shall run and each connects to another J-Link. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -USB <SerialNo> |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -USB 580011111 |
||
− | |||
− | ==== -SettingsFile ==== |
||
− | Select a J-Link settings file to be used for the target device. |
||
− | The settings file can contain all configurable options of the Settings tab in J-Link Control panel. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -SettingsFile <PathToFile> |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -SettingsFile “C:\Work\settings.txt” |
||
− | |||
− | ==== -Speed ==== |
||
− | Starts J-Link Commander with a given initial speed. Available parameters are “adaptive”, “auto” or a freely selectable integer value in kHz. |
||
− | It is recommended to use either a fixed speed or, if it is available on the target, adaptive speeds. |
||
− | Default interface speed is 100kHz. |
||
− | |||
− | '''Syntax'''<br> |
||
− | -Speed <Speed_kHz> |
||
− | |||
− | '''Example'''<br> |
||
− | JLink.exe -Speed 4000 |
||
== Using J-Link Command Files == |
== Using J-Link Command Files == |
||
Line 1,360: | Line 1,496: | ||
When using J-Link commander in batch mode, the path to a command file is passed to it. |
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). |
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. |
+ | 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> |
||
Line 1,366: | Line 1,503: | ||
''Contents of CommandFile.jlink:''<br> |
''Contents of CommandFile.jlink:''<br> |
||
+ | si 1 // Select interface |
||
− | si 1 |
||
− | speed 4000 |
+ | speed 4000 // Select speed |
+ | /* Perform reset and halt */ |
||
r |
r |
||
h |
h |
||
− | + | loadfile C:\firmware.bin 0x08000000 // Load data file |
|
== Perform flash download == |
== Perform flash download == |
||
Line 1,384: | Line 1,522: | ||
[[File:JLinkCommander_FlashDownload.png]] |
[[File:JLinkCommander_FlashDownload.png]] |
||
− | == |
+ | == Command line options == |
+ | 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: |
||
+ | <source> |
||
+ | device CC2538SF53 |
||
+ | si JTAG |
||
+ | speed 4000 |
||
+ | jtagconf -1,-1 |
||
+ | connect |
||
+ | </source> |
||
== JLink.exe return value == |
== JLink.exe return value == |
||
Line 1,432: | 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,440: | Line 1,618: | ||
exec map reset |
exec map reset |
||
exec map exclude 0x10000000-0x3FFFFFFF |
exec map exclude 0x10000000-0x3FFFFFFF |
||
+ | |||
+ | == Changing J-Link Reset Strategy == |
||
+ | The reset strategy can be changed by executing the [[#RSetType | RSetType command]]: |
||
+ | RSetType = 12 |
||
== Connecting to a specific J-Link == |
== Connecting to a specific J-Link == |
||
Line 1,452: | 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.