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.
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 |
BootMode | BootMode | Select boot mode of the connected 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.
Parameter | Meaning |
---|---|
(optional) Command, specific information is required for. |
Close target device connection, J-Link connection and closes the application.
Toggle exit J-Link Commander on error.
Parameter | Meaning |
---|---|
0 | Exit on error is off. |
1 | Exit on error is on. |
Waits the given time. Usually used for J-Link Command Scripts.
Parameter | Meaning |
---|---|
Delay | Amount of time to sleep in ms. |
Enables log to file.
Parameter | Meaning |
---|---|
Filename | Log filename |
Export device names from DLL internal device list to text file.
Parameter | Meaning |
---|---|
Filename | Path to text file destination. |
Export device names from DLL internal device list to XML file.
Parameter | Meaning |
---|---|
Filename | Path to XML file destination. |
Connect to J-Link via USB. Opens the USB selection dialog if no port, SN or nickname (available from V7.92d) is passed.
Parameter | Meaning |
---|---|
SN/Nickname | (optional) Serial number or nickname (available from V7.92d) of the J-Link to connect to. |
Connect to J-Link via TCP/IP or to Remote Server. Opens the IP selection dialog if no parameter is passed.
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. |
Show list of all connected probes via specified interface. The Probe to communicate with can then be selected.
Parameter | Meaning |
---|---|
Interface | (optional) Interface, J-Links are supposed to be located at (USB, IP). |
SelectProbe USB IP
Show list of all connected probes via specified interface (e.g. USB/IP)
Parameter | Meaning |
---|---|
Interface | (optional) Interface, J-Links are supposed to be located at (USB, IP). |
ShowEmuList USB IP
Switch power supply for target (J-Link pin 19, 5V-Supply) on or off, permanently or until next power-cycle.
Parameter | Meaning |
---|---|
State | On: Power supply on. Off: Power supply off. |
perm | Sets the specified State value as default. |
Set fixed value for VTref on J-Link (0 == Auto detection).
Parameter | Meaning |
---|---|
Value[mV] | Value, VTref is supposed to be set to in millivolt. |
Selects the boot mode of the connected probe if supported (available from V7.96n). A power cycle is necessary to enter new boot mode after selection.
Parameter | Meaning |
---|---|
Mode | 0: J-Link 1: CMSIS-DAPv1 2: CMSIS-DAPv2 |
Reboot the connected probe and reconnect to it. If connection cannot be established in ms, an error is assumed.
Reboot // Reboot with default timeout. Reboot 10000 // Reboot with 10 sec. timeout.
Show current uptime of the connected Probe since boot.
Enable/disable VCOM. Takes effect after power cycle of the Probe.
Show firmware info.
Show hardware status.
Execute license command. if no command is passed: Show a list of all available license commands.
Parameter Command | Meaning |
---|---|
add | Store a custom license on J-Link. Syntax: LicAdd |
erase | Erase all custom licenses on J-Link. |
show | Show all licenses stored on J-Link. |
Show/Assign IP address and subnetmask of/to connected Probe.
Show/Assign network gateway address of/to connected Probe.
Show/Assign network DNS server address of/to connected Probe.
Show configuration of the connected Probe.
Calibrate the target current measurement.
Connect to target device. If no device was preselected, the user is asked to provide the missing information about the connected device.
Select specific device J-Link shall connect to. If ? is passed: Show device selection dialog.
Parameter | Meaning |
---|---|
DeviceName | Valid device name: Device is selected. ?: Shows device selection dialog. |
Select target interface.
Parameter | Meaning |
---|---|
Interface | Any supported target interface (e.g SWD, JTAG, ICSP, FINE, . ) |
Set target interface speed.
Parameter | Meaning |
---|---|
Setting | Decimal value: Interface speed in kHz. auto: Interface speed is selected automatically. adaptive: Interface speed is set to adaptive. |
Change mode to little endian.
Change mode to big endian.
Return current CPU state.
Wait until CPU is halted or timeout is reached. If no timeout (in ms) is provided, a default timeout of 1000 ms is used.
Parameter | Meaning |
---|---|
TimeoutMs | (optional) Timeout in milliseconds. |
Start CPU if halted.
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.
Parameter | Meaning |
---|---|
DelayAfterReset | Delay in ms. |
Set the current reset type.
Parameter | Meaning |
---|---|
Type | Desired reset type. If no type is provided, a list of all available types is printed. |
Execute step(s) on the CPU and show the executed instructions. If no number of steps is provided, one step is executed.
Identify length of scan chain select register.
Measure length of scan chain.
Parameter | Meaning |
---|---|
ScanChain | Scan chain to be measured. |
Display CPU register contents.
Read register. If no register name is passed, all available register names are printed.
Parameter | Meaning |
---|---|
RegIndex | Register to read. |
Parameter | Meaning |
---|---|
RegName | Register to write to. |
Data | Data to write to the specified register. |
WReg "R15 (PC)" 0x20000000
Shows mode-of-entry (Reason why CPU is halted).
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 |
// Stop if value 0x1000 is written to address 0x20000000 (32-bit access): SetWP 0x20000000 W S32 0x1000 0 0
Write vector catch.
Set the PC to specified value.
Parameter | Meaning |
---|---|
Addr | Address the PC should be set to. |
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.
Parameter | Meaning |
---|---|
RegIndex | Index of AP register to read |
WriteDP 2 0x000000F0 // Select AP[0] bank 15 ReadAP 3 // Read AP[0] IDR
Writes to a CoreSight AP register. This command performs a full-qualified write which means that it tries to write until the write has been accepted or too many WAIT responses have been received.
Parameter | Meaning |
---|---|
RegIndex | Index of AP register to write |
Data32Hex | Data to write |
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.
Parameter | Meaning |
---|---|
RegIndex | Index of DP register to read |
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.
Parameter | Meaning |
---|---|
RegIndex | Index of DP register to write |
Data32Hex | Data to write |
Read CP15 register.
Write CP15 register.
Visualize printf output using DCC (SEGGER DCC handler running on target).
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.
Mem 0x0 0x100
or
mem AHB-AP (AP1):0x20000000 0x100
Read memory from the target system in units of 8-bit. If necessary, the target CPU is halted in order to read memory.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
NumItems | Number of items to read. Maximum is 0x100000. |
Read memory from the target system in units of 16-bits. If necessary, the target CPU is halted in order to read memory.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
NumItems | Number of items to read. Maximum is 0x100000. |
Read memory from the target system in units of 32-bits. If necessary, the target CPU is halted in order to read memory.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
NumItems | Number of items to read. Maximum is 0x100000. |
Write one single byte to the target system.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
Data | 8-bits of data to write. |
Write 16-bit items.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
Data | 16-bits of data to write. |
Write 32-bit items.
Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
Data | 32-bits of data to write. |
W4 0x0 00112233
Write 64-bit items.
Note:Parameter | Meaning |
---|---|
Zone | Name of memory zone to access. |
Addr | Start address. |
Data | 64-bits of data to write. |
W8 0x0 0x0011223344556677
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.
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. |
// // 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
Write JTAG command (IR). If no IRLen is passed, IRLen=4 is used.
Parameter | Meaning |
---|---|
Insturction | Insturction to send as hexadecimal value. |
IRLen | Instruction register length of the current selected device. |
Write JTAG data (DR).
Parameter | Meaning |
---|---|
Data64 | Data to send. |
NumBits | Number of bits to send. |
Write Raw JTAG data.
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. |
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
Reset TAP Controller using state machine (111110).
Reset TAP Controller using nTRST.
Show state of the embedded ICE macrocell (ICE breaker).
Read Ice register.
Parameter | Meaning |
---|---|
RegIndex | Register index of register to read from. |
Write Ice register.
Parameter | Meaning |
---|---|
RegIndex | Register index of register to read from. |
Data | Data to write (in hex). |
Reads collected STRACE data.
Show supported SWO speeds.
Display SWO status.
Read and display SWO data.
Read, analyze and show SWO data.
View SWO terminal data.
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 and will be erased. By default, the device is being reset before starting the erase operation. This may be skipped by adding "noreset".
Erase
Erase 0x60000000 0x60001000
Erase 0x60000000 0x60001000 noreset
Erase 0 0 noreset
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:
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. |
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
Save target memory range into binary file.
Parameter | Meaning |
---|---|
Filename | Destination file |
Addr | Source address. |
NumBytes | Number of bytes to read. |
SaveBin C:\Work\test.bin 0x0000000 0x100
Verfy if specified .bin file is at the specified target memory location.
Parameter | Meaning |
---|---|
Filename | Sample bin. |
Addr | Start address of memory to verify. |
VerifyBin C:\Work\test.bin 0x0000000
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.
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. |
FWrite Flasher.dat C:\Project\Flasher.dat
On probes which support file I/O this command reads a specific file. Offset applies to both destination and source file.
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. |
FRead Flasher.dat C:\Project\Flasher.dat
On probes which support file I/O this command reads and prints a specific file. Currently, only Flasher models support file I/O.
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. |
On probes which support file I/O this command deletes a specific file.
Parameter | Meaning |
---|---|
FileName | File to delete from the Flasher. |
On probes which support file I/O this command gets the size of a specific file. Currently, only Flasher models support file I/O.
Parameter | Meaning |
---|---|
FileName | Source file name to read from the Flasher. |
On probes which support file I/O this command shows the directory tree of the Flasher.
On probes which support file I/O this command creates/removes a secure area on the probe.
Perform power trace (not supported by all models).
Measure download speed into target memory.
Measure upload speed from target memory.
Measure CPU speed.
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.
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.
Measure RTCK reaction time.
Parameter | Meaning |
---|---|
RepCount | Number of times the test is repeated (Default: 1). |
Output clock(s) on the TCK pin (J-Link pin 9).
Output clock(s) on the TCK pin (J-Link pin 9), with TDI == 0 and TMS == 0.
Clear TCK pin (J-Link pin 9).
Set TCK pin (J-Link pin 9).
Clear TDI pin (J-Link pin 5).
Set TDI pin (J-Link pin 5).
Clear TMS pin (J-Link pin 7).
Set TMS pin (J-Link pin 7).
Clear TRST pin (J-Link pin 3).
Set TRST pin (J-Link pin 3).
Clear RESET pin (J-Link pin 15).
Set RESET pin (J-Link pin 15).
This section provides some examples for the J-Link Commander Commands
This example shows how to read data via a MEM-AP.
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 .
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.
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
J-Link Commander allows to download data files of different types into the flash memory of the target systems.
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==1: Forces the J-Link Commander to connect to the target, automatically. |
-CommandFile | Selects a J-Link Command file which contains the commands for batch mode / auto execution. |
-ExitOnError | Value==1: Exit J-Link Commander on Error. |
-NoGui | Value==1: Suppresses GUI dialogs. |
J-Link connection specific | |
-IP | Selects a specific J-Link (via IP/Tunnel/Nickname) to connect to via TCP/IP. |
-USB | 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 | Selects the target device. |
-If | Configures the target interface. |
-JLinkScriptFile | Selects a specific J-Link script file to use. |
-JTAGConf , | 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 | Configures the target interface speed. |
Misc | |
-Log | Sets a path a J-Link log file is to be created. |
-RTTTelnetPort | Set the J-Link RTT Telnet port to |
JLink.exe -device CC2538SF53 -if JTAG -speed 4000 -jtagconf -1,-1 -autoconnect 1 -CommandFile C:\Work\JLinkCommandFile.jlink
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.
JLink.exe -CommandFile C:\Work\JLinkCommandFile.jlink
Command file contents:
device CC2538SF53 si JTAG speed 4000 jtagconf -1,-1 connect
The return value of the J-Link Commander application (JLink.exe) can be read out int the environment variable ERRORLEVEL.
1. Returns an Error (ERRORLEVEL == 1)
start /wait "J-Link Commander" "JLink.exe" -if InvalidInterfaceParameter ECHO error level is %ERRORLEVEL% 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
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.
exec SupplyPower = 1 exec map reset exec map exclude 0x10000000-0x3FFFFFFF
The reset strategy can be changed by executing the RSetType command:
RSetType = 12
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:
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
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.
Retrieved from "https://wiki.segger.com/index.php?title=J-Link_Commander&oldid=21062"