Segger J-Link WiFi User Guide

Page 1
J-Link / J-Trace
User Guide
Document: UM08001
Software Version: 6.54
Date: November 5, 2019
A product of SEGGER Microcontroller GmbH
www.segger.com
Page 2
Disclaimer
Specifications written in this document are believed to be accurate, but are not guaranteed to be entirely free of error. The information in this manual is subject to change for functional or performance improvements without notice. Please make sure your manual is the latest edition. While the information herein is assumed to be accurate, SEGGER Microcontroller GmbH (SEG­GER) assumes no responsibility for any errors or omissions. SEGGER makes and you receive no warranties or conditions, express, implied, statutory or in any communication with you. SEGGER specifically disclaims any implied warranty of merchantability or fitness for a particular purpose.
Copyright notice
You may not extract portions of this manual or modify the PDF file in any way without the prior written permission of SEGGER. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license.
© 2004-2019 SEGGER Microcontroller GmbH, Monheim am Rhein / Germany
Trademarks
Names mentioned in this manual may be trademarks of their respective companies. Brand and product names are trademarks or registered trademarks of their respective holders.
Contact address
SEGGER Microcontroller GmbH Ecolab-Allee 5
D-40789 Monheim am Rhein Germany
Tel. +49-2173-99312-0 Fax. +49-2173-99312-28 E-mail: support@segger.com Internet: www.segger.com
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 3
Manual versions
This manual describes the current software version. If you find an error in the manual or a problem in the software, please report it to us and we will try to assist you as soon as possible.
Contact us for further information on topics or functions that are not yet documented. Print date: November 5, 2019
Manual version
6.55 0 191105 FF
6.54 0 191023 AG
6.53 3 191021 AG
6.53 2 191016 LG
6.53 2 191016 LG
6.50 3 190923 DL
6.48 4 190813 AG
6.48 3 190802 DL
6.48 1 190711 LG
6.47 1 190511 LG
6.44 4 190424 AG
6.44 3 190415 LG
6.44 2 190408 NV
6.44 1 190321 EL
6.44 0 190306 NV
6.42 0 190215 NV
Revision Date By Description
Chapter “Working with J-Link and J-Trace” *Section “J-Link script files”: Added default return value information for J-Link script file functions.
Chapter “Working with J-Link and J-Trace” *Section “J-Link WiFi setup” added
Chapter “Semihosting” *Section “Debugger Support” Took off Keil MDK-ARM of the list of supported IDEs as MDK does not sup­port semihosting.
Chapter “RTT” *Section “Example code” updated.
Chapter “J-Link software and documentation package” *Section “J-Link Remote Server” Added command “-TunnelEncrypt” Added subsection “Encrypted connection”
Chapter “J-Link software and documentation package” *Section “J-Link Remote Server”: Updated screenshots *Section “J-Link Remote Server”: Created examples for the syntax of the connect-string
Chapter “J-Link software and documentation package” * Section “J-Link GDB Server”: Command line option “-JLinkDevicesXML­Path” corrected.
Chapter “J-Link software and documentation package” * Section “J-Link Commander (Command line tool) Added command ”SetTimeoutCmd“ Added command ”readcsr“ Added command ”stepover“ Added command ”writecsr“
Chapter ”J-Link software and documentation package“ * Section ”J-Link Commander (Command line tool) Added command “WebUSBEnable” Added command “WebUSBDisable”
Chapter “J-Link software and documentation package” * Section “J-Link RTT Viewer”: Updated screenshots. * Section “J-Link RTT Viewer”: Menu entry ’Channel infos…’. * Section “J-Link Remote Server”: Updated list of available command line options.
Chapter “Target interfaces and adapters” * Section “20-pin J-Link connector”: Corrected information for pins 14, 16, 18, 20.
Chapter “J-Link software and documentation pacakge” * Updated J-Mem screenshot. Added Chapter “J-Mem”
Chapter “Target interfaces and adapters” * Added diagram showing J-Trace PRO connection with target device.
Chapter “J-Link software and documentation package” * Section “J-Link GDB Server”: Command line options corrected.
Chapter “J-Link software and documentation package” * Section “J-Link Commander”: Added memory zone example for com­mand “mem”.
Chapter “Working with J-Link and J-Trace” * Section “J-Link Script Files”: Added new Scripting functions for ETB ini­tialization. Chapter “Working with J-Link and J-Trace”
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 4
Manual version
6.40 1 181217 SI
6.40 0 181120 AG
6.34 10 181025 NV
6.34 9 181023 NV
6.34 8 101018 AG
6.34 7 180906 SI
6.34 6 180905 NV
6.34 5 180816 LG
6.34 4 180704 AG
6.34 3 180524 LG
6.34 2 180517 LG
6.34 1 180516 NV
6.34 0 180511 AG
6.32 4 180417 NV
6.32 3 180409 NV
6.32 2 180327 LG
6.32 1 180327 AG
6.32 0 180323 AG
6.30 2 180314 AG
6.30 1 180309 NV
Revision Date By Description
* Section “J-Link Command Strings”: Expanded “map region” documenta­tion.
Chapter “J-Link software and documentation package” * Section “ J-Link SWO Viewer: Added description of command line option ”-usb“”.
Chapter “ARM SWD specifics” added Chapter “ARM SWD specifics” * Section “SWD multi-drop” added
Chapter “J-Link software and documentation package” * Section “J-Link SWO Viewer”: Updated description and pictures.
Chapter “Working with J-Link and J-Trace” * Section “J-Link Command Strings”: Added new J-Link command string “RTTTelnetAllowNonLocalClient”.
Chapter “Target interfaces and adapters” * Section “19-pin JTAG/SWD and Trace connector”: Added information about pitch of connector.
Chapter “J-Link Commander” * Section “ Commands: Added description of ”VTREF“.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Script files“: Added new Script file functions to replace generic trace module initializations.
Chapter ”J-Link GDB Server“ * Section ”Supported remote (monitor) commands“: Added new monitor command ”flash erase“.
Chapter ”J-Link software and documentation package“ * Section ”J-Flash Lite“ added.
Chapter ”J-Link software and documentation package“ * Section ”J-Link Commander (Command line tool)“: Added new command line option ”-Log“.
Chapter ”Open Flashloader“ * Section ”XML Tags and Attributes“: Added new <ChipInfo> attribute ”Aliases“.
Chapter ”J-Link software and documentation package“ * Section ”J-Link SWO Viewer“: Refined CL option descriptions.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Added new J-Link command string ”SetEnableMemCache“. Chapter ”Environmental Conditions & Safety“ added
Chapter ”J-Flash SPI“ * Section ”Command Line Interface“: Updated description of CL option ­jflashlog. * Section ”Command Line Interface“: Updated description of CL option ­jlinklog.
Chapter ”Working with J-Link and J-Trace“ * Section ”Script file API functions“: Added new API functions ”JLINK_MEM_Preserve()“, ”JLINK_MEM_Restore()“, ”JLINK_MEM_Fill()“.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Added new J-Link command string ”MemPreserveOnReset“.
Moved contents of chapter ”Segger-specific GDB protocol extensions“ to separate manual (UM08036)
Moved J-Link GDB Server to separate chapter Added Segger specific GDB protocol extension qSeggerSTRACE:caps Added Segger specific GDB protocol extension qSeggerSTRACE:GetInstS­tats
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Added new J-Link command string ”SetAllowStopMode“.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Script Files“:      Added new function SWO_EnableTarget();. * Section ”J-Link Script Files“:
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 5
Manual version
6.30 0 180206 EL
6.24 1 180124 EL
6.24 0 180111 LG
6.22 0 171214 NV
6.20 8 171123 AG
6.20 7 171025 EL
6.20 6 171013 EL
6.20 5 171011 NG
6.20 4 171011 NG
6.20 3 171006 NG
6.20 2 171005 EL
6.20 1 170922 NG
Revision Date By Description
     Renamed function GetSWOBaseClock() to SWO_GetSWOBaseClock();      Added unit information of clock speed value.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Script Files“:      Added new function: HandleBeforeFlashProg(); * Section ”J-Link Script Files“:      Added new function HandleAfterFlashProg();
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Comamnd Strings“: Updated.
Chapter ”J-Link software and documentation package“ * Section ”J-Link GDB Server“: Added new GDBServer monitor commands: ReadAP, ReadDP, WriteAP and WriteDP.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Added new J-Link Command String to set base addresses of coresight components for tracing e.g. CORESIGHT_SetETBBaseAddr. * Section ”J-Link script files“: Added new function GetSWOBaseClock();. Chapter ”J-Link software and documentation package“ * Section ”J-Link SWO Viewer“: Updated picture of new SWO Viewer GUI interface with additional explanation of SWO clock setting.
Chapter ”Related Software“ * Section ”JTAGLoad“: PIO commands was listed as supported even though it is not. Fixed. * Section ”JTAGLoad“: PIOMAP commands was listed as supported even though it is not. Fixed.
Chapter ”Monitor Mode Debugging“ * Section ”Enable Monitor Debugging“: Updated
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link script files“: Updated Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Updated
Updated links to SEGGER wiki:      Low power mode debugging      J-Link script files      J-Link Command Strings
Chapter ”Working with J-Link and J-Trace“ * Section ”Script file API functions“: Added the following functions:      JLINK_C2_WriteData()      JLINK_C2_ReadData()      JLINK_C2_WriteAddr()      JLINK_C2_ReadAddr()      JLINK_CORESIGHT_ReadDAP()      JLINK_GetPinState()      JLINK_GetTime()      JLINK_JTAG_ReadWriteBits()      JLINK_JTAG_StartDR()      JLINK_PIN_Override()      JLINK_SelectTIF()      JLINK_SetDevice()      JLINK_SWD_ReadWriteBits()      JLINK_TARGET_IsHalted()      JLINK_TARGET_Halt()      JLINK_TIF_ActivateTargetReset()      JLINK_TIF_ReleaseTargetReset()      JLINK_TIF_SetSpeed()      JLINK_TIF_SetClrTCK()      JLINK_TIF_SetClrTMS()      JLINK_TIF_SetClrTDI()
Chapter ”Working with J-Link and J-Trace“ * Section ”Script file API functions“: Added return values for various func­tions
Chapter ”Open Flashloader“ * Section ”Add. Info / Considerations / Limitations“: Updated
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Updated      Added new command string ”EnableLowPowerHandlingMode“
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 6
Manual version
6.16 0 170320 EL
6.14 6 170407 NV
6.14 5 170320 EL
6.14 4 170317 NV
6.14 3 170220 NV
6.14 2 170216 NV
6.14 1 170210 NV
6.14 0 170201 AG
6.10a 0 160820 EL
6.00i 0 160802 EL
6.00 1 160617 EL
6.00 0 160519 AG
5.12f 0 160503 AB
5.12d 1 160427 AG
5.12d 0 160425 AG
5.12c 0 160413 NG
5.12c 1 160418 NG
5.10u 0 160317 AG
Revision Date By Description
Chapter ”Open Flashloader“      Added ”AlwaysPresent“ as new attribute to the <FlashBankInfo>
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link scriptfiles“: Updated      ”JLINK_ExecCommand()“ description
Chapter ”J-Flash SPI“      Updated screenshots
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link scriptfiles“:      Added: ”JLINK_ExecCommand()“      Section ”Keil MDK-ARM“ added for Command string execution
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link scriptfiles“:      Added: ”OnTraceStart()“ and ”JLINK_TRACE_Portwidth“ Chapter ”Trace“ * Added crossreference to ”JLINK_TRACE_Portwidth“
Chapter ”Introduction“ *Added Subsubsection ”Software and Hardware Features Overview“ to all device Subsections. *Edited Subsection ”“J-Trace ARM. *Section ”Target interfaces and adapters“:      edited ”RESET“ to ”nRESET“ and updated description.
Chapter ”Working with J-Link and J-Trace“ * Section ”Exec Commands“: Updated      SetResetPulseLen      TraceSampleAdjust Chapter ”Trace“ * Section ”Tracing via trace pins“: Updated
Chapter ”Working with J-Link“ * Section ”Exec Commands“: Updated      SelectTraceSource      SetRAWTRACEPinDelay      ReadIntoTraceCache Chapter ”Trace“ added.
Chapter ”Working With J-Link“ * Section ”Exec Commands“: Updated ExcludeFlashCacheRanges.
Chapter ”Introduction“ * Removed ”Model Feature Lists“ Chapter ”Adding Support for New Devices“:      renamed to ”Open Flash Loader“ Chapter ”Open Flash Loader“ updated.
Chapter ”J-Flash SPI“ * Added chapter ”Custom Command Sequences“
Chapter ”Adding Support for New Devices“ added. Chapter ”Related Software“
* Section ”J-Link RTT Viewer“ updated and moved from section ”RTT“. Chapter ”Working with J-Link and J-Trace“
* Section ”J-Link script files“ updated. Chapter ”Working with J-Link and J-Trace“
* Section ”J-Link script files“ updated. Chapter ”Related Software“
* Section ”J-Link Commander“      Typo fixed.
Chapter ”Related Software“ * Section ”J-Link Commander“      Commands and commandline options added. Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“      Command ”SetRTTTelnetPort“ added. Chapter ”Flash Download“ * Section ”Debugging applications that change flash contents at runtime“ added.
Chapter ”Monitor Mode Debugging“
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 7
Manual version
5.10t 0 160314 AG
5.10 3 160309 EL
5.10 2 160215 AG
5.10 1 151204 AG
5.10 0 151127 NG
5.02m 0 151125 AG
5.02l 0 151123 AG
5.02i 1 151106 RH
5.02i 0 151105 RH
5.02f 1 151022 NG
5.02f 1 151022 EL
5.02f 0 151007 RH
5.02e 0 151001 AG
5.02c 1 150925 NG
5.02c 0 150916 RH
5.02c 0 150914 RH
5.02a 0 150903 AG
5.02 0 150820 AG
5.02 0 150813 AG
5.00 1 150728 NG
5.00 0 150609 AG
5.00 0 150520 EL
4.99b 0 150520 EL
4.99a 0 150429 AG
Revision Date By Description
* Section ”Target application performs reset“ added. Chapter ”Monitor Mode Debugging“
* Section ”Enable Monitor Debugging“ updated. * Section ”Forwarding of Monitor Interrupts“ added.
Chapter ”J-Flash SPI“ updated.
Chapter ”RTT“ updated. Chapter ”RDI“ updated.
Chapter ”Semihosting“ added. Chapter ”Related Software“
* Section ”J-Scope“ removed. Chapter ”Working with J-Link and J-Trace“
* Section ”The J-Link settings file“ added. Chapter ”Low Power Debugging“ added.
Various Chapters * Some typos corrected.
Chapter ”J-Flash SPI“ * Section ”Send custom commands“ added.
Chapter ”Related Software“ * Section ”J-Link Commander“      exec command added. Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“      New commands added.
Chapter ”Related Software“ * Section ”J-Scope“ updated.
Chapter ”Target interfaces and adapters“ * Section ”Reference voltage (VTref)“ added.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link script files“ updated.
Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link script files“ updated
Chapter ”Licensing“ * Section ”Original SEGGER products“ updated. Chapter ”Flash download“ * Section ”Setup for various debuggers (CFI flash)“ updated.
Chapter ”Flash download“ * Section ”Setup for various debuggers (SPIFI flash)“ added.
Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated. * Section ”Supported OS“      Added Windows 10
Chapter ”Monitor Mode Debugging“ added. Chapter ”Working with J-Link and J-Trace“
* Section ”J-Link Command Strings“      ”DisableCortexMXPSRAutoCorrectTBit“ added.
Chapter ”Monitor Mode Debugging“ added. Chapter ”Related Software“
* Section ”J-Link Commander“      Sub-Section ”Command line options“ updated.
Chapter ”Flash download“ * Section ”QSPI flash support“ added. Chapter ”Flash breakpoints“ * Section ”Flash Breakpoints in QSPI flash“ added
Chapter ”J-Flash SPI“ * Initial version added
Chapter ”Related Software“ * Section ”J-Link STM32 Unlock“      Added command line options
Chapter ”Target interfaces and Adapters“
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 8
Manual version
4.98d 0 150427 EL
4.98b 0 150410 AG
4.98 0 150320 NG
4.96f 0 150204 JL
4.96 0 141219 JL
4.90d 0 141112 NG
4.90c 0 140924 JL
4.90b 1 140813 EL
4.90b 0 140813 NG
4.86 2 140606 AG
4.86 1 140527 JL
4.86 0 140519 AG
4.84 0 140321 EL
4.82 1 140228 EL
4.82 0 140218 JL
4.80f 0 140204 JL
4.80 1 131219
4.80 0 131105 JL
Revision Date By Description
Chapter ”20-pin J-Link connector“, section ”Pinout for SPI“ added. Chapter ”Related Software“
* Section ”Configure SWO output after device reset“ updated. Chapter ”Licensing“
* Section ”J-Trace for Cortex-M“ updated. Chapter ”Related Software“
* Section ”J-Link Commander“      Sub-Section ”Commands“ added. Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link script files“ updated
Chapter ”Related Software“ * Section ”GDB Server“      Exit code description added.
Chapter ”RTT“ added. Chapter ”Related Software“ * Section ”GDB Server“      Command line option ”-strict“ added.      Command line option ”-timeout“ added.
Chapter ”Related Software“ * Section ”J-Link Remote Server“ updated. * Section ”J-Scope“ updated.
Chapter ”Related Software“ * Section ”JTAGLoad“ updated.
Chapter ”Working with J-Link and J-Trace“ * Section ”Connecting multiple J-Links / J-Traces to your PC“ updated Chapter ”J-Link software“ * Section ”J-Link Configurator“ updated.
Chapter ”Related Software“ * Section ”J-Scope“ added.
Chapter ”Device specifics“ * Section ”Silicon Labs - EFM32 series devices“ added
Chapter ”Related Software“ * Section ”GDB Server“ Command line options -halt / -nohalt added. Description for GDB Server CL version added.
Chapter ”Flash download“ Section ”Mentor Sourcery CodeBench“ added.
Chapter ”Working with J-Link“ * Section ”Virtual COM Port (VCOM) improved. Chapter “Target interfaces and adapters” * Section “Pinout for SWD + Virtual COM Port (VCOM) added.”
Chapter “Related Software” * Section “Command line options”      Extended command line option -speed. Chapter “J-Link software and documentation package” * Section “J-Link STR91x Commander”      Added command line option parameter to specify a customized      scan-chain. Chapter “Working with J-Link” * Section “Virtual COM Port (VCOM) added. Chapter ”Setup“ * Section ”Getting started with J-Link and DS-5“
Chapter ”Related Software“ * Section ”GDB Server“ Command line option -notimeout added.
Chapter ”Related Software“ * Section ”GDB Server“      Command line options and remote commands added.
Chapter ”Related Software“
JL/
* Section ”GDB Server“      Remote commands and command line options description improved.
NG
Several corrections. Chapter ”Related Software“
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 9
Manual version
4.76 3 130823 JL
4.76 2 130821 JL
4.76 1 130819 JL
4.76 0 130809 JL
4.71b 0 130507 JL
4.66 0 130221 JL
4.62b 0 130219 EL
4.62 0 130129 JL
4.62 0 130124 EL
4.58 1 121206 AG
4.58 0 121126 JL
4.56b 0 121112 JL
4.56a 0 121106 JL
4.56 0 121022 AG
4.54 1 121009 JL
4.54 0 120913 EL
4.53c 0 120904 EL
4.51h 0 120717 EL
4.51e 1 120704 EL
4.51e 0 120704 AG
Revision Date By Description
* Section ”GDB Server“      SEGGER-specific GDB protocol extensions added.
Chapter ”Flash Download“ * Replaced references to GDB Server manual. Chapter ”Working with J-Link“ * Replaced references to GDB Server manual.
Chapter ”Related Software“ * Section ”GDB Server“      Remote commands added.
Chapter ”Related Software“ * Section ”SWO Viewer“      Sample code updated.
Chapter ”Related Software“ * Sections reordered and updated. Chapter ”Setup“ * Section ”Using JLinkARM.dll moved here.
Chapter “Related Software” * Section “SWO Viewer”      Added new command line options.
Chapter “Introduction” * Section “Supported OS”      Added Linux and Mac OSX
Chapter “Introduction” * Section “J-Link / J-Trace models”      Clock rise and fall times updated.
Chapter “Introduction” * Section “J-Link / J-Trace models”      Sub-section “J-link ULTRA” updated.
Chapter “Target interfaces and adapters” * Section “9-pin JTAG/SWD connector”      Pinout description corrected.
Chapter “Introduction” * Section “J-Link / J-Trace models” updated.
Chapter “Working with J-Link” * Section “J-Link script files”      Sub-section “Executing J-Link script files” updated.
Chapter “Related Software” * Section “J-Link SWO Viewer”      Added sub-section “Configure SWO output after device reset”
Chapter “Related Software” * Section “J-Link Commander”      Renamed “Commander script files” to “Commander files” and      “script mode” to “batch mode”.
Renamed “J-Link TCP/IP Server” to “J-Link Remote Server” Chapter “Related Software”
* Section “TCP/IP Server”, subsection “Tunneling Mode” added. Chapter “Flash Breakpoints”
* Section “Licensing” updated. Chapter “Device specifics” * Section “Freescale”, subsection “Data flash support” added.
Chapter “Licensing” * Section “Device-based license” updated.
Chapter “Flash download” * Section “J-Link commander” updated. Chapter “Support and FAQs” * Section “Frequently asked questions” updated. Chapter “J-Link and J-Trace related software” * Section “J-Link Commander” updated.
Chapter “Working with J-Link” * Section “Reset strategies” updated and corrected. Added reset type 8.
Chapter “Device specifics” * Section “ST” updated and corrected.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 10
10
Manual version
4.51b 0 120611 EL
4.51a 0 120606 EL
4.47a 0 120419 AG
4.46 0 120416 EL
4.42 0 120214 EL
4.36 1 110927 EL
4.36 0 110909 AG
4.26 1 110513 KN
4.26 0 110427 KN
4.24 1 110228 AG
4.24 0 110216 AG
4.23d 0 110202 AG
4.21g 0 101130 AG
4.21 0 101025 AG
4.20j 0 101019 AG
4.20b 0 100923 AG
0.00 90 100818 AG
0.00 89 100630 AG
0.00 88 100622 AG
Revision Date By Description
Chapter “J-Link and J-Trace related software” * Section “SWO Viewer” added.
Chapter “Device specifics” * Section “ST”, subsection “ETM init” for some STM32 devices added. * Section “Texas Instruments” updated. Chapter “Target interfaces and adapters” * Section “Pinout for SWD” updated.
Chapter “Device specifics” * Section “Texas Instruments” updated.
Chapter “Support” updated. Chapter “Working with J-Link”
* Section “J-Link script files” updated. Chapter “Flash download” added.
Chapter “Flash breakpoints” added. Chapter “Target interfaces and adapters” * Section “20-pin JTAG/SWD connector” updated. Chapter “RDI” added. Chapter “Setup” updated. Chapter “Device specifics” updated.
Chapter “Working with J-Link” * Section “J-Link script files” updated.
Chapter “Introduction” * Section “J-Link / J-Trace models” corrected.
Several corrections. Chapter “Introduction”
* Section “J-Link / J-Trace models” corrected. Chapter “Device specifics” * Section “ST Microelectronics” updated.
Chapter “Device specifics” * Section “Samsung” added. Chapter “Working with J-Link” * Section “Reset strategies” updated. Chapter “Target interfaces and adapters” * Section “9-pin JTAG/SWD connector” added.
Chapter “J-Link and J-Trace related software” * Section “J-Link software and documentation package in detail” updated. Chapter “Introduction” * Section “Built-in intelligence for supported CPU-cores” added.
Chapter “Working with J-Link” * Section “Reset strategies” updated. Chapter “Device specifics” * Section “Freescale” updated. Chapter “Flash download and flash breakpoints * Section ”Supported devices“ updated * Section ”Setup for different debuggers (CFI flash)“ updated.
Chapter ”Device specifics“ * Section ”Freescale“ updated.
Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated.
Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated.
Chapter ”Working with J-Link“ * Section ”J-Link script files“ updated. * Section ”J-Link Command Strings“ updated. Chapter ”Target interfaces and adapters“ * Section ”19-pin JTAG/SWD and Trace connector“ corrected. Chapter ”Setup“ * Section ”J-Link Configurator added.“
Several corrections. Chapter ”J-Link and J-Trace related software“
* Section ”SWO Analyzer“ added.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 11
11
Manual version
0.00 87 100617 AG
0.00 86 100504 AG
0.00 85 100428 AG
0.00 84 100324 KN
0.00 83 100223 KN
0.00 82 100215 AG
0.00 81 100202 KN
0.00 80 100104 KN
0.00 79 091201 AG
0.00 78 091023 AG
0.00 77 090910 AG
0.00 76 090828 KN
0.00 75 090729 AG
0.00 74 090722 KN
0.00 73 090701 KN
0.00 72 090618 AG
0.00 71 090616 AG
Revision Date By Description
Several corrections. Chapter ”Introduction“
* Section ”J-Link / J-Trace models“ updated. Chapter ”Target interfaces and adapters“ * Section ”Adapters“ updated.
Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated.
Chapter ”Working with J-Link and J-Trace“ * Several corrections Chapter Flash download & flash breakpoints * Section ”Supported devices“ updated
Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated.
Chapter ”Working with J-Link“ * Section ”J-Link script files“ added.
Chapter ”Device Specifics“ * Section ”Luminary Micro“ updated. Chapter ”Flash download and flash breakpoints“ * Section ”Supported devices“ updated.
Chapter ”Flash download and flash breakpoints * Section “Supported devices” updated
Chapter “Working with J-Link and J-Trace” * Section “Reset strategies” updated. Chapter “Licensing” * Section “J-Link OEM versions” updated.
Chapter “Licensing” * Section “J-Link OEM versions” updated.
Chapter “Introduction” * Section “J-Link / J-Trace models” updated.
Chapter “Introduction” * Section“ Specifications” updated * Section “Hardware versions” updated * Section “Common features of the J-Link product family” updated Chapter “Target interfaces and adapters” * Section “5 Volt adapter” updated
Chapter “Introduction” * Section “J-Link / J-Trace models” updated. Chapter “Working with J-Link and J-Trace” * Section “SWD interface” updated.
Chapter “Introduction” * Section “Supported IDEs” added * Section “Supported CPU cores” updated * Section “Model comparison chart” renamed to      “Model comparison” * Section “J-Link bundle comparison chart” removed
Chapter “Introduction” * Section “J-Link and J-Trace models” added * Sections “Model comparison chart” &      “J-Link bundle comparison chart”added Chapter “J-Link and J-Trace models” removed Chapter “Hardware” renamed to “Target interfaces & adapters” * Section “JTAG Isolator” added Chapter “Target interfaces and adapters” * Section “Target board design” updated Several corrections
Chapter “Working with J-Link” * Section “J-Link control panel” updated. Chapter “Flash download and flash breakpoints” * Section “Supported devices” updated. Chapter “Device specifics” * Section “NXP” updated.
Chapter “Device specifics” * Section “NXP” updated.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 12
12
Manual version
0.00 70 090605 AG
0.00 69 090515 AG
0.00 68 090428 AG
0.00 67 090402 AG
0.00 66 090327 AG
0.00 65 090320 AG
0.00 64 090313 AG
0.00 63 090212 AG
0.00 62 090211 AG
0.00 61 090120 TQ
0.00 60 090114 AG
0.00 59 090108 KN
0.00 58 090105 AG
0.00 57 081222 AG
0.00 56 081219 AG
0.00 55 081218 AG
0.00 54 081217 AG
0.00 53 081216 AG
0.00 52 081212 AG
0.00 51 081202 KN
0.00 50 081030 AG
0.00 49 081029 AG
Revision Date By Description
Chapter “Introduction” * Section “Common features of the J-Link product family” updated.
Chapter “Working with J-Link” * Section “Reset strategies” updated. * Section “Indicators” updated. Chapter “Flash download and flash breakpoints” * Section “Supported devices” updated.
Chapter “J-Link and J-Trace related software” * Section “J-Link STM32 Commander” added. Chapter “Working with J-Link” * Section “Reset strategies” updated.
Chapter “Working with J-Link” * Section “Reset strategies” updated.
Chapter “Background information” * Section “Embedded Trace Macrocell (ETM)” updated. Chapter “J-Link and J-Trace related software” * Section “Dedicated flash programming utilities for J-Link” updated.
Several changes in the manual structure. Chapter “Working with J-Link”
* Section “Indicators” added. Chapter “Hardware”
* Several corrections. * Section “Hardware Versions” Version 8.0 added.
Chapter “Working with J-Link and J-Trace” * Section “Reset strategies” updated. Chapter J-Link and J-Trace related software * Section “J-Link STR91x Commander (Command line tool)” updated. Chapter “Device specifics” * Section “ST Microelectronics” updated. Chapter “Hardware” updated.
Chapter “Working with J-Link” * Section “Cortex-M3 specific reset strategies”
Chapter “Working with J-Link” * Section “Cortex-M3 specific reset strategies”
Chapter Hardware * Section “Target board design for JTAG” updated. * Section “Target board design for SWD” added.
Chapter “Working with J-Link Pro” * Section “Connecting J-Link Pro the first time” updated.
Chapter “Working with J-Link Pro” * Section “Introduction” updated. * Section “Configuring J-Link Pro via web interface” updated. Chapter “Introduction” * Section “J-Link Pro overview” updated.
Chapter “Working with J-Link Pro” * Section “FAQs” added. Chapter “Support and FAQs” * Section “Frequently Asked Questions” updated.
Chapter “Hardware” updated. Chapter “Working with J-Link and J-Trace”
* Section “J-Link Command Strings” updated. Chapter “Working with J-Link Pro” updated. Chapter “Working with J-Link Pro” added.
Chapter “Licensing” * Section “Original SEGGER products” updated.
Several corrections. Chapter “Flash download and flash breakpoints”
* Section “Supported devices” corrected. Several corrections.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 13
13
Manual version
0.00 48 080916 AG
0.00 47 080910 AG
0.00 46 080904 AG
0.00 45 080902 AG
0.00 44 080827 AG
0.00 43 080826 AG
0.00 42 080820 AG
0.00 41 080811 AG
0.00 40 080630 AG
0.00 39 080627 AG
0.00 38 080618 AG
0.00 37 080617 AG
0.00 36 080530 AG
0.00 35 080215 AG
0.00 34 080212 AG
0.00 33 080207 AG
0.00 32 080129 SK
0.00 31 080103 SK
0.00 30 071211 AG
Revision Date By Description
Chapter “Working with J-Link and J-Trace” * Section “Connecting multiple J-Links /      J-Traces to your PC” updated.
Chapter “Licensing” updated. Chapter “Licensing” added.
Chapter “Hardware”      Section “J-Link OEM versions” moved to chapter “Licensing”
Chapter “Hardware”      Section “JTAG+Trace connector” JTAG+Trace      connector pinout corrected.      Section “J-Link OEM versions” updated.
Chapter “J-Link control panel” moved to chapter “Working with J-Link”. Several corrections.
Chapter “Flash download and flash breakpoints”      Section “Supported devices” updated.
Chapter “Flash download and flash breakpoints”      Section “Supported devices” updated.
Chapter “Flash download and flash breakpoints” updated. Chapter “Flash download and flash breakpoints”, section “Supported devices” updated.
Chapter “Flash download and flash breakpoints” updated. Chapter “J-Link status window” renamed to “J-Link control panel” Various corrections.
Chapter “Flash download and flash breakpoints”      Section “Licensing” updated.      Section “Using flash download and flash      breakpoints with different debuggers” updated. Chapter “J-Link status window” added.
Chapter “Support and FAQs”      Section “Frequently Asked Questions” updated Chapter “Reset strategies”      Section “Cortex-M3 specific reset strategies” updated.
Chapter “Reset strategies”      Section “Cortex-M3 specific reset strategies” updated.
Chapter “Hardware”      Section “Differences between different versions” updated. Chapter “Working with J-Link and J-Trace”      Section “Cortex-M3 specific reset strategies” added.
Chapter “J-Link and J-Trace related software”      Section “J-Link software and documentation package in detail” updated.
Chapter “J-Link and J-Trace related software”      Section “J-Link TCP/IP Server (Remote J-Link / J-Trace use)” updated. Chapter “Working with J-Link and J-Trace”      Section “J-Link Command Strings” updated. Chapter “Flash download and flash breakpoints”      Section “Introduction” updated.      Section “Licensing” updated.      Section “Using flash download and flash breakpoints with      different debuggers” updated.
Chapter “Flash download and flash breakpoints” added Chapter “Device specifics:”      Section “ATMEL - AT91SAM7 - Recommended init sequence” added.
Chapter “Device specifics”:      Section “NXP - LPC - Fast GPIO bug” list of device enhanced.
Chapter “Device specifics”:      Section “NXP - LPC - Fast GPIO bug” updated.
Chapter “Device specifics”:      Section “Analog Devices” updated.      Section “ATMEL” updated.      Section “Freescale” added.      Section “Luminary Micro” added.      Section “NXP” updated.      Section “OKI” added.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 14
14
Manual version
0.00 29 070912 SK
0.00 28 070912 SK
0.00 28 070912 AG
0.00 27 070827 TQ
0.00 26 070710 SK
0.00 25 070516 SK
0.00 24 070323 SK
0.00 23 070320 SK
0.00 22 070316 SK
0.00 21 070312 SK
0.00 20 070307 SK
0.00 19 070226 SK
0.00 18 070221 SK
0.00 17 070131 SK
0.00 16 061222 SK
0.00 15 060914 OO
0.00 14 060818 TQ
0.00 13 060711 OO
0.00 12 060628 OO
0.00 11 060607 SK
Revision Date By Description
     Section “ST Microelectronics” updated.      Section “Texas Instruments” updated. Chapter “Related software”:      Section “J-Link STR91x Commander” updated
Chapter “Hardware”, section “Target board design” updated. Chapter “Related software”:
     Section “J-LinkSTR91x Commander” added. Chapter “Device specifics”:      Section “ST Microelectronics” added.      Section “Texas Instruments” added.      Subsection “AT91SAM9” added.
Chapter “Working with J-Link/J-Trace”:      Section “J-Link Command Strings” updated.
Chapter “Working with J-Link/J-Trace”:      Section “J-Link Command Strings” updated.
Chapter “Introduction”:      Section “Features of J-Link” updated. Chapter “Background Information”:      Section “Embedded Trace Macrocell” added.      Section “Embedded Trace Buffer” added.
Chapter “Working with J-Link/J-Trace”:      Section “Reset strategies in detail”
       - “Software, for Analog Devices ADuC7xxx MCUs” updated
       - “Software, for ATMEL AT91SAM7 MCUs” added. Chapter “Device specifics”      Section “Analog Devices” added.      Section “ATMEL” added.
Chapter “Setup”:      “Uninstalling the J-Link driver” updated.      “Supported ARM cores” updated.
Chapter “Hardware”:      “Using the JTAG connector with SWD” updated.
Chapter “Hardware”:      “Using the JTAG connector with SWD” added.
Chapter “Hardware”:      “Differences between different versions” supplemented.
Chapter “J-Link / J-Trace related software”:      “J-Link GDB Server” licensing updated.
Chapter “J-Link / J-Trace related software” updated and reorganized. Chapter “Hardware”      “List of OEM products” updated
Chapter “Device specifics” added Subchapter “J-Link Command Strings” added
Chapter “Hardware”:      “Version 5.3”: Current limits added      “Version 5.4” added Chapter “Setup”:      “Installing the J-Link USB driver” removed.      “Installing the J-Link software and documentation pack” added. Subchapter “List of OEM products” updated. “OS support” updated
Chapter “Preface”: “Company description” added. J-Link picture changed.
Subchapter 1.5.1: Added target supply voltage and target supply current to specifications. Subchapter 5.2.1: Pictures of ways to connect J-Trace.
Subchapter 4.7 “Using DCC for memory reads” added.
Subchapter 5.2.2: Corrected JTAG+Trace connector pinout table.
Subchapter 4.1: Added ARM966E-S to List of supported ARM cores. Subchapter 5.5.2.2 changed.
Subchapter 5.5.2.3 added.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 15
15
Manual version
0.00 10 060526 SK
0.00 9 060324 OO
0.00 8 060117 OO
0.00 7 051208 OO
0.00 6 051118 OO
0.00 5 051103 TQ
0.00 4 051025 OO
0.00 3 051021 TQ
0.00 2 051011 TQ
0.00 1 050818 TW
Revision Date By Description
ARM9 download speed updated. Subchapter 8.2.1: Screenshot “Start sequence” updated. Subchapter 8.2.2 “ID sequence” removed. Chapter “Support” and “FAQ” merged. Various improvements
Chapter “Literature and references” added. Chapter “Hardware”:      Added common information trace signals.      Added timing diagram for trace. Chapter “Designing the target board for trace” added.
Chapter “Related Software”: Added JLinkARM.dll. Screenshots updated.
Chapter Working with J-Link: Sketch added. Chapter Working with J-Link: “Connecting multiple J-Links to your PC”
added. Chapter Working with J-Link: “Multi core debugging” added. Chapter Background information: “J-Link firmware” added.
Chapter Setup: “JTAG Speed” added. Chapter Background information: “Flash programming” added.
Chapter Setup: “Scan chain configuration” added. Some smaller changes.
Performance values updated.
Chapter “Working with J-Link” added.
Initial Version
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 16
16
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 17
17

About this document

Assumptions
This document assumes that you already have a solid knowledge of the following:
The software tools used for building your application (assembler, linker, C compiler).
The C programming language.
The target processor.
DOS command line. If you feel that your knowledge of C is not sufficient, we recommend The C Programming Lan-
guage by Kernighan and Richie (ISBN 0--13--1103628), which describes the standard in C pro­gramming and, in newer editions, also covers the ANSI C standard.
How to use this manual
This manual explains all the functions and macros that the product offers. It assumes you have a working knowledge of the C language. Knowledge of assembly programming is not required.
Typographic conventions for syntax
This manual uses the following typographic conventions:
Style Used for
Body Body text.
Keyword
Parameter Parameters in API functions.
Sample Sample code in program examples.
Sample comment Comments in program examples.
Reference
GUIElement Buttons, dialog boxes, menu names, menu commands. Emphasis Very important sections.
Text that you enter at the command prompt or that appears on the display (that is system functions, file- or pathnames).
Reference to chapters, sections, tables and figures or other doc­uments.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 18
18
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 19
19

Table of contents

1 Introduction ..................................................................................................................28
1.1 Requirements .............................................................................................. 29
1.2 Supported OS ..............................................................................................30
1.3 Common features of the J-Link product family .................................................31
1.4 Supported CPU cores ....................................................................................32
1.5 Built-in intelligence for supported CPU-cores ....................................................33
1.5.1 Intelligence in the J-Link firmware ...................................................... 33
1.5.2 Intelligence on the PC-side (DLL) ........................................................ 33
1.5.3 Firmware intelligence per model ..........................................................34
1.6 Where to find further information ...................................................................35
1.6.1 SEGGER debug probes .......................................................................35
1.6.2 Using a feature in a specific development environment .......................... 35
2 Licensing .....................................................................................................................36
2.1 Components requiring a license ..................................................................... 37
2.2 Legal use of SEGGER J-Link software ............................................................. 38
2.2.1 Use of the software with 3rd party tools .............................................. 38
2.3 Illegal Clones ...............................................................................................39
3 J-Link software and documentation package .............................................................40
3.1 Software overview ........................................................................................41
3.2 J-Link Commander (Command line tool) ......................................................... 42
3.2.1 Commands ....................................................................................... 42
3.2.2 Command line options ....................................................................... 60
3.2.3 Using J-Link Command Files ...............................................................63
3.3 J-Link Remote Server ................................................................................... 64
3.3.1 List of available commands ................................................................ 64
3.3.2 Tunneling mode ................................................................................ 65
3.3.3 Connecting to J-Link/ J-Trace using J-Link Remote Server .......................66
3.3.4 Encrypted connection .........................................................................68
3.4 J-Mem Memory Viewer ................................................................................. 69
3.5 J-Flash ........................................................................................................70
3.6 J-Flash Lite ................................................................................................. 71
3.6.1 Limitations in comparison to J-Flash .................................................... 71
3.6.2 Usage .............................................................................................. 71
3.7 J-Link RTT Viewer ........................................................................................ 73
3.7.1 RTT Viewer Startup ........................................................................... 73
3.7.2 Connection Settings ...........................................................................74
3.7.3 The Terminal Tabs ............................................................................. 74
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 20
20
3.7.4 Sending Input ...................................................................................75
3.7.5 Logging Terminal output .................................................................... 75
3.7.6 Logging Data ....................................................................................75
3.7.7 Command line options ....................................................................... 76
3.7.8 Menus and Shortcuts ......................................................................... 78
3.7.9 Using "virtual" Terminals in RTT ..........................................................80
3.7.10 Using Text Control Codes ................................................................. 80
3.8 J-Link SWO Viewer .......................................................................................81
3.8.1 J-Link SWO Viewer CL ....................................................................... 81
3.8.2 Usage .............................................................................................. 82
3.8.3 List of available command line options .................................................82
3.8.4 Configure SWO output after device reset ..............................................84
3.8.5 Target example code for terminal output .............................................. 85
3.9 SWO Analyzer ..............................................................................................87
3.10 JTAGLoad (Command line tool) .................................................................... 88
3.11 J-Link RDI (Remote Debug Interface) ........................................................... 90
3.11.1 Flash download and flash breakpoints ................................................ 90
3.12 Processor specific tools ............................................................................... 91
3.12.1 J-Link STR91x Commander (Command line tool) ................................. 91
3.12.2 J-Link STM32 Unlock (Command line tool) ..........................................94
3.13 J-Link Software Developer Kit (SDK) .............................................................97
4 J-Link GDB Server ......................................................................................................98
4.1 J-Link GDB Server CL (Windows, Linux, Mac) .................................................100
4.2 Debugging with J-Link GDB Server ............................................................... 101
4.2.1 Setting up GDB Server GUI version ................................................... 101
4.2.2 Setting up GDB Server CL version ..................................................... 101
4.2.3 GDB Server user interface ................................................................102
4.2.4 Running GDB from different programs ................................................103
4.3 Supported remote (monitor) commands ........................................................ 106
4.3.1 clrbp .............................................................................................. 107
4.3.2 cp15 .............................................................................................. 108
4.3.3 device ............................................................................................ 108
4.3.4 DisableChecks .................................................................................108
4.3.5 EnableChecks ..................................................................................109
4.3.6 flash breakpoints .............................................................................109
4.3.7 flash erase ..................................................................................... 109
4.3.8 getargs .......................................................................................... 109
4.3.9 go ................................................................................................. 109
4.3.10 halt ..............................................................................................110
4.3.11 interface ....................................................................................... 110
4.3.12 jtagconf ........................................................................................110
4.3.13 memU8 ........................................................................................ 111
4.3.14 memU16 .......................................................................................111
4.3.15 memU32 .......................................................................................111
4.3.16 reg .............................................................................................. 112
4.3.17 regs ............................................................................................. 112
4.3.18 reset ............................................................................................ 112
4.3.19 semihosting breakOnError ...............................................................113
4.3.20 semihosting enable ........................................................................113
4.3.21 semihosting IOClient ......................................................................113
4.3.22 semihosting ARMSWI ..................................................................... 114
4.3.23 semihosting ThumbSWI .................................................................. 114
4.3.24 setargs .........................................................................................114
4.3.25 setbp ........................................................................................... 115
4.3.26 sleep ............................................................................................115
4.3.27 speed ...........................................................................................115
4.3.28 step ............................................................................................. 116
4.3.29 SWO DisableTarget .........................................................................116
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 21
21
4.3.30 SWO EnableTarget ......................................................................... 116
4.3.31 SWO GetMaxSpeed ........................................................................117
4.3.32 SWO GetSpeedInfo ........................................................................ 117
4.3.33 waithalt ........................................................................................ 117
4.3.34 wice ............................................................................................. 118
4.3.35 ReadAP .........................................................................................118
4.3.36 ReadDP ........................................................................................ 118
4.3.37 WriteAP ........................................................................................ 119
4.3.38 WriteDP ........................................................................................119
4.4 SEGGER-specific GDB protocol extensions ..................................................... 121
4.5 Command line options ................................................................................ 122
4.5.1 -cpu ...............................................................................................123
4.5.2 -device ...........................................................................................124
4.5.3 -endian .......................................................................................... 124
4.5.4 -gui ............................................................................................... 125
4.5.5 -if ..................................................................................................125
4.5.6 -ir ..................................................................................................125
4.5.7 -excdbg ..........................................................................................125
4.5.8 -jtagconf ........................................................................................ 126
4.5.9 -localhostonly ..................................................................................126
4.5.10 -log ..............................................................................................126
4.5.11 -logtofile .......................................................................................127
4.5.12 -halt .............................................................................................127
4.5.13 -nogui .......................................................................................... 127
4.5.14 -noir ............................................................................................ 127
4.5.15 -nolocalhostonly ............................................................................ 128
4.5.16 -nologtofile ................................................................................... 128
4.5.17 -nohalt ......................................................................................... 128
4.5.18 -noreset ....................................................................................... 129
4.5.19 -nosinglerun ..................................................................................129
4.5.20 -nosilent ....................................................................................... 129
4.5.21 -nostayontop .................................................................................129
4.5.22 -notimeout ....................................................................................130
4.5.23 -novd ........................................................................................... 130
4.5.24 -port ............................................................................................ 130
4.5.25 -rtos ............................................................................................ 130
4.5.26 -JLinkDevicesXMLPath .................................................................... 131
4.5.27 -jlinkscriptfile ................................................................................ 131
4.5.28 -powertarget ................................................................................. 131
4.5.29 -select ..........................................................................................131
4.5.30 -settingsfile ...................................................................................132
4.5.31 -silent .......................................................................................... 132
4.5.32 -singlerun ..................................................................................... 132
4.5.33 -speed ..........................................................................................132
4.5.34 -stayontop .................................................................................... 133
4.5.35 -timeout ....................................................................................... 133
4.5.36 -strict ...........................................................................................133
4.5.37 -swoport .......................................................................................134
4.5.38 -telnetport .................................................................................... 134
4.5.39 -vd .............................................................................................. 134
4.5.40 -x ................................................................................................ 134
4.5.41 -xc ...............................................................................................135
4.6 Program termination ...................................................................................136
4.6.1 Exit codes ...................................................................................... 136
4.7 Semihosting ...............................................................................................137
5 J-Mem ....................................................................................................................... 138
5.1 Setting up J-Mem .......................................................................................139
5.2 J-Mem user interface .................................................................................. 140
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 22
22
5.2.1 Go To .............................................................................................140
5.2.2 Access width ...................................................................................140
5.2.3 Fill memory .................................................................................... 140
5.2.4 Save memory data .......................................................................... 141
5.2.5 Periodic Refresh .............................................................................. 141
5.2.6 Command line options ..................................................................... 142
6 Setup .........................................................................................................................143
6.1 Installing the J-Link software and documentation pack .................................... 144
6.1.1 Setup procedure ..............................................................................144
6.2 Setting up the USB interface ....................................................................... 145
6.2.1 Verifying correct driver installation .....................................................145
6.2.2 Uninstalling the J-Link USB driver ......................................................146
6.3 Setting up the IP interface .......................................................................... 148
6.3.1 Configuring J-Link using J-Link Configurator ........................................148
6.3.2 Configuring J-Link using the webinterface ........................................... 148
6.4 FAQs .........................................................................................................150
6.5 J-Link Configurator ..................................................................................... 151
6.5.1 Configure J-Links using the J-Link Configurator ................................... 151
6.6 J-Link USB identification ..............................................................................153
6.6.1 Connecting to different J-Links connected to the same host PC via USB ... 153
6.7 Using the J-Link DLL ...................................................................................154
6.7.1 What is the JLink DLL? .................................................................... 154
6.7.2 Updating the DLL in third-party programs ...........................................154
6.7.3 Determining the version of JLink DLL ................................................. 154
6.7.4 Determining which DLL is used by a program ......................................155
7 Working with J-Link and J-Trace ..............................................................................156
7.1 J-Link WiFi setup ........................................................................................157
7.2 Supported IDEs ..........................................................................................158
7.3 Connecting the target system ...................................................................... 159
7.3.1 Power-on sequence ..........................................................................159
7.3.2 Verifying target device connection ..................................................... 159
7.3.3 Problems ........................................................................................ 159
7.4 Indicators .................................................................................................. 160
7.4.1 Main indicator ................................................................................. 160
7.4.2 Input indicator ................................................................................ 160
7.4.3 Output indicator .............................................................................. 161
7.5 JTAG interface ............................................................................................162
7.5.1 Multiple devices in the scan chain ..................................................... 162
7.5.2 Sample configuration dialog boxes .....................................................162
7.5.3 Determining values for scan chain configuration .................................. 164
7.5.4 JTAG Speed .................................................................................... 165
7.6 SWD interface ............................................................................................166
7.6.1 SWD speed .....................................................................................166
7.6.2 SWO .............................................................................................. 166
7.7 Multi-core debugging .................................................................................. 168
7.7.1 How multi-core debugging works .......................................................168
7.7.2 Using multi-core debugging in detail ..................................................169
7.7.3 Things you should be aware of ......................................................... 170
7.8 Connecting multiple J-Links / J-Traces to your PC ........................................... 171
7.8.1 How does it work? .......................................................................... 171
7.9 J-Link control panel .................................................................................... 173
7.9.1 Tabs ...............................................................................................173
7.10 Reset strategies ........................................................................................179
7.10.1 Strategies for ARM 7/9 devices ....................................................... 179
7.10.2 Strategies for Cortex-M devices ....................................................... 180
7.11 Using DCC for memory access ................................................................... 184
7.11.1 What is required? .......................................................................... 184
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 23
23
7.11.2 Target DCC handler ........................................................................184
7.11.3 Target DCC abort handler ............................................................... 184
7.12 The J-Link settings file .............................................................................. 185
7.12.1 SEGGER Embedded Studio ..............................................................185
7.12.2 Keil MDK-ARM (uVision) ................................................................. 185
7.12.3 IAR EWARM .................................................................................. 185
7.12.4 Mentor Sourcery CodeBench for ARM ............................................... 185
7.13 J-Link script files ...................................................................................... 186
7.13.1 Actions that can be customized ....................................................... 186
7.13.2 Script file API functions .................................................................. 193
7.13.3 Global DLL variables ...................................................................... 216
7.13.4 Global DLL constants ..................................................................... 220
7.13.5 Script file language ........................................................................ 222
7.13.6 Script file writing example .............................................................. 223
7.13.7 Executing J-Link script files .............................................................224
7.14 J-Link Command Strings ............................................................................225
7.14.1 List of available commands .............................................................225
7.14.2 Using J-Link Command Strings ........................................................ 248
7.15 Switching off CPU clock during debug ......................................................... 249
7.16 Cache handling .........................................................................................250
7.16.1 Cache coherency ........................................................................... 250
7.16.2 Cache clean area ...........................................................................250
7.16.3 Cache handling of ARM7 cores ........................................................ 250
7.16.4 Cache handling of ARM9 cores ........................................................ 250
7.17 Virtual COM Port (VCOM) ...........................................................................251
7.17.1 Configuring Virtual COM Port ...........................................................251
8 Flash download .........................................................................................................253
8.1 Introduction ...............................................................................................254
8.2 Licensing ................................................................................................... 255
8.3 Supported devices ......................................................................................256
8.4 Setup for various debuggers (internal flash) .................................................. 257
8.5 Setup for various debuggers (CFI flash) ........................................................ 258
8.6 Setup for various debuggers (SPIFI flash) ..................................................... 259
8.7 QSPI flash support ..................................................................................... 260
8.7.1 Setup the DLL for QSPI flash download ..............................................260
8.8 Using the DLL flash loaders in custom applications ......................................... 261
8.9 Debugging applications that change flash contents at runtime .......................... 262
9 Flash breakpoints ......................................................................................................263
9.1 Introduction ...............................................................................................264
9.2 Licensing ................................................................................................... 265
9.2.1 Free for evaluation and non-commercial use ....................................... 265
9.3 Supported devices ......................................................................................266
9.4 Setup & compatibility with various debuggers ................................................ 267
9.4.1 Setup .............................................................................................267
9.4.2 Compatibility with various debuggers ................................................. 267
9.5 Flash Breakpoints in QSPI flash ....................................................................268
9.5.1 Setup .............................................................................................268
9.6 FAQ .......................................................................................................... 269
10 Monitor Mode Debugging ....................................................................................... 270
10.1 Introduction ............................................................................................. 271
10.2 Enable Monitor Debugging ......................................................................... 272
10.3 Availability and limitations of monitor mode .................................................273
10.3.1 Cortex-M3 .....................................................................................273
10.3.2 Cortex-M4 .....................................................................................273
10.4 Monitor code ............................................................................................274
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 24
24
10.5 Debugging interrupts ................................................................................ 275
10.6 Having servicing interrupts in debug mode .................................................. 276
10.7 Forwarding of Monitor Interrupts ................................................................ 277
10.8 Target application performs reset (Cortex-M) ............................................... 278
11 Low Power Debugging ............................................................................................279
11.1 Introduction ............................................................................................. 280
11.2 Activating low power mode handling for J-Link ............................................. 281
11.3 Restrictions ..............................................................................................282
12 Open Flashloader ................................................................................................... 283
12.1 Introduction ............................................................................................. 284
12.2 General procedure .................................................................................... 285
12.3 Adding a new device .................................................................................286
12.4 Editing/Extending an Existing Device ...........................................................287
12.5 XML Tags and Attributes ............................................................................288
12.5.1 <Database> ..................................................................................288
12.5.2 <Device> ..................................................................................... 288
12.5.3 <ChipInfo> ...................................................................................288
12.5.4 <FlashBankInfo> ...........................................................................290
12.6 Example XML file ......................................................................................292
12.7 Add. Info / Considerations / Limitations ....................................................... 293
12.7.1 CMSIS Flash Algorithms Compatibility .............................................. 293
12.7.2 Supported Cores ............................................................................293
12.7.3 Information for Silicon Vendors ....................................................... 293
12.7.4 Template Projects and How To's ...................................................... 293
13 J-Flash SPI ............................................................................................................. 294
13.1 Introduction ............................................................................................. 295
13.1.1 What is J-Flash SPI? ...................................................................... 295
13.1.2 J-Flash SPI CL (Windows, Linux, Mac) .............................................. 295
13.1.3 Features ....................................................................................... 296
13.1.4 Requirements ................................................................................296
13.2 Licensing ................................................................................................. 297
13.2.1 Introduction .................................................................................. 297
13.3 Getting Started ........................................................................................ 298
13.3.1 Setup ........................................................................................... 298
13.3.2 Using J-Flash SPI for the first time .................................................. 298
13.3.3 Menu structure ..............................................................................299
13.4 Settings ...................................................................................................302
13.4.1 Project Settings .............................................................................302
13.4.2 Global Settings ..............................................................................306
13.5 Command Line Interface ........................................................................... 308
13.5.1 Overview ...................................................................................... 308
13.5.2 Command line options ....................................................................308
13.5.3 Batch processing ........................................................................... 310
13.5.4 Programming multiple targets in parallel ...........................................310
13.6 Creating a new J-Flash SPI project ............................................................. 313
13.7 Custom Command Sequences .................................................................... 314
13.7.1 Init / Exit steps .............................................................................314
13.7.2 Example ....................................................................................... 314
13.7.3 J-Flash SPI Command Line Version .................................................. 315
13.8 Device specifics ........................................................................................ 318
13.8.1 SPI flashes with multiple erase commands ........................................ 318
13.9 Target systems .........................................................................................319
13.9.1 Which flash devices can be programmed? .........................................319
13.10 Performance ...........................................................................................320
13.10.1 Performance values ......................................................................320
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 25
25
13.11 Background information ...........................................................................321
13.11.1 SPI interface connection ............................................................... 321
13.12 Support ................................................................................................. 322
13.12.1 Troubleshooting ........................................................................... 322
13.12.2 Contacting support .......................................................................322
14 RDI ..........................................................................................................................323
14.1 Introduction ............................................................................................. 324
14.1.1 Features ....................................................................................... 324
14.2 Licensing ................................................................................................. 325
14.3 Setup for various debuggers ...................................................................... 326
14.3.1 ARM AXD (ARM Developer Suite, ADS) .............................................326
14.3.2 ARM RVDS (RealView developer suite) ..............................................328
14.3.3 GHS MULTI ................................................................................... 333
14.4 Configuration ........................................................................................... 336
14.4.1 Configuration file JLinkRDI.ini ..........................................................336
14.4.2 Using different configurations ..........................................................336
14.4.3 Using multiple J-Links simultaneously ...............................................336
14.4.4 Configuration dialog ....................................................................... 336
14.5 Semihosting ............................................................................................. 345
14.5.1 Unexpected / unhandled SWIs .........................................................345
15 ARM SWD specifics ................................................................................................346
15.1 Introduction ............................................................................................. 347
15.2 SWD multi-drop ....................................................................................... 348
15.2.1 How it works ................................................................................ 348
15.2.2 Setting up SWD multi-drop in the J-Link software .............................. 348
15.2.3 J-Link support ............................................................................... 348
16 RTT ......................................................................................................................... 349
16.1 Introduction ............................................................................................. 350
16.2 How RTT works ........................................................................................ 351
16.2.1 Target implementation ....................................................................351
16.2.2 Locating the Control Block .............................................................. 351
16.2.3 Internal structures .........................................................................351
16.2.4 Requirements ................................................................................352
16.2.5 Performance ..................................................................................352
16.2.6 Memory footprint ...........................................................................352
16.3 RTT Communication .................................................................................. 353
16.3.1 RTT Viewer ................................................................................... 353
16.3.2 RTT Client .....................................................................................353
16.3.3 RTT Logger ................................................................................... 353
16.3.4 RTT in other host applications ......................................................... 354
16.4 Implementation ........................................................................................ 355
16.4.1 API functions ................................................................................ 355
16.4.2 Configuration defines ..................................................................... 361
16.5 ARM Cortex - Background memory access ................................................... 363
16.6 Example code .......................................................................................... 364
16.7 FAQ ........................................................................................................ 365
17 Trace .......................................................................................................................366
17.1 Introduction ............................................................................................. 367
17.1.1 What is backtrace? ........................................................................ 367
17.1.2 What is streaming trace? ................................................................367
17.1.3 What is code coverage? ..................................................................367
17.1.4 What is code profiling? ...................................................................368
17.2 Tracing via trace pins ................................................................................369
17.2.1 Cortex-M specifics ..........................................................................369
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 26
26
17.2.2 Trace signal timing ........................................................................ 369
17.2.3 Adjusting trace signal timing on J-Trace ............................................369
17.2.4 J-Trace models with support for streaming trace ................................ 370
17.3 Tracing with on-chip trace buffer ................................................................ 371
17.3.1 CPUs that provide tracing via pins and on-chip buffer ......................... 371
17.4 Target devices with trace support ............................................................... 372
17.5 Streaming trace ....................................................................................... 373
17.5.1 Download and execution address differ .............................................373
17.5.2 Do streaming trace without prior download ....................................... 373
18 Target interfaces and adapters ...............................................................................374
18.1 20-pin J-Link connector ............................................................................. 375
18.1.1 Pinout for JTAG ............................................................................. 375
18.1.2 Pinout for SWD ............................................................................. 377
18.1.3 Pinout for SWD + Virtual COM Port (VCOM) ...................................... 379
18.1.4 Pinout for SPI ............................................................................... 380
18.2 19-pin JTAG/SWD and Trace connector ........................................................381
18.2.1 Connecting the target board ........................................................... 382
18.2.2 Target power supply ...................................................................... 382
18.3 9-pin JTAG/SWD connector ........................................................................ 384
18.4 Reference voltage (VTref) .......................................................................... 385
18.5 Adapters ..................................................................................................386
19 Background information ..........................................................................................387
19.1 JTAG ....................................................................................................... 388
19.1.1 Test access port (TAP) ....................................................................388
19.1.2 Data registers ............................................................................... 388
19.1.3 Instruction register ........................................................................ 388
19.1.4 The TAP controller ......................................................................... 388
19.2 Embedded Trace Macrocell (ETM) ................................................................391
19.2.1 Trigger condition ............................................................................391
19.2.2 Code tracing and data tracing ......................................................... 391
19.2.3 J-Trace integration example - IAR Embedded Workbench for ARM .........391
19.3 Embedded Trace Buffer (ETB) .................................................................... 395
19.4 Flash programming ...................................................................................396
19.4.1 How does flash programming via J-Link / J-Trace work? ...................... 396
19.4.2 Data download to RAM ...................................................................396
19.4.3 Data download via DCC ..................................................................396
19.4.4 Available options for flash programming ........................................... 396
19.5 J-Link / J-Trace firmware ........................................................................... 398
19.5.1 Firmware update ........................................................................... 398
19.5.2 Invalidating the firmware ................................................................398
20 Designing the target board for trace .......................................................................400
20.1 Overview of high-speed board design ..........................................................401
20.1.1 Avoiding stubs ...............................................................................401
20.1.2 Minimizing Signal Skew (Balancing PCB Track Lengths) ....................... 401
20.1.3 Minimizing Crosstalk ...................................................................... 401
20.1.4 Using impedance matching and termination ...................................... 401
20.2 Terminating the trace signal .......................................................................402
20.2.1 Rules for series terminators ............................................................ 402
20.3 Signal requirements ..................................................................................403
21 Semihosting .............................................................................................................404
21.1 Introduction ............................................................................................. 405
21.1.1 Advantages ...................................................................................405
21.1.2 Disadvantages ...............................................................................405
21.2 Debugger support .....................................................................................406
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 27
27
21.3 Implementation ........................................................................................ 407
21.3.1 SVC instruction ............................................................................. 407
21.3.2 Breakpoint instruction .................................................................... 407
21.3.3 J-Link GDBServer optimized version .................................................407
21.4 Communication protocol ............................................................................ 410
21.4.1 Register R0 ...................................................................................410
21.4.2 Command SYS_OPEN (0x01) .......................................................... 410
21.4.3 Command SYS_CLOSE (0x02) .........................................................411
21.4.4 Command SYS_WRITEC (0x03) ....................................................... 411
21.4.5 Command SYS_WRITE0 (0x04) ....................................................... 412
21.4.6 Command SYS_WRITE (0x05) .........................................................412
21.4.7 Command SYS_READ (0x06) .......................................................... 412
21.4.8 Command SYS_READC (0x07) .........................................................413
21.4.9 Command SYS_ISTTY (0x09) .......................................................... 413
21.4.10 Command SYS_SEEK (0x0A) ......................................................... 413
21.4.11 Command SYS_FLEN (0x0C) ......................................................... 414
21.4.12 Command SYS_REMOVE (0x0E) .....................................................414
21.4.13 Command SYS_RENAME (0x0F) .....................................................414
21.4.14 Command SYS_GET_CMDLINE (0x15) ............................................ 415
21.4.15 Command SYS_EXIT (0x18) ..........................................................415
21.5 Enabling semihosting in J-Link GDBServer ................................................... 416
21.5.1 SVC variant .................................................................................. 416
21.5.2 Breakpoint variant ......................................................................... 416
21.5.3 J-Link GDBServer optimized variant ................................................. 416
21.6 Enabling Semihosting in J-Link RDI + AXD .................................................. 417
21.6.1 Using SWIs in your application ........................................................ 417
22 Environmental Conditions & Safety ........................................................................418
22.1 J-Link ......................................................................................................419
22.1.1 Affected models .............................................................................419
22.2 Flasher .................................................................................................... 420
22.2.1 Affected models .............................................................................420
22.3 J-Trace .................................................................................................... 421
22.3.1 Affected models .............................................................................421
23 Support and FAQs ..................................................................................................422
23.1 Measuring download speed ........................................................................ 423
23.2 Troubleshooting ........................................................................................ 424
23.2.1 General procedure ......................................................................... 424
23.3 Contacting support ................................................................................... 425
23.3.1 Contact Information .......................................................................425
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 28
Chapter 1 Introduction
This is the user documentation for owners of SEGGER debug probes, J-Link and J-Trace. This manual documents the software which with the J-Link Software and Documentation Package as well as advanced features of J-Link and J-Trace, like Real Time Transfer (RTT),
J-Link Script Files or Trace.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 29

29 CHAPTER 1 Requirements

1.1 Requirements
Host System
To use J-Link or J-Trace you need a host system running Windows 2000 or later. For a list of all operating systems which are supported by J-Link, please refer to Supported OS on page 30.
Target System
A target system with a supported CPU is required. You should make sure that the emulator you are looking at supports your target CPU. For more information about which J-Link fea­tures are supported by each emulator, please refer to SEGGER debug probes on page 35.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 30

30 CHAPTER 1 Supported OS

1.2 Supported OS
J-Link/J-Trace can be used on the following operating systems:
Microsoft Windows 2000
Microsoft Windows XP
Microsoft Windows XP x64
Microsoft Windows 2003
Microsoft Windows 2003 x64
Microsoft Windows Vista
Microsoft Windows Vista x64
Microsoft Windows 7
Microsoft Windows 7 x64
Microsoft Windows 8
Microsoft Windows 8 x64
Microsoft Windows 10
Microsoft Windows 10 x64
Linux
macOS 10.5 and higher
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 31

31 CHAPTER 1 Common features of the J-Link product family

1.3 Common features of the J-Link product family
USB 2.0 interface (Full-Speed/Hi-Speed, depends on J-Link model)
Any ARM7/ARM9/ARM11 (including thumb mode), Cortex-A5/A7/A8/A9/A12/A15/A17, Cortex-M0/M1/M3/M4/M7/M23/M33, Cortex-R4/R5 core supported
Automatic core recognition
Maximum interface speed 15/50 MHz (depends on J-Link model)
Seamless integration into all major IDEs ( List of supported IDEs )
No power supply required, powered through USB
Support for adaptive clocking
All JTAG signals can be monitored, target voltage can be measured
Support for multiple devices
Fully plug and play compatible
Standard 20-pin JTAG/SWD connector, 19-pin JTAG/SWD and Trace connector, standard 38-pin JTAG+Trace connector
USB and 20-pin ribbon cable included
Memory viewer (J-Mem) included
Remote server included, which allows using J-Trace via TCP/IP networks
RDI interface available, which allows using J-Link with RDI compliant software
Flash programming software (J-Flash) available
Flash DLL available, which allows using flash functionality in custom applications
Software Developer Kit (SDK) available
14-pin JTAG adapter available
J-Link 19-pin Cortex-M Adapter available
J-Link 9-pin Cortex-M Adapter available
Adapter for 5V JTAG targets available for hardware revisions up to 5.3
Optical isolation adapter for JTAG/SWD interface available
Target power supply via pin 19 of the JTAG/SWD interface (up to 300 mA to target with overload protection), alternatively on pins 11 and 13 of the Cortex-M 19-pin trace connector
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 32

32 CHAPTER 1 Supported CPU cores

1.4 Supported CPU cores
J-Link / J-Trace supports any common ARM Cortex core, ARM legacy core, Microchip PIC32 core and Renesas RX core. For a detailed list, please refer to:
SEGGER website: Supported Cores .
If you experience problems with a particular core, do not hesitate to contact SEGGER.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 33

33 CHAPTER 1 Built-in intelligence for supported CPU-cores

1.5 Built-in intelligence for supported CPU-cores
In general, there are two ways to support a CPU-core in the J-Link software:
1. Intelligence in the J-Link firmware
2. Intelligence on the PC-side (DLL)
Having the intelligence in the firmware is ideal since it is much more powerful and robust. The J-Link PC software automatically detects which implementation level is supported for the connected CPU-core. If intelligence in the firmware is available, it is used. If you are using a J-Link that does not have intelligence in the firmware and only PC-side intelligence is available for the connected CPU, a warning message is shown.
1.5.1 Intelligence in the J-Link firmware
On newer J-Links, the intelligence for a new CPU-core is also available in the J-Link firmware which means that for these J-Links, the target sequences are no longer generated on the PC­side but directly inside the J-Link. Having the intelligence in the firmware leads to improved stability and higher performance.
1.5.2 Intelligence on the PC-side (DLL)
This is the basic implementation level for support of a CPU-core. This implementation is not J-Link model dependent, since no intelligence for the CPU-core is necessary in the J­Link firmware. This means, all target sequences (JTAG/SWD/…) are generated on the PC­side and the J-Link simply sends out these sequences and sends the result back to the DLL. Using this way of implementation also allows old J-Links to be used with new CPU cores as long as a DLL-Version is used which has intelligence for the CPU.
But there is one big disadvantage of implementing the CPU core support on the DLL-side: For every sequence which shall be sent to the target a USB or Ethernet transaction is triggered. The long latency especially on a USB connection significantly affects the perfor­mance of J-Link. This is true especially when performing actions where J-Link has to wait for the CPU frequently. An example is a memory read/write operation which needs to be followed by status read operations or repeated until the memory operation is completed. Performing this kind of task with only PC-side intelligence requires to either make some assumption like: Operation is completed after a given number of cycles. Or it requires to make a lot of USB/Ethernet transactions. The first option (fast mode) will not work under some circumstances such as low CPU speeds, the second (slow mode) will be more reliable but very slow due to the high number of USB/Ethernet transactions. It simply boils down to: The best solution is having intelligence in the emulator itself!
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 34
34 CHAPTER 1 Built-in intelligence for supported CPU-cores
1.5.2.1 Limitations of PC-side implementations
Instability, especially on slow targets Due to the fact that a lot of USB transactions would cause a very bad performance of J­Link, PC-side implementations are on the assumption that the CPU/Debug interface is fast enough to handle the commands/requests without the need of waiting. So, when using the PC-side-intelligence, stability cannot be guaranteed in all cases, especially if the target interface speed (JTAG/SWD/…) is significantly higher than the CPU speed.
Poor performance Since a lot more data has to be transferred over the host interface (typically USB), the resulting download speed is typically much lower than for implementations with intelligence in the firmware, even if the number of transactions over the host interface is limited to a minimum (fast mode).
No support Please understand that we cannot give any support if you are running into problems when using a PC-side implementation.
Note
Due to these limitations, we recommend to use PC-side implementations for evaluation only.
1.5.3 Firmware intelligence per model
There are different models of J-Link / J-Trace which have built-in intelligence for different CPU-cores. Please refer to J-Link / J-Trace hardware revisions for further information.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 35

35 CHAPTER 1 Where to find further information

1.6 Where to find further information
The following items are not the scope of the J-Link / J-Trace User Guide (UM08001) and therefore documented elsewhere in the respective place described/listed below.
1.6.1 SEGGER debug probes
1.6.1.1 J-Link / J-Trace current model overview
In order to compare features, performance specifications, capabilities and included licenses of current J-Link / J-Trace or Flasher models, please refer to the SEGGER website:
J-Link Model overview
1.6.1.2 J-Link / J-Trace hardware revisions
For feature comparisons between different hardware revisions of J-Link / J-Trace or Flasher models, please refer to:
SEGGER Wiki: J-Link / J-Trace / Flasher Software and Hardware features overview
1.6.1.3 J-Link / J-Trace hardware specifications
For detailed general, mechanical and electrical specifications of a specific J-Link / J-Trace or Flasher model, please refer to:
SEGGER Wiki: J-Link / J-Trace / Flasher general, mechanical, electrical specifications
1.6.2 Using a feature in a specific development environment
For many features described in this manual, detailed explanations on how to use them with popular debuggers, IDEs and other applications are available in the SEGGER wiki. Therefore, for information on how to use a feature in a specific development environment, please refer to:
SEGGER Wiki: Getting Started with Various IDEs .
If an explanation is missing for the IDE used or the IDE used is not listed at all, please contact us. (see Contact Information )
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 36
Chapter 2 Licensing
This chapter describes the different license types of J-Link related software and the legal use of the J-Link software with original SEGGER and OEM products.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 37

37 CHAPTER 2 Components requiring a license

2.1 Components requiring a license
J-Link PLUS and higher are fully featured J-Links and come with all licenses included. Other models may do not come with all features enabled. For a detailed overview of the included licenses of the SEGGER debug probes, please refer to:
J-Link Model overview: Licenses
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 38

38 CHAPTER 2 Legal use of SEGGER J-Link software

2.2 Legal use of SEGGER J-Link software
The software consists of proprietary programs of SEGGER, protected under copyright and trade secret laws. All rights, title and interest in the software are and shall remain with SEGGER. For details, please refer to the license agreement which needs to be accepted when installing the software. The text of the license agreement is also available as entry in the start menu after installing the software.
Use of software
SEGGER J-Link software may only be used with original SEGGER products and authorized OEM products. The use of the licensed software to operate SEGGER product clones is pro­hibited and illegal.
2.2.1 Use of the software with 3rd party tools
For simplicity, some components of the J-Link software are also distributed by partners with software tools designed to use J-Link. These tools are primarily debugging tools, but also memory viewers, flash programming utilities as well as software for other purposes. Distribution of the software components is legal for our partners, but the same rules as described above apply for their usage: They may only be used with original SEGGER prod­ucts and authorized OEM products. The use of the licensed software to operate SEGGER product clones is prohibited and illegal.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 39

39 CHAPTER 2 Illegal Clones

2.3 Illegal Clones
Clones are copies of SEGGER products which use the copyrighted SEGGER Firmware with­out a license. It is strictly prohibited to use SEGGER J-Link software with illegal clones of SEGGER products. Manufacturing and selling these clones is an illegal act for various rea­sons, amongst them trademark, copyright and unfair business practice issues. The use of illegal J-Link clones with this software is a violation of US, European and other international laws and is prohibited. If you are in doubt if your unit may be legally used with SEGGER J-Link software, please get in touch with us. End users may be liable for illegal use of J­Link software with clones.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 40
Chapter 3 J-Link software and
documentation package
This chapter describes the contents of the J-Link Software and Documentation Package which can be downloaded from www.segger.com .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 41

41 CHAPTER 3 Software overview

3.1 Software overview
The J-Link Software and Documentation Package, which is available for download from
segger.com/jlink-software.html , includes some applications to be used with J-Link. It also
comes with USB-drivers for J-Link and documentations in pdf format.
Software Description
J-Link Commander Command-line tool with basic functionality for target analysis.
The J-Link GDB Server is a server connecting to the GNU De-
J-Link GDB Server
J-Link GDB Server command line version
J-Link Remote Server
J-Mem
J-Flash
J-Flash Lite
J-Link RTT Viewer
J-Link SWO Viewer
J-Link SWO Analyzer
JTAGLoad
J-Link Configurator
RDI support
Processor specific tools
a
a
bugger (GDB) via TCP/IP. It is required for toolchains using the GDB protocol to connect to J-Link.
Command line version of the J-Link GDB Server. Same func­tionality as the GUI version.
Utility which provides the possibility to use J-Link / J-Trace re­motely via TCP/IP.
Target memory viewer. Shows the memory content of a run­ning target and allows editing as well.
Stand-alone flash programming application. For more infor­mation about J-Flash please refer to J-Flash ARM User’s Guide (UM08003).
Stand-alone flash programming application. Reduced feature set of J-Flash
Free-of-charge utility for J-Link. Displays the terminal output of the target using RTT. Can be used in parallel with a debug­ger or stand-alone.
Free-of-charge utility for J-Link. Displays the terminal output of the target using the SWO pin. Can be used in parallel with a debugger or stand-alone.
Command line tool that analyzes SWO RAW output and stores it into a file.
Command line tool that opens an svf file and sends the data in it via J-Link / J-Trace to the target.
GUI-based configuration tool for J-Link. Allows configuration of USB identification as well as TCP/IP identification of J-Link. For more information about the J-Link Configurator, please refer to J-Link Configurator .
Provides Remote Debug Interface (RDI) support. This allows the user to use J-Link with any RDI-compliant debugger.
Free command-line tools for handling specific processors. Included are: STR9 Commander and STM32 Unlock.
a
Full-featured J-Link (PLUS, PRO, ULTRA+) or an additional license for J-Link base model
required.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 42

42 CHAPTER 3 J-Link Commander (Command line tool)

3.2 J-Link Commander (Command line tool)
J-Link Commander (JLink.exe) is a tool that can be used for verifying proper installation of the USB driver and to verify the connection to the target CPU, as well as for simple analysis of the target system. It permits some simple commands, such as memory dump, halt, step, go etc. to verify the target connection.
J-Link Commander: JTAG connection
3.2.1 Commands
The table below lists the available commands of J-Link Commander. All commands are listed in alphabetical order within their respective categories. Detailed descriptions of the commands can be found in the sections that follow.
Command (short form) Explanation
Basic
clrBP Clear breakpoint. clrWP Clear watchpoint. device Selects a device. erase Erase internal flash of selected device. exec Execute J-Link Command String. exit (qc, q) Closes J-Link Commander. exitonerror (eoe) Commander exits after error. f Prints firmware info. go (g) Starts the CPU core. halt (h) Halts the CPU core. hwinfo Show hardware info. is Scan chain select register length. loadfile Load data file into target memory.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 43
43 CHAPTER 3 J-Link Commander (Command line tool)
Command (short form) Explanation
log Enables log to file. mem Read memory. mem8 Read 8-bit items. mem16 Read 16-bit items. mem32 Read 32-bit items. mem64 Read 64-bit items. mr Measures reaction time of RTCK pin. ms Measures length of scan chain. power Switch power supply for target. r Resets and halts the target. readAP Reads from a CoreSight AP register. readcsr Reads CSR register on a RISC-V based target. readDP Reads from a CoreSight DP register. regs Shows all current register values. rnh Resets without halting the target. rreg Shows a specific register value. rx Reset target with delay. savebin Saves target memory into binary file. setBP Set breakpoint. setPC Set the PC to specified value. SetTimeoutCmd Set timeout for the stepover command. setWP Set watchpoint. sleep Waits the given time (in milliseconds). speed Set target interface speed. st Shows the current hardware status. step (s) Single step the target chip. stepover (so) Execute a stepover. unlock Unlocks a device. verifybin Compares memory with data file. w1 Write 8-bit items. w2 Write 16-bit items. w4 Write 32-bit items. writeAP Writes to a CoreSight AP register. writecsr Writes CSR register on a RISC-V based target. writeDP Writes to a CoreSight DP register. wreg Write register.
Flasher I/O
fdelete (fdel) Delete file on emulator. flist List directory on emulator. fread (frd) Read file from emulator. fshow Read and display file from emulator. fsize (fsz) Display size of file on emulator. fwrite (fwr) Write file to emulator.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 44
44 CHAPTER 3 J-Link Commander (Command line tool)
Command (short form) Explanation
Connection
ip Connect to J-Link Pro via TCP/IP. usb Connect to J-Link via USB.
Configuration
VTREF Sets a fixed value for VTref on J-Link. WebUSBDisable Disables WebUSB on J-Link. WebUSBEnable Enables WebUSB on J-Link.
3.2.1.1 clrBP
This command removes a breakpoint set by J-Link.
Syntax
clrBP <BP_Handle>
Parameter Meaning
BP_Handle Handle of breakpoint to be removed.
Example
clrBP 1
3.2.1.2 clrWP
This command removes a watchpoint set by J-Link.
Syntax
clrWP <WP_Handle>
Parameter Meaning
WP_Handle Handle of watchpoint to be removed.
Example
clrWP 0x2
3.2.1.3 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
device <DeviceName>
Parameter Meaning
DeviceName
Valid device name: Device is selected. ?: Shows a device selection dialog.
Example
device stm32f407ig
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 45
45 CHAPTER 3 J-Link Commander (Command line tool)
3.2.1.4 erase
Erases all flash sectors of the current device. A device has to be specified previously.
Syntax
erase
3.2.1.5 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
exec <Command>
Parameter Meaning
Command J-Link Command String to be executed.
Example
exec SupplyPower = 1
3.2.1.6 exit
This command closes the target connection, the connection to the J-Link and exits J-Link Commander.
Syntax
q
3.2.1.7 exitonerror
This command toggles whether J-Link Commander exits on error or not.
Syntax
ExitOnError <1|0>
Parameter Meaning
<1|0>
1: J-Link Commander will now exit on Error. 0: J-Link Commander will no longer exit on Error.
Example
eoe 1
3.2.1.8 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
f
3.2.1.9 fdelete
On emulators which support file I/O this command deletes a specific file.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 46
46 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
fdelete <FileName>
Parameter Meaning
FileName File to delete from the Flasher.
Example
fdelete Flasher.dat
3.2.1.10 flist
On emulators which support file I/O this command shows the directory tree of the Flasher.
Syntax
flist
3.2.1.11 fread
On emulators which support file I/O this command reads a specific file. Offset applies to both destination and source file.
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
3.2.1.12 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
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
3.2.1.13 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.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 47
47 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
fsize <FileName>]
Parameter Meaning
FileName Source file name to read from the Flasher.
Example
fsize Flasher.dat
3.2.1.14 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 desti­nation and source file.
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
3.2.1.15 go
Starts the CPU. In order to avoid setting breakpoints it allows to define a maximum num­ber 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
Syntax
go [<NumSteps> [<Flags>]]
Parameter Meaning
Maximum number of instructions allowed to be simulated. Instruc-
NumSteps
Flags
tion simulation stops whenever a breakpointed instruction is hit, an instruction which cannot be simulated/emulated is hit or when NumSteps is reached.
0: Do not start the CPU if a BP is in range of NumSteps 1: Overstep BPs
Example
go //Simply starts the CPU go 20, 1
3.2.1.16 halt
Halts the CPU Core. If successful, shows the current CPU registers.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 48
48 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
halt
3.2.1.17 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
hwinfo
3.2.1.18 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
ip [<Addr>]
Parameter Meaning
Valid values:
Addr
IP Address: Connects the J-Link with the specified IP-Address Host Name: Resolves the host name and connects to it. *: Invokes the Emulator selection dialog.
Example
ip 192.168.6.3
3.2.1.19 is
This command returns information about the length of the scan chain select register.
Syntax
is
3.2.1.20 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
loadfile <Filename> [<Addr>]
Parameter Meaning
Filename Source filename Addr Destination address (Required for *.bin files)
Example
loadfile C:\Work\test.bin 0x20000000
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 49
49 CHAPTER 3 J-Link Commander (Command line tool)
3.2.1.21 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
log <Filename>
Parameter Meaning
Filename Log filename
Example
log C:\Work\log.txt
3.2.1.22 mem
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
mem [<Zone>:]<Addr>, <NumBytes> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Numbytes Number of bytes to read. Maximum is 0x100000.
Example
mem 0x0, 0x100
or
mem AHB-AP (AP1):0x20000000, 0x100
3.2.1.23 mem8
The command reads memory from the target system in units of bytes. If necessary, the target CPU is halted in order to read memory.
Syntax
mem [<Zone>:]<Addr>, <NumBytes> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Numbytes Number of bytes to read. Maximum is 0x100000.
Example
mem8 0, 100
3.2.1.24 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.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 50
50 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
mem [<Zone>:]<Addr>, <NumBytes> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Numbytes Number of halfwords to read. Maximum is 0x80000.
Example
mem16 0, 100
3.2.1.25 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
mem [<Zone>:]<Addr>, <NumBytes> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Numbytes Number of words to read. Maximum is 0x40000.
Example
mem32 0, 100
3.2.1.26 mem64
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.
Syntax
mem [<Zone>:]<Addr>, <NumBytes> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Numbytes Number of double words to read. Maximum is 0x20000.
Example
mem64 0, 100
3.2.1.27 mr
Measure reaction time of RTCK pin.
Syntax
mr [<RepCount>]
Parameter Meaning
RepCount Number of times the test is repeated (Default: 1).
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 51
51 CHAPTER 3 J-Link Commander (Command line tool)
Example
mr 3
3.2.1.28 ms
Measures the number of bits in the specified scan chain.
Syntax
ms <ScanChain>
Parameter Meaning
ScanChain Scan chain to be measured.
Example
ms 1
3.2.1.29 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]
Parameter Meaning
State Valid values: On, Off perm Sets the specified State value as default.
Example
power on perm
3.2.1.30 r
Resets and halts the target.
Syntax
r
3.2.1.31 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
//
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 52
52 CHAPTER 3 J-Link Commander (Command line tool)
// Read AP[0], IDR (register 3, bank 15) //
WriteDP 2, 0x000000F0 // Select AP[0] bank 15 ReadAP 3 // Read AP[0] IDR
3.2.1.32 readcsr
Reads a specific CSR (Control Status Register) on a RISC-V based target.
Syntax
readcsr <RegIndex>[,<RegSizeBytes>]
Parameter Meaning
RegIndex Index of CSR register to read
RegSizeBytes
Example
readcsr 0x300
or
Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64).
readcsr 0x300, 8
3.2.1.33 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
ReadDP <RegIndex>
Parameter Meaning
RegIndex Index of DP register to read
Example
// // Read DP-CtrlStat //
ReadDP 1
3.2.1.34 regs
Shows all current register values.
Syntax
regs
3.2.1.35 rnh
This command performs a reset but without halting the device.
Syntax
rnh
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 53
53 CHAPTER 3 J-Link Commander (Command line tool)
3.2.1.36 rreg
The function prints the value of the specified CPU register.
Syntax
rreg <RegIndex>
Parameter Meaning
RegIndex Register to read.
Example
rreg 15
3.2.1.37 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
rx <DelayAfterReset>
Parameter Meaning
DelayAfterRe­set
Delay in ms.
Example
rx 10
3.2.1.38 savebin
Saves target memory into binary file.
Syntax
savebin <Filename>, <Addr>, <NumBytes> (hex)
Parameter Meaning
Filename Destination file Addr Source address. NumBytes Number of bytes to read.
Example
savebin C:\Work\test.bin 0x0000000 0x100
3.2.1.39 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
setBP <Addr> [[A/T]/[W/H]] [S/H]
Parameter Meaning
Addr Address to be breakpointed.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 54
54 CHAPTER 3 J-Link Commander (Command line tool)
Parameter Meaning
Only for ARM7/9/11 and Cortex-R4 devices:
A/T
W/H
S/H
A: ARM mode T: THUMB mode
Only for MIPS devices: W: MIPS32 mode (Word) H: MIPS16 mode (Half-word)
S: Force software BP H: Force hardware BP
Example
setBP 0x8000036
3.2.1.40 setPC
Sets the PC to the specified value.
Syntax
setpc <Addr>
Parameter Meaning
Addr Address the PC should be set to.
Example
setpc 0x59C
3.2.1.41 SetTimeoutCmd
Set timeout in milliseconds for a specific command.
Note
Right now only stepover is supported
Syntax
SetTimeoutCmd <Cmd> = <TimeoutMs>
Parameter Meaning
Cmd Command to set timeout for. TimeoutMs Timeout in milliseconds.
Example
SetTimeoutCmd stepover = 5000
3.2.1.42 setWP
This command inserts a new watchpoint that matches the specified parameters. The enable bit for the watchpoint as well as the data access bit of the watchpoint unit are set auto­matically 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
setWP <Addr> [<AccessType>] [<Size>] [<Data> [<DataMask> [<AddrMask>]]]
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 55
55 CHAPTER 3 J-Link Commander (Command line tool)
Parameter Meaning
Addr Address to be watchpointed.
Specifies the control data on which data event has been set:
Accesstype
Size
Data Specifies the Data on which watchpoint has been set.
DataMask
AddrMask
R: read access W: write access
Valid values: S8 | S16 | S32 Specifies to monitor an n-bit access width at the selected address.
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 support­ed by the core-debug logic. On some cores only complete bytes can be masked out (e.g. PIC32) or similar.
Specifies the address mask used for comparison. Bits set to 1 are masked out, so not taken into consideration during address compar­ison. 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
setWP 0x20000000 W S8 0xFF
3.2.1.43 sleep
Waits the given time (in milliseconds).
Syntax
sleep <Delay>
Parameter Meaning
Delay Amount of time to sleep in ms.
Example
sleep 200
3.2.1.44 speed
This command sets the speed for communication with the CPU core.
Syntax
speed <Freq>|auto|adaptive
Parameter Meaning
Freq Specifies the interface frequency in kHz. auto Selects auto detection of the interface speed. adaptive Selects adaptive clocking as JTAG speed.
Example
speed 4000 speed auto
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 56
56 CHAPTER 3 J-Link Commander (Command line tool)
3.2.1.45 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
st
3.2.1.46 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
step
3.2.1.47 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
For more information see SetTimeoutCmd
Syntax
stepover
3.2.1.48 unlock
This command unlocks a device which has been accidentally locked by malfunction of user software.
Syntax
unlock <DeviceName>
Parameter Meaning
Name of the device family to unlock. Supported Devices:
DeviceName
Example
LM3Sxxx Kinetis EFM32Gxxx
unlock Kinetis
3.2.1.49 usb
Closes any existing connection to J-Link and opens a new one via USB. It is possible to select a specific J-Link by port number.
Syntax
usb [<Port>]
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 57
57 CHAPTER 3 J-Link Commander (Command line tool)
Parameter Meaning
Port Valid values: 0..3
Example
usb
3.2.1.50 verifybin
Verifies if the specified binary is already in the target memory at the specified address.
Syntax
verifybin <Filename>, <Addr>
Parameter Meaning
Filename Sample bin. Addr Start address of memory to verify.
Example
verifybin C:\Work\test.bin 0x0000000
3.2.1.51 VTREF
Sets a fixed value for VTref on J-Link. The Value of VTref can be set between 1200 mV and 3300 mV all values that exceed 3300 mV will be limited to 3300 mV, values smaller than 1200 mV deactivate fixed VTref. Settings of fixed VTref apply nonvolatile after power cycling the probe.
Syntax
VTREF <ValuemV>
Parameter Meaning
ValuemV value in Millivolt
Example
VTREF 3300
3.2.1.52 w1
The command writes one single byte to the target system.
Syntax
w1 [<Zone>:]<Addr>, <Data> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Data 8-bits of data to write.
Example
w1 0x10, 0xFF
3.2.1.53 w2
The command writes a unit of 16-bits to the target system.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 58
58 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
w2 [<Zone>:]<Addr>, <Data> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Data 16-bits of data to write.
Example
w2 0x0, 0xFFFF
3.2.1.54 w4
The command writes a unit of 32-bits to the target system.
Syntax
w4 [<Zone>:]<Addr>, <Data> (hex)
Parameter Meaning
Zone Name of memory zone to access. Addr Start address. Data 32-bits of data to write.
Example
w4 0x0, 0xAABBCCFF
3.2.1.55 WebUSBDisable
Disables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cycling the probe.
Syntax
WebUSBDisable
3.2.1.56 WebUSBEnable
Enables WebUSB on J-Link. The WebUSB configuration applies nonvolatile after power cy­cling the probe.
Syntax
WebUSBEnable
3.2.1.57 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>, <Data32Hex>
Parameter Meaning
RegIndex Index of AP register to write Data32Hex Data to write
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 59
59 CHAPTER 3 J-Link Commander (Command line tool)
Example
// // Select AHB-AP and configure it //
WriteDP 2, 0x00000000 // Select AP[0] (AHB-AP) bank 0 WriteAP 4, 0x23000010 // Auto-increment, Private access, Access size: word}
3.2.1.58 writecsr
Writes a specific CSR (Control Status Register) on a RISC-V based target.
Note
Writes to known CSRs (like X1) may not be written to HW directly but with the next
g or s command.
Syntax
writecsr <RegIndex>, <Data>[,<RegSizeBytes>]
Parameter Meaning
RegIndex Index of CSR register to write Data Data to write
RegSizeBytes
Optional. Specifies length of CSR register in bytes. If omitted RegSize is assumed to be XLEN (32-bit on RV32, 64-bit on RV64).
Example
writecsr 0x1001, 0x11223344
or
writecsr 0x1001, 0x11223344, 8
3.2.1.59 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>, <Data32Hex>
Parameter Meaning
RegIndex Index of DP register to write Data32Hex Data to write
Example
// // Write DP SELECT register: Select AP 0 bank 15 //
WriteDP 2, 0x000000F0
3.2.1.60 wreg
Writes into a register. The value is written into the register on CPU start.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 60
60 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
wreg <RegName>, <Data>
Parameter Meaning
RegName Register to write to. Data Data to write to the specified register.
Example
wreg R14, 0xFF
3.2.2 Command line options
J-Link Commander can be started with different command line options for test and automa­tion purposes. In the following, the command line options which are available for J-Link Commander are explained. All command line options are case insensitive.
Command Explanation
-AutoConnect Automatically start the target connect sequence
-CommanderScript Passes a CommandFile to J-Link
-CommandFile Passes a CommandFile to J-Link
-Device Pre-selects the device J-Link Commander shall connect to
-ExitOnError Commander exits after error
-If Pre-selects the target interface
-IP Selects IP as host interface
-JLinkScriptFile Passes a JLinkScriptFile to J-Link
-JTAGConf Sets IRPre and DRPre
-Log Sets logfile path
-RTTTelnetPort Sets the RTT Telnetport USB Connects to a J-Link with a specific S/N over USB.
-SettingsFile Passes a SettingsFile to J-Link
-Speed Starts J-Link Commander with a given initial speed
3.2.2.1 -AutoConnect
This command can be used to let J-Link Commander automatically start the connect se­quence for connecting to the target when entering interactive mode.
Syntax
-autoconnect <1|0>
Example
JLink.exe -autoconnect 1
3.2.2.2 -CommanderScript
Similar to -CommandFile.
3.2.2.3 -CommandFile
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. The command file is parsed line by line and one command is executed at a time.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 61
61 CHAPTER 3 J-Link Commander (Command line tool)
Syntax
-CommandFile <CommandFilePath>
Example
See Using J-Link Command Files on page 63.
3.2.2.4 -Device
Pre-selects the device J-Link Commander shall connect to. 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. For a list of all supported device names, please refer to List of supported
target devices .
Syntax
-Device <DeviceName>
Example
JLink.exe -Device STM32F103ZE
3.2.2.5 -ExitOnError
Similar to the exitonerror command.
3.2.2.6 -If
Selects the target interface J-Link shall use to connect to the target. 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. If connecting fails, J-Link Commander goes through all target interfaces supported by the connected J-Link and tries to connect to the device.
Syntax
-If <TargetInterface>
Example
JLink.exe -If SWD
Additional information
Currently, the following target interfaces are supported:
JTAG
SWD
3.2.2.7 -IP
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Syntax
-IP <IPAddr>
Example
JLink.exe -IP 192.168.1.17
Additional information
To select from a list of all available emulators on Ethernet, please use * as <IPAddr> .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 62
62 CHAPTER 3 J-Link Commander (Command line tool)
3.2.2.8 -JLinkScriptFile
Passes the path of a J-Link script file to the J-Link Commander. J-Link scriptfiles are mainly used to connect to targets which need a special connection sequence before communication with the core is possible. For more information about J-Link script files, please refer to J- Link Script Files .
Syntax
JLink.exe -JLinkScriptFile <File>
Example
JLink.exe -JLinkScriptFile “C:\My Projects\Default.JLinkScript”
3.2.2.9 -JTAGConf
Passes IRPre and DRPre in order to select a specific device in a JTAG-chain. “-1,-1” can be used to let J-Link select a device automatically.
Syntax
-JTAGConf <IRPre>,<DRPre>
Example
JLink.exe -JTAGConf 4,1 JLink.exe -JTAGConf -1,-1
3.2.2.10 -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
-Log <LogFilePath>
Example
JLink.exe -Log C:\Work\log.txt
3.2.2.11 -RTTTelnetPort
This command alters the RTT telnet port. Default is 19021.
Syntax
-RTTTelnetPort <Port>
Example
JLink.exe -RTTTelnetPort 9100
3.2.2.12 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
USB <SerialNo>
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 63
63 CHAPTER 3 J-Link Commander (Command line tool)
Example
JLink.exe USB 580011111
3.2.2.13 -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
-SettingsFile <PathToFile>
Example
JLink.exe -SettingsFile “C:\Work\settings.txt”
3.2.2.14 -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
-Speed <Speed_kHz>
Example
JLink.exe -Speed 4000
3.2.3 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 (please refer to J-Link Script Files for more information about J-Link script files). When using J-Link commander in batch mode, the path to a command file is passed to it. The syntax in the command file is the same as when using regular commands in J-Link commander (one line per command). SEGGER recommends to always pass the device name via command line option due some devices need special handling on connect/reset in order to guarantee proper function.
Example
JLink.exe -device STM32F103ZE -CommandFile C:\CommandFile.jlink
Contents of CommandFile.jlink:
si 1 speed 4000 r h loadbin C:\firmware.bin,0x08000000
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 64
64 CHAPTER 3 J-Link Remote Server
3.3 J-Link Remote Server
J-Link Remote Server allows using J-Link / J-Trace remotely via TCP/IP. This enables you to connect to and fully use a J-Link / J-Trace from another computer. Performance is just slightly (about 10%) lower than with direct USB connection.

J-Link Remote Server

3.3.1 List of available commands
The table below lists the commands line options accepted by the J-Link Remote Server
Command Description
? Prints the list of available command line options.
-Port Specifies listening port of J-Link Remote Server.
-UseTunnel Specifies if tunneled connection shall be used.
-SelectEmuBySN
-TunnelServer
-TunnelBySN
-TunnelByName
-TunnelPW
-TunnelPort
-TunnelEncrypt
-select
1
port
UseTunnel SelectEmuBySN
1
1
Specifies to connect to a J-Link with a specific S/N. Only valid for LAN mode.
Specify a tunnel server to connect to (default: jlink.seg­ger.com:19020). Only valid for tunnel mode.
Specifies to identify at tunnel server via J-Link S/N. Only valid for tunnel mode.
Specifies to identify at tunnel server via custom name. Only valid for tunnel mode.
Specifies to protect the connection with a password. Only valid for tunnel mode.
Specifies to connect to a tunnel server listening on a specific port. Only valid for tunnel mode.
Specifies to encrypt any transferred data of a tunneled con­nection
<USB/IP>[=<SN/Hostname>] Specify how to connect to J­Link.
Selects the IP port on which the J-Link Remote Server is lis­tening.
Starts J-Link Remote Server in tunneling mode Selects the J-Link to connect to by its serial number.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 65
65 CHAPTER 3 J-Link Remote Server
Note
1
: These command line options exist because of backwards-compatibility.
We suggest to use the command line options that start with a dash (’-’).
3.3.2 Tunneling mode
The Remote server provides a tunneling mode which allows remote connection to a J-Link / J-Trace from any computer, even from outside the local network. To give access to a J-Link neither a remote desktop or VPN connection nor changing some difficult firewall settings is necessary. When started in tunneling mode the Remote server connects to the SEGGER tunnel server via port 19020 and registers with its serial number. To connect to the J-Link from the remote computer an also simple connection to tunnel:<SerialNo> can be established and the debugger is connected to the J-Link.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 66
66 CHAPTER 3 J-Link Remote Server
J-Link Remote Server: Connected to SEGGER tunnel server
Example scenario
A device vendor is developing a new device which shall be supported by J-Link. Because there is only one prototype, a shipment to SEGGER is not possible. Instead the vendor can connect the device via J-Link to a local computer and start the Remote server in tunneling mode. The serial number of the J-Link is then sent to a to an engineer at SEGGER. The engineer at SEGGER can use J-Link Commander or a debugger to test and debug the new device without the need to have the device on the desk.
Start J-Link Remote Server in tunneling mode
3.3.3 Connecting to J-Link/ J-Trace using J-Link Remote Server
J-Link Commander can be used to connect to the J-Link over the Remote Server:
1.) Start J-Link Commander
2.) From within J-Link Commander enter:
IP <RemoteServerIP> for a Remote Server running in LAN mode. IP tunnel:<SN/Nickname>[:<Pasword>[:tunnelserver[:port]]] for a Remote Server
running in tunneling mode.
3.) If the connection was successful it should look like in this screenshot:
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 67
67 CHAPTER 3 J-Link Remote Server
Troubleshooting
Problem Solution
Remote server can­not connect to tun­nel server.
J-Link Commander cannot connect to tunnel server.
To test whether a connection to the tunnel server can be established or not a network protocol analyzer like Wireshark can help. The network transfer of a successful connection should look like:
1. Make sure the Remote server is not blocked by any firewall.
2. Make sure port 19020 is not blocked by any firewall.
3. Contact network admin.
1. Make sure Remote server is started correctly.
2. Make sure the entered serial number is correct.
3. Make sure port 19020 is not blocked by any firewall. Contact network admin.
3.3.3.1 Examples
IP 192.168.178.14 Connect over a Remote Server in your local network (You need to know the specific local IP).
IP tunnel:ThisIsAName Connect over the default Tunnel Remote Server (The one from SEGGER) by using the Name you assigned to the J-Link.
IP tunnel:174402383 Connect over the default Tunnel Remote Server by using the Serial Number of the J-Link.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 68
68 CHAPTER 3 J-Link Remote Server
3.3.4 Encrypted connection
The J-Link Remote Server V6.53b and later supports encrypted connections in tunnel mode. That means that it is possible to have a remote J-Link session where any data transferred between Client, Tunnel Server and Remote Server is encrypted. The encryption is done by using end-to-end encryption between the J-Link Remote Server and a client application, powered by SEGGER’s emCrypt. For more information on emCrypt, please refer to emCrypt on segger.com .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 69

69 CHAPTER 3 J-Mem Memory Viewer

3.4 J-Mem Memory Viewer
J-Mem is a GUI application to display and modify the RAM and SFRs (Special Function Registers) of target systems while the target is running.
For more information on how to use J-Mem, please refer to J-Mem on page 138
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 70

70 CHAPTER 3 J-Flash

3.5 J-Flash
J-Flash is an application to program data images to the flash of a target device. With J­Flash the internal flash of all J-Link supported devices can be programmed, as well as common external flashes connected to the device. Beside flash programming all other flash operations like erase, blank check and flash content verification can be done.
J-Flash requires an additional license from SEGGER to enable programming. For license keys, as well as evaluation licenses got to www.segger.com or contact us directly.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 71

71 CHAPTER 3 J-Flash Lite

3.6 J-Flash Lite
J-Flash Lite is a flash programming application to program data images to the flash of a target device. In comparison to J-Flash, J-Flash Lite has a reduced feature set but does not require a J-Link PLUS or higher to operate. J-Flash Lite is also available for J-Link BASE and EDU.
3.6.1 Limitations in comparison to J-Flash
No support for external CFI NOR flash
No support for custom Init steps
No support for automation via command line
No project management support (Only the settings from the last session are pre­selected on startup)
3.6.2 Usage
J-Flash Lite is very simple to use. First, a configuration dialog shows up, in which the target interface, target device etc. has to be selected. By clicking the O.K. button, the configuration is applied and the actual main window is shown.
The main window of J-Flash Lite only consists of a few dialog elements that allow program­ming of the target:
Dialog element Function
“…” button Selects the application image (bin, hex, mot, …) to program “Erase chip”
button “Program De-
vice” button
Erases all flash banks of the device
Programs the selected application image
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 72
72 CHAPTER 3 J-Flash Lite
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 73

73 CHAPTER 3 J-Link RTT Viewer

3.7 J-Link RTT Viewer
J-Link RTT Viewer is a GUI application available for Windows, MacOS and Linux. It enables you to use all features of RTT in one application. It supports:
Displaying terminal output of Channel 0.
Up to 16 virtual Terminals on Channel 0.
Sending text input to Channel 0.
Interpreting text control codes for colored text and controlling the Terminal.
Logging terminal data into a file.
Logging data on Channel 1.
For general information about RTT, please refer to RTT on page 349.
3.7.1 RTT Viewer Startup
Make sure J-Link and target device are connected and powered up. Start RTT Viewer by opening the executable (JLinkRTTViewer.exe) from the installation folder of the J-Link Software or the start menu. Unless the command line parameter --
autoconnect is set, the Configuration Dialog will pop up.
Configure the Connection Settings as described below and click OK. The connection settings and all in app configuration will be saved for the next start of J-Link RTT Viewer.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 74
74 CHAPTER 3 J-Link RTT Viewer
3.7.2 Connection Settings
RTT Viewer can be used in two modes:
Stand-alone, opening an own connection to J-Link and target.
In attach mode, connecting to an existing J-Link connection of a debugger.
Stand-alone connection settings
In stand-alone mode RTT Viewer needs to know some settings of J-Link and target device. Select USB or TCP/IP as the connection to J-Link. For USB a specific J-Link serial number can optionally be entered, for TCP/IP the IP or hostname of the J-Link has to be entered. Select the target device to connect to. This allows J-Link to search in the known RAM of the target. Select the target interface and its speed. The RTT Control Block can be searched for fully automatically, it can be set to a fixed address or it can be searched for in one or more specific memory ranges.
Attaching to a connection
In attach mode RTT Viewer does not need any settings. Select Existing Session. For attach mode a connection to J-Link has to be opened and configured by another application like a debugger or simply J-Link Commander. If the RTT Control Block cannot be found automat­ically, configuration of its location has to be done by the debugger / application.
3.7.3 The Terminal Tabs
RTT Viewer allows displaying the output of Channel 0 in different “virtual” Terminals. The target application can switch between terminals with SEGGER_RTT_SetTerminal() and SEG­GER_RTT_TerminalOut(). RTT Viewer displays the Terminals in different tabs.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 75
75 CHAPTER 3 J-Link RTT Viewer
All Terminals
The All Terminals tab displays the complete output of RTT Channel 0 and can display the user input (Check Input -> Echo input… -> Echo to “All Terminals”). Each output line is prefixed by the Terminal it has been sent to. Additionally, output on Terminal 1 is shown in red, output on Terminals 2 - 15 in gray.
Terminal 0 - 15
Each tab Terminal 0 - Terminal 15 displays the output which has been sent to this Terminal. The Terminal tabs interpret and display Text Control Codes as sent by the application to show colored text or erase the screen. By default, if the RTT application does not set a Terminal Id, the output is displayed in Terminal 0. The Terminal 0 tab can additionally display the user input. (Check Input -> Echo input…
-> Echo to “Terminal 0”)
Each Terminal tab can be shown or hidden via the menu Terminals -> Terminals… or their respective shortcuts as described below.
3.7.4 Sending Input
RTT Viewer supports sending user input to RTT Down Channel 0 which can be read by the target application with SEGGER_RTT_GetKey() and SEGGER_RTT_Read(). Input can be entered in the text box below the Terminal Tabs. RTT Viewer can be configured to directly send each character while typing or buffer it until Enter is pressed (Menu Input -> Sending…). In stand-alone mode RTT Viewer can retry to send input, in case the target input buffer is full, until all data could be sent to the target via Input -> Sending… -> Block if FIFO full.
3.7.5 Logging Terminal output
The output of Channel 0 can be logged into a text file. The format is the same as used in the All Terminals tab. Terminal Logging can be started via Logging -> Start Terminal Logging…
3.7.6 Logging Data
Additionally to displaying output of Channel 0, RTT Viewer can log data which is sent on RTT Channel 1 into a file. This can for example be used to sent instrumented event tracing data. The data log file contains header and footer and the binary data as received from the application.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 76
76 CHAPTER 3 J-Link RTT Viewer
Data Logging can be started via Logging -> Start Data Logging…
Note
Data Logging is only available in stand-alone mode.
3.7.7 Command line options
J-Link RTT Viewer can be configured via command line parameters. In the following, the command line options which are available for J-Link RTT Viewer are explained. All command line options are case insensitive. Short and long command names have the same syntax.
Command line option Explanation
-b, --bright Bright theme for GUI
-d, --device Select the connected target device.
-ct, --connection Sets the connection type
-if, --interface Sets the interface type
-ip, --host The IP address of the J-Link
-s, --speed Interface speed in kHz
-sf, --scriptfile Executes a command script on start up
-sn, --serialnumber Select the J-Link with a specific S/N.
-ra, --rttaddr Sets the address of the RTT control block
-rr, --rttrange Specify RTT search range
-a, --autoconnect Automatically connect to target, suppress settings dialog
3.7.7.1 --bright
Starts the RTT Viewer in bright theme
Syntax
--bright
Example
JLinkRTTViewer.exe --bright
3.7.7.2 --device
Selects the device J-Link RTT Viewer shall connect to.
Syntax
--device <DeviceName>
Example
JLinkRTTViewer.exe --device STM32F103ZE
3.7.7.3 --connection
Sets the connection type. The connection to the J-Link can either be made directly over USB, IP or using an existing running session (e.g. the IDE’s debug session). In case of using an existing session, no further configuration options are required.
Syntax
--connection <usb|ip|sess>
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 77
77 CHAPTER 3 J-Link RTT Viewer
Example
JLinkRTTViewer.exe --connection ip
3.7.7.4 --interface
Sets the interface J-Link shall use to connect to the target. As interface types FINE, JTAG and SWD are supported.
Syntax
--interface <fine|jtag|swd>
Example
JLinkRTTViewer.exe --interface swd
3.7.7.5 --host
Enter the IP address or hostname of the J-Link. This option only applies, if connection type IP is used. Use * as <IPAddr> for a list of available J-Links in the local subnet.
Syntax
--host <IPAddr>
Example
JLinkRTTViewer.exe --host 192.168.1.17
3.7.7.6 --speed
Sets the interface speed in kHz for target communication.
Syntax
--speed <speed>
Example
JLinkRTTViewer.exe --speed 4000
3.7.7.7 --scriptfile
Executes a JLink command script on startup, setting options in advance (e.g. Device = AT91SAM7S256)
Syntax
--scriptfile <FilePath>
Example
JLinkRTTViewer.exe --scriptfile C:\tmp\<Scriptfilename>
3.7.7.8 --serialnumber
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 RTT Viewer shall run and each connects to another J-Link.
Syntax
--serialnumber <SerialNo>
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 78
78 CHAPTER 3 J-Link RTT Viewer
Example
JLinkRTTViewer.exe --serialnumber 580011111
3.7.7.9 --rttaddr
Sets a fixed address as location of the RTT control block. Automatic searching for the RTT control block is disabled.
Syntax
--rttaddr <RTTCBAddr>
Example
JLinkRTTViewer.exe -rttaddr 0x20000000
3.7.7.10 --rttrange
Sets one or more memory ranges, where the J-Link DLL shall search for the RTT control block.
Syntax
--rttrange <RangeStart[Hex]> <RangeSize >[, <Range1Start [Hex]>
<Range1Size>]>
Example
JLinkRTTViewer.exe -rttrange “20000000 400”
3.7.7.11 --autoconnect
Let J-Link RTT Viewer connect automatically to the target without showing the Connection Settings (see Connection Settings ).
Syntax
--autoconnect
Example
JLinkRTTViewer.exe --autoconnect
3.7.8 Menus and Shortcuts
File menu elements
Menu entry Contents Shortcut
-> Connect…
-> Disconnect Disconnects from the target F3
-> Exit Closes connection and exit RTT Viewer. Alt-F4
Opens the connect dialog and connects to the tar­gets
F2
Terminals menu elements
Menu entry Contents Shortcut
-> Add next terminal Opens the next available Terminal Tab. Alt-A
-> Clear active terminal Clears the currently selected terminal tab. Alt-R
-> Close active terminal Closes the active Terminal Tab. Alt-W
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 79
79 CHAPTER 3 J-Link RTT Viewer
Menu entry Contents Shortcut
-> Open Terminal on output
-> Show Log Opens or closes the Log Tab. Alt-L Terminals -> Terminals…
-> Terminal 0 - 15 Opens or closes the Terminal Tab.
If selected, a terminal is automatically created, if data for this terminal is received.
Alt­Shift-0 Alt­Shift-F
Input menu elements
Menu entry Contents Shortcut
-> Clear input field
Input -> Sending…
-> Send on Input
-> Send on Enter
-> Block if FIFO full
Input -> End of line…
-> Windows format (CR +LF)
-> Unix format (LF)
-> Mac format (CR)
-> None Input -> Echo input…
-> Echo to “All Termi­nals”
-> Echo to “Terminal 0”
Clears the input field without sending entered da­ta.
If selected, entered input will be sent directly to the target while typing.
If selected, entered input will be sent when press­ing Enter.
If checked, RTT Viewer will retry to send all input to the target when the target buffer is full.
Selects the end of line character to be sent on En­ter.
If checked, sent input will be displayed in the All Terminals Tab.
If checked, sent input will be displayed in the Ter­minal Tab 0.
Button “Clear”
Logging menu elements
Menu entry Contents Shortcut
-> Start Terminal log­ging…
-> Stop Terminal logging Stops logging terminal data and closes the file. Shift-F5
-> Start Data logging… Starts logging data of Channel 1 to a file. F6
-> Stop Data logging Stops logging data and closes the file. Shift-F6
-> Channel infos…
Starts logging terminal data to a file. F5
Displays information about all available RTT chan­nels.
F8
Help menu elements
Menu entry Contents Shortcut
-> About… Shows version info of RTT Viewer. F12
-> J-Link Manual… Opens the J-Link Manual PDF file. F11
-> RTT Webpage… Opens the RTT webpage. F10
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 80
80 CHAPTER 3 J-Link RTT Viewer
Tab context menu elements
Menu entry Contents Shortcut
-> Close Terminal Closes this Terminal Tab Alt-W
-> Clear Terminal Clears the displayed output of this Terminal Tab. Alt-R
3.7.9 Using "virtual" Terminals in RTT
For virtual Terminals the target application needs only Up Channel 0. This is especially important on targets with low RAM.
If nothing is configured, all data is sent to Terminal 0. The Terminal to output all following via Write, WriteString or printf can be set with SEG-
GER_RTT_SetTerminal(). Output of only one string via a specific Terminal can be done with SEGGER_RTT_Termi-
nalOut(). The sequences sent to change the Terminal are interpreted by RTT Viewer. Other applica-
tions like a Telnet Client will ignore them.
3.7.10 Using Text Control Codes
RTT allows using Text Control Codes (ANSI escape codes) to configure the display of text. RTT Viewer supports changing the text color and background color and can erase the Ter­minal. These Control Codes are pre-defined in the RTT application and can easily be used in the application.
Example 1
SEGGER_RTT_WriteString(0, RTT_CTRL_RESET"Red: " \ RTT_CTRL_TEXT_BRIGHT_RED"This text is red. " \ RTT_CTRL_TEXT_BLACK"" \ RTT_CTRL_BG_BRIGHT_RED"This background is red. " \ RTT_CTRL_RESET"Normal text again." );
Example 2
SEGGER_RTT_printf(0, "%sTime:%s%s %.7d\n", RTT_CTRL_RESET, RTT_CTRL_BG_BRIGHT_RED, RTT_CTRL_TEXT_BRIGHT_WHITE, 1111111 );
// // Clear the terminal. // The first line will not be shown after this command. //
SEGGER_RTT_WriteString(0, RTT_CTRL_CLEAR);
SEGGER_RTT_printf(0, "%sTime: %s%s%.7d\n", RTT_CTRL_RESET, RTT_CTRL_BG_BRIGHT_RED, RTT_CTRL_TEXT_BRIGHT_WHITE, 2222222 );
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 81

81 CHAPTER 3 J-Link SWO Viewer

3.8 J-Link SWO Viewer
Free-of-charge utility for J-Link. Displays the terminal output of the target using the SWO pin. The stimulus port(s) from which SWO data is received can be chosen by using the port checkboxes 0 to 31. Can be used in parallel with a debugger or stand-alone. This is especially useful when using debuggers which do not come with built-in support for SWO such as most GDB / GDB+Eclipse based debug environments.
3.8.1 J-Link SWO Viewer CL
Command line-only version of SWO Viewer. All commands available for J-Link SWO Viewer can be used with J-Link SWO Viewer Cl. Similar to the GUI Version, J-Link SWO Viewer CL asks for a device name or CPU clock speed at startup to be able to calculate the correct SWO speed or to connect to a running J-Link GDB Server.
Using the syntax given below(see List of available command line options ), J-Link SWO Viewer CL can be directly started with parameters.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 82
82 CHAPTER 3 J-Link SWO Viewer
3.8.2 Usage
J-Link SWO Viewer is available via the start menu. It asks for a device name or CPU clock speed at startup to be able to calculate the correct SWO speed or to connect to a running J-Link GDB Server. Optionally you can select the preferred SWO clock speed from a drop down list. If nothing is selected for SWO clock speed then the debug probe will calculate the optimal value. To populate the drop down list the device needs to be selected or CPU clock speed must be measured once per session.
When running in normal mode J-Link SWO Viewer automatically performs the necessary initialization to enable SWO output on the target, in GDB Server mode the initialization has to be done by the debugger. Should you have a target connection already open e.g. a debug session in your IDE we recommend defining the parameters device name, CPU clock frequency and SWO clock frequency via CL to avoid connection errors.
3.8.3 List of available command line options
J-Link SWO Viewer can also be controlled from the command line if used in a automated test environment etc. When passing all necessary information to the utility via command line, the configuration dialog at startup is suppressed. Minimum information needed by J­Link SWO Viewer is the device name (to enable CPU frequency auto detection) or the CPU clock speed. The table below lists the commands accepted by the J-Link SWO View
Command Description
-cpufreq Select the CPU frequency.
-device Select the target device.
-ip Configure connection settings to IP IPAddress.
-itmmask
-itmport Selects a itm stimulus port which should be used to listen to.
-outputfile Print the output of SWO Viewer to the selected file.
-settingsfile Specify a J-Link settings file.
-swofreq Select the SWO frequency.
-usb Configure connection settings to USB S/N.
Selects a set of itm stimulus ports which should be used to listen to.
3.8.3.1 -cpufreq
Defines the current CPU speed in Hz that the CPU is running at. If the CPU is for example running at 96 MHz, the command line should look as below.
Syntax
-cpufreq <CPUFreq>
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 83
83 CHAPTER 3 J-Link SWO Viewer
Example
-cpufreq 96000000
3.8.3.2 -device
Select the target device to enable the CPU frequency auto detection of the J-Link DLL. To select a ST STM32F207IG as target device, the command line should look as below. For a list of all supported device names, please refer to:
List of supported target devices
Syntax
-device <DeviceID>
Example
-device STM32F207IG
3.8.3.3 -ip
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Syntax
-ip <IPAddr>
Example
-ip 192.168.1.17
3.8.3.4 -itmmask
Defines a set of stimulusports from which SWO data is received and displayed by SWO Viewer. If itmmask is given, itmport will be ignored.
Syntax
-itmmask <Mask>
Example
Listen on ports 0 and 2
-itmmask 0x5
3.8.3.5 -itmport
Defines the stimulus port from which SWO data is received and displayed by the SWO Viewer. Default is stimulus port 0. The command line should look as below.
Syntax
-itmport <ITMPortIndex>
Example
-itmport 0
3.8.3.6 -outputfile
Define a file to which the output of SWO Viewer is printed.
Syntax
-outputfile <PathToFile>
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 84
84 CHAPTER 3 J-Link SWO Viewer
Example
-outputfile “C:\Temp\Output.log”
3.8.3.7 -settingsfile
Select a J-Link settings file to use for the target device.
Syntax
-settingsfile <PathToFile>
Example
-settingsfile “C:\Temp\Settings.jlink”
3.8.3.8 -swofreq
Defines the SWO frequency that shall be used by J-Link SWO Viewer for sampling SWO data. Usually not necessary to define since optimal SWO speed is calculated automatically based on the CPU frequency and the capabilities of the connected J-Link. If the targeted SWO speed is 6 MHz the command line should look as follows.
Syntax
-swofreq <SWOFreq>
Example
-swofreq 6000000
3.8.3.9 -usb
Configures the connection settings according to defined USB S/N. Usually not necessary to define if only one debug device is connected to the PC.
Syntax
-usb <S/N>
Example
-usb 01234567
3.8.4 Configure SWO output after device reset
In some situations it might happen that the target application is reset and it is desired to log the SWO output of the target after reset during the booting process. For such situations, the target application itself needs to initialize the CPU for SWO output, since the SWO Viewer is not restarted but continuously running.
Example code for enabling SWO out of the target application
#define ITM_ENA (*(volatile unsigned int*)0xE0000E00) // ITM Enable #define ITM_TPR (*(volatile unsigned int*)0xE0000E40) // Trace Privilege
// Register
#define ITM_TCR (*(volatile unsigned int*)0xE0000E80) // ITM Trace Control Reg. #define ITM_LSR (*(volatile unsigned int*)0xE0000FB0) // ITM Lock Status
// Register
#define DHCSR (*(volatile unsigned int*)0xE000EDF0) // Debug register #define DEMCR (*(volatile unsigned int*)0xE000EDFC) // Debug register #define TPIU_ACPR (*(volatile unsigned int*)0xE0040010) // Async Clock
// prescaler register
#define TPIU_SPPR (*(volatile unsigned int*)0xE00400F0) // Selected Pin Protocol
// Register
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 85
85 CHAPTER 3 J-Link SWO Viewer
#define DWT_CTRL (*(volatile unsigned int*)0xE0001000) // DWT Control Register #define FFCR (*(volatile unsigned int*)0xE0040304) // Formatter and flush
// Control Register U32 _ITMPort = 0; // The stimulus port from which SWO data is received // and displayed. U32 TargetDiv = 1; // Has to be calculated according to // the CPU speed and the output baud rate
static void _EnableSWO() {
U32 StimulusRegs; // // Enable access to SWO registers // DEMCR |= (1 << 24); ITM_LSR = 0xC5ACCE55; // // Initially disable ITM and stimulus port // To make sure that nothing is transferred via SWO // when changing the SWO prescaler etc. // StimulusRegs = ITM_ENA; StimulusRegs &= ~(1 << _ITMPort); ITM_ENA = StimulusRegs; // Disable ITM stimulus port ITM_TCR = 0; // Disable ITM // // Initialize SWO (prescaler, etc.) // TPIU_SPPR = 0x00000002; // Select NRZ mode TPIU_ACPR = TargetDiv - 1; // Example: 72/48 = 1,5 MHz ITM_TPR = 0x00000000; DWT_CTRL = 0x400003FE; FFCR = 0x00000100; // // Enable ITM and stimulus port // ITM_TCR = 0x1000D; // Enable ITM ITM_ENA = StimulusRegs | (1 << _ITMPort); // Enable ITM stimulus port }
3.8.5 Target example code for terminal output
/********************************************************************* * SEGGER Microcontroller GmbH * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 1995 - 2018 SEGGER Microcontroller GmbH * * * * www.segger.com Support: support@segger.com * * * **********************************************************************
---------------------------------------------------------------------­File : SWO.c Purpose : Simple implementation for output via SWO for Cortex-M processors. It can be used with any IDE. This sample implementation ensures that output via SWO is enabled in order to guarantee that the application does not hang.
-------- END-OF-HEADER --------------------------------------------­*/
/********************************************************************* * * Prototypes (to be placed in a header file such as SWO.h) */
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 86
86 CHAPTER 3 J-Link SWO Viewer
void SWO_PrintChar (char c); void SWO_PrintString(const char *s);
/********************************************************************* * * Defines for Cortex-M debug unit */
#define ITM_STIM_U32 (*(volatile unsigned int*)0xE0000000) // STIM word access #define ITM_STIM_U8 (*(volatile char*)0xE0000000) // STIM Byte access #define ITM_ENA (*(volatile unsigned int*)0xE0000E00) // ITM Enable Register #define ITM_TCR (*(volatile unsigned int*)0xE0000E80) // ITM Trace Control
// Register
/********************************************************************* * * SWO_PrintChar() * * Function description * Checks if SWO is set up. If it is not, return, * to avoid program hangs if no debugger is connected. * If it is set up, print a character to the ITM_STIM register * in order to provide data for SWO. * Parameters * c: The character to be printed. * Notes * Additional checks for device specific registers can be added. */
void SWO_PrintChar(char c) {
// // Check if ITM_TCR.ITMENA is set // if ((ITM_TCR & 1) == 0) { return; } // // Check if stimulus port is enabled // if ((ITM_ENA & 1) == 0) { return; } // // Wait until STIMx is ready, // then send data // while ((ITM_STIM_U8 & 1) == 0); ITM_STIM_U8 = c; }
/********************************************************************* * * SWO_PrintString() * * Function description * Print a string via SWO. * */
void SWO_PrintString(const char *s) {
// // Print out character per character // while (*s) { SWO_PrintChar(*s++); } }
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 87

87 CHAPTER 3 SWO Analyzer

3.9 SWO Analyzer
SWO Analyzer (SWOAnalyzer.exe) is a tool that analyzes SWO output. Status and summary of the analysis are output to standard out, the details of the analysis are stored in a file.
Usage
SWOAnalyzer.exe <SWOfile> This can be achieved by simply dragging the SWO output file created by the J-Link DLL onto the executable.
Creating an SWO output file
In order to create the SWO output file, which is the input file for the SWO Analyzer, the J­Link config file needs to be modified. It should contain the following lines:
[SWO] SWOLogFile="C:\TestSWO.dat"
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 88

88 CHAPTER 3 JTAGLoad (Command line tool)

3.10 JTAGLoad (Command line tool)
JTAGLoad is a tool that can be used to open and execute an svf (Serial vector format) file for JTAG boundary scan tests. The data in the file will be sent to the target via J-Link / J-Trace.
SVF is a standard format for boundary scan vectors to be used with different tools and targets. SVF files contain human-readable ASCII SVF statements consisting of an SVF com­mand, the data to be sent, the expected response, a mask for the response or additional information.
JTAGLoad supports following SVF commands:
ENDDR
ENDIR
FREQUENCY
HDR
HIR
RUNTEST
SDR
SIR
STATE
TDR
TIR
A simple SVF file to read the JTAG ID of the target can look like following:
! Set JTAG frequency FREQUENCY 12000000HZ; ! Configure scan chain ! For a single device in chain, header and trailer data on DR and IR are 0 ! Set TAP to IDLE state STATE IDLE; ! Configure end state of DR and IR after scan operations ENDDR IDLE; ENDIR IDLE; ! Start of test ! 32 bit scan on DR, In: 32 0 bits, Expected out: Device ID (0x0BA00477) SDR 32 TDI (0) TDO (0BA00477) MASK (0FFFFFFF); ! Set TAP to IDLE state STATE IDLE; ! End of test
SVD files allow even more complex tasks, basically everything which is possible via JTAG and the devices in the scan chain, like configuring an FPGA or loading data into memory.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 89
89 CHAPTER 3 JTAGLoad (Command line tool)
Available command lines:
|| Command | Description || /? | Shows how to call JTAGLoad. || -NoAutoExit | Prevents JTAGLoad from auto exiting.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 90

90 CHAPTER 3 J-Link RDI (Remote Debug Interface)

3.11 J-Link RDI (Remote Debug Interface)
The J-Link RDI software is a remote debug interface for J-Link. It makes it possible to use J-Link with any RDI compliant debugger. The main part of the software is an RDI-compliant DLL, which needs to be selected in the debugger. here are two additional features available which build on the RDI software foundation. Each additional feature requires an RDI license in addition to its own license. Evaluation licenses are available free of charge. For further information go to our website or contact us directly.
Note
The RDI software (as well as flash breakpoints and flash downloads) do not require a license if the target device is an LPC2xxx. In this case the software verifies that the target device is actually an LPC 2xxx and have a device-based license.
3.11.1 Flash download and flash breakpoints
Flash download and flash breakpoints are supported by J-Link RDI. For more informa­tion about flash download and flash breakpoints, please refer to J-Link RDI User’s Guide (UM08004) , chapter Flash download and chapter Breakpoints in flash memory .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 91

91 CHAPTER 3 Processor specific tools

3.12 Processor specific tools
The J-Link Software and Documentation Package includes some tools which support proces­sor specific functionalities, like unlocking a device.
3.12.1 J-Link STR91x Commander (Command line tool)
J-Link STR91x Commander (JLinkSTR91x.exe) is a tool that can be used to configure STR91x cores. It permits some STR9 specific commands like:
Set the configuration register to boot from bank 0 or 1.
Erase flash sectors.
Read and write the OTP sector of the flash.
Write-protect single flash sectors by setting the sector protection bits.
Prevent flash from communicate via JTAG by setting the security bit.
All of the actions performed by the commands, excluding writing the OTP sector and erasing the flash, can be undone. This tool can be used to erase the flash of the controller even if a program is in flash which causes the CPU core to stall.
When starting the STR91x commander, a command sequence will be performed which brings MCU into Turbo Mode.
“While enabling the Turbo Mode, a dedicated test mode signal is set and controls the GPIOs in output. The IOs are maintained in this state until a next JTAG instruction is sent.” (ST Microelectronics)
Enabling Turbo Mode is necessary to guarantee proper function of all commands in the STR91x Commander.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 92
92 CHAPTER 3 Processor specific tools
Commands
Command Description
Set the size of the primary flash manually.
fsize
showconf Show configuration register content and security status
mem
erase
erase bank0 Erase flash bank 0 erase bank1 Erase flash bank 1 erase all Perform a full chip erase
setb
setLVDth Set the LVD threshold to 2.7 V. clrLVDth Set the LVD threshold to 2.4 V. setLVDreset LVD Reset Out is generated by VDD or VDDQ inputs. clrLVDreset LVD Reset Out is generated by VDD input only. setLVDwarn LVD warning is generated by VDD or VDDQ inputs. clrLVDwarn LVD warning is generated by VDD input only. blank Blank check all flash sectors
secure
unsecure Unsecure the device. Content of configuration register is saved.
protect
unprotect
readotp Read OTP sectors
writeotp
q Quit
Syntax: fsize 0|1|2|3, where 0 selects a 256 Kbytes device, 1 a 512 Kbytes device, 2 a 1024 KBytes device and 3 a 2048 Kbytes device
Read memory Syntax: mem <Addr>, <NumBytes>
Erase flash sectors (OTP can not be erased). Syntax: erase <SectorMaskL>, <SectorMaskH> SectorMaskL = Bits 0-%d mask sectors 0-%d of bank 0 SectorMaskH = Bits 0-%d mask sectors 0-%d of bank 1 Bit 17 masks the configuration sector Bit 18 masks the User-Code sector All other bits are ignored
Boot from flash bank x (0 and 1 are available) Syntax: setb <int>
Set the security bit. Protects device from read or debug access through the JTAG port (can only be cleared by a full chip erase).
Protect flash sectors. Syntax: protect <Bank0SectorMask>, <Bank1SectorMask> Bank0SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 0 Bank1SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 1
Unprotect flash sectors. Syntax: unprotect <Bank0SectorMask>, <Bank1SectorMask> Bank0SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 0 Bank1SectorMask: Bits 0-%d mask flash sectors 0-%d of bank 1
Write words to the OTP sectors. Syntax: writeotp <Word1>, [<Word2>, …, <Word8>]
Command line options
J-Link STR91x Commander can be started with different command line options for test and automation purposes. In the following, the command line options which are available for J-Link Commander are explained. All command line options are case insensitive.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 93
93 CHAPTER 3 Processor specific tools
Command Explanation
-CommandFile Passes a CommandFile to J-Link
-IP Selects IP as host interface
-USB Connects to a J-Link with a specific S/N over USB
-IRPre Scan-Chain Configuration
-IRPost Scan-Chain Configuration
-DRPre Scan-Chain Configuration
-DRPost Scan-Chain Configuration
3.12.1.1 -CommandFile
Selects a command file and starts J-Link STR91x Commander in batch mode. The batch mode of J-Link STR91x Commander is similar to the execution of a batch file. The command file is parsed line by line and one command is executed at a time.
Syntax
-CommandFile <CommandFilePath>
Example
See Using J-Link Command Files .
3.12.1.2 -DRPre, -DRPost, -IRPre and -IRPost (Scan-Chain Configura­tion )
STR91x allows to configure a specific scan-chain via command-line. To use this feature four command line options have to be specified in order to allow a proper connection to the prop­er device. In case of passing an incomplete configuration, the utility tries to auto-detect.
Syntax
-DRPre <DRPre>
-DRPost <DRPost>
-IRPre <IRPre>
-IRPost <IRPost>
Example
JLinkSTR91x.exe -DRPre 1 -DRPost 4 -IRPre 16 -IRPost 20
3.12.1.3 -IP
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Syntax
-IP <IPAddr>
Example
JLinkSTR91x.exe -IP 192.168.1.17
Additional information
To select from a list of all available emulators on Ethernet, please use * as <IPAddr> .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 94
94 CHAPTER 3 Processor specific tools
3.12.1.4 -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
-USB <SerialNo>
Example
JLinkSTR91x.exe -USB 580011111
3.12.2 J-Link STM32 Unlock (Command line tool)
J-Link STM32 Unlock (JLinkSTM32.exe) is a free command line tool which can be used to disable the hardware watchdog of STM32 devices which can be activated by program­ming the option bytes. Moreover the J-Link STM32 Commander unsecures a read-protected STM32 device by re-programming the option bytes.
Note
Unprotecting a secured device or will cause a mass erase of the flash memory.
Command Line Options
Command line option Explanation
-IP
-SelectEmuBySN Connects to a J-Link with a specific S/N over USB
-Speed
-SetPowerTarget Enables target power supply via pin 19.
-SetDeviceFamily Specifies a device family
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Starts the J-Link STM32 Unlock Utility with a given initial in­terface speed.
Page 95
95 CHAPTER 3 Processor specific tools
Command line option Explanation
-Exit J-Link STM32 Unlock will close automatically
3.12.2.1 -IP
Selects IP as host interface to connect to J-Link. Default host interface is USB.
Syntax
-IP <IPAddr>
Example
JLinkSTM32.exe -IP 192.168.1.17
Note
To select from a list of all available emulators on Ethernet, please use * as <IPAddr>.
3.12.2.2 -SelectEmuBySN
Connect to a J-Link with a specific serial number via USB. Useful if multiple J-Links are connected to the same PC.
Syntax
-SelectEmuBySN <SerialNo>
Example
JLinkSTM32.exe -SelectEmuBySN 580011111
3.12.2.3 -Speed
Starts J-Link STM32 Unlock Utility 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 1000 kHz.
Syntax
-Speed <Speed_kHz>
Example
-Speed 1000
3.12.2.4 -SetPowerTarget
The connected debug probe will power the target via pin 19 of the debug connector.
Syntax
-SetPowerTarget <Mode>
Example
JLinkSTM32.exe -SetPowerTarget 1 // Target power will be set
3.12.2.5 -SetDeviceFamily
This command allows to specify a device family, so that no user input is required to start the unlocking process.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 96
96 CHAPTER 3 Processor specific tools
Syntax
-SetDeviceFamily <Parameter>
Parameter
There are two different options to specify the device family to be used: a) Pass the list index from the list which shows all supported families on start up b) Pass the defined device name
ID Device
1 STM32F0xxxx 2 STM32F1xxxx 3 STM32F2xxxx 4 STM32F3xxxx 5 STM32F4xxxx 6 STM32F72_F73xxx 7 STM32F74_F75xxx 8 STM32F76_F77xxx
9 STM32L0xxxx 10 STM32L1xxxx 11 STM32L4x6xx
Example
JLinkSTM32.exe -SetDeviceFamily 10 // Selects STM32L1 series JLinkSTM32.exe -SetDeviceFamily STM32F2xxxx // Selects STM32F2 series
3.12.2.6 -Exit
In general, the J-Link STM32 utility waits at the end of the unlock process for any user input before application closes. This option allows to skip this step, so that the utility closes automatically.
Syntax
-Exit <Mode>
Example
JLinkSTM32.exe -Exit 1 // J-Link STM32 utility closes automatically
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 97

97 CHAPTER 3 J-Link Software Developer Kit (SDK)

3.13 J-Link Software Developer Kit (SDK)
The J-Link Software Developer Kit is needed if you want to write your own program with J­Link / J-Trace. The J-Link DLL is a standard Windows DLL typically used from C programs (Visual Basic or Delphi projects are also possible). It makes the entire functionality of J­Link / J-Trace available through its exported functions, such as halting/stepping the CPU core, reading/writing CPU and ICE registers and reading/writing memory. Therefore it can be used in any kind of application accessing a CPU core. The standard DLL does not have API functions for flash programming. However, the functionality offered can be used to program flash. In this case, a flash loader is required. The table below lists some of the included files and their respective purpose. Further information can be found on the SEGGER website:
J-Link SDK
The J-Link SDK requires an additional license and is available upon request from www.seg-
ger.com .
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 98
Chapter 4 J-Link GDB Server
The GNU Project Debugger (GDB) is a freely available and open source debugger. It can be used in command line mode, but is also integrated in many IDEs like emIDE or Eclipse.
J-Link GDB Server is a remote server for GDB making it possible for GDB to connect to and communicate with the target device via J-Link. GDB Server and GDB communicate via a TCP/IP connection, using the standard GDB remote protocol. GDB Server receives the GDB commands, does the J-Link communication and replies with the answer to GDB.
With J-Link GDB Server debugging in ROM and Flash of the target device is possible and the Unlimited Flash Breakpoints can be used. It also comes with some functionality not directly implemented in the GDB. These can be accessed via monitor commands, sent directly via GDB, too.

J-Link GDB Server

J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 99
99 CHAPTER 4
The GNU Project Debugger (GDB) is a freely available debugger, distributed under the terms of the GPL. The latest Unix version of the GDB is freely available from the GNU committee under: http://www.gnu.org/software/gdb/download/
J-Link GDB Server is distributed free of charge.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Page 100

100 CHAPTER 4 J-Link GDB Server CL (Windows, Linux, Mac)

4.1 J-Link GDB Server CL (Windows, Linux, Mac)
J-Link GDB Server CL is a commandline-only version of the GDB Server. The command line version is part of the Software and Documentation Package and also included in the Linux and MAC versions.
Except for the missing GUI, J-Link GDB Server CL is identical to the normal version. All sub-chapters apply to the command line version, too.
J-Link / J-Trace (UM08001) © 2004-2019 SEGGER Microcontroller GmbH
Loading...