0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
8.18.00 J-TRACE PRO FOR CORTEX-M

8.18.00 J-TRACE PRO FOR CORTEX-M

  • 厂商:

    SEGGERMICROCONTROLLERSYSTEMS

  • 封装:

    -

  • 描述:

    8.18.00 J-TRACE PRO FOR CORTEX-M

  • 数据手册
  • 价格&库存
8.18.00 J-TRACE PRO FOR CORTEX-M 数据手册
J-Link / J-Trace User Guide Document: UM08001 Software Version: 7.68 Date: July 14, 2022 A product of SEGGER Microcontroller GmbH www.segger.com 2 Disclaimer The information written in this document is assumed to be accurate without guarantee. The information in this manual is subject to change for functional or performance improvements without notice. SEGGER Microcontroller GmbH (SEGGER) assumes no responsibility for any errors or omissions in this document. SEGGER disclaims any warranties or conditions, express, implied or statutory for the fitness of the product for a particular purpose. It is your sole responsibility to evaluate the fitness of the product for any specific use. 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-2021 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. Fax. E-mail: Internet: +49-2173-99312-0 +49-2173-99312-28 support@segger.com www.segger.com J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 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: July 14, 2022 Manual Revision version 7.65e 0 Date By Description 220509 LG Chapter “Target interfaces and adapters” * Section “20-pin J-Link connector”: Added sub-section “Pinout for QSPI” 7.62 0 220212 MK Chapter “Open Flashloader” * Section “General procedure”: Updated information regarding usage of JLinkDevices folder. * Section “Information for Silicon Vendors”: Updated information regarding usage of JLinkDevices folder.      DisableLTRACEAnalysis 7.52 0 210730 NV Chapter “Working with J-Link and J-Trace” * Section “J-link Command Strings”: Added      DisableLTRACEAnalysis 7.50 0 210707 EL Chapter “Reset strategies” *Moved section to the wiki 7.00a 0 210419 LG Chapter “Target interfaces and adapters” *Section “20-pin J-Link connector” *Section “Pinout for SWD” *Section “Target power supply”: The word “perm” was part of the wrong column. Fixed. 7.00a 0 210419 LG Chapter “Target interfaces and adapters” *Section “Reference voltage (VTref)”: Typo: “on” instead of “one. Fixed. 7.00a 0 210419 LG Chapter ”Target interfaces and adapters“ *Section ”Reference voltage (VTref)“: Added link to wiki article for setting a fixed VTref via J-Link Commander. SI Chapter ”Working with J-Link and J-Trace“ *Section ”JTAG interface“ *Section ”Multiple devices in the scan chain“: Number of supported JTAG-chain devices updated to 32. Fixed. 6.98e 0 210401 6.94 0 210224 FF Chapter ”Working with J-Link and J-Trace“ *Section ”J-Link script files“ *Section ”Supported Operators“: Modulo operator was listed as supported even though it is not. Fixed. 6.88 0 201113 NV Chapter ”Working with J-Link and J-Trace“ *Section ”J-Link Command Strings“ added command string TraceFile. 6.88 0 201113 FF Chapter ”RTT“ *Section ”API functions“: SEGGER_RTT_ConfigDownBuffer and SEGGER_RTT_ConfigUpBuffer: In the ”Example“ section both functions were falsely named. Fixed. 6.86 0 201015 DL Chapter ”J-Link Command Strings“ Added missing parameters of command ”SetCFIFlash“ 6.80 0 200324 FF Chapter ”JTAGLoad“ Added missing command line option ”-LogFile“ LG Chapter ”J-Link GDB Server“ *Section ”Command line options“: Replaced occurrences of ”OS X“ with ”macOS“. Chapter ”J-Flash SPI“ Updated for recently added cross-platform availability of J-Flash SPI. 6.64 0 200324 6.64 0 200317 LG Chapter ”J-Link Commander (Command line tool)“ *Section ”Command line options“: Moved to SEGGER wiki. *Section ”Using J-Link Command Files“: Moved to SEGGER wiki. 6.60 0 200106 LG Chapter ”J-Link Commander (Command line tool)“ *Section ”Commands“: Moved to SEGGER wiki. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 4 Manual Revision version Date By Description 6.56 0 191127 NV Chapter ”Working with J-Link and J-Trace“ *Section ”J-Link Command Strings“: Expanded coresight baseaddr commands. 6.54 4 191121 NV Chapter ”RTT“ *Section ”Implementation“: Added API function SEGGER_RTT_GetAvailWriteSpace(). 6.54 3 191120 DL Chapter ”J-Link GDB Server“ *Section ”Command line options“: Added information for command line option ”-rtos“ where to request the SDK for creating plug-ins. 6.54 2 191120 DL Chapter ”J-Link software and documentation package“ *Section ”J-Link Commander (Command line tool)“: Added note for VTREF command. 6.54 1 191105 FF Chapter ”Working with J-Link and J-Trace“ *Section ”J-Link script files“: Added default return value information for J-Link script file functions. 6.54 0 191023 AG Chapter ”Working with J-Link and J-Trace“ *Section ”J-Link WiFi setup“ added 6.52 0 191021 AG Chapter ”Semihosting“ *Section ”Debugger Support“ Took off Keil MDK-ARM of the list of supported IDEs as MDK does not support semihosting. 6.52 0 191016 LG Chapter ”RTT“ *Section ”Example code“ updated. LG Chapter ”J-Link software and documentation package“ *Section ”J-Link Remote Server“ Added command ”-TunnelEncrypt“ Added subsection ”Encrypted connection“ 6.50 0 191016 6.50 0 190923 DL 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 6.48 2 190813 AG Chapter ”J-Link software and documentation package“ * Section ”J-Link GDB Server“: Command line option ”-JLinkDevicesXMLPath“ corrected. 6.48 1 190802 DL 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” 6.48 0 190711 LG Chapter “J-Link software and documentation package” * Section “J-Link Commander (Command line tool) Added command ”WebUSBEnable“ Added command ”WebUSBDisable“ 6.46 0 190511 LG 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. 6.44 4 190424 AG Chapter ”Target interfaces and adapters“ * Section ”20-pin J-Link connector“: Corrected information for pins 14, 16, 18, 20. 6.44 3 190415 LG Chapter ”J-Link software and documentation pacakge“ * Updated J-Mem screenshot. Added Chapter ”J-Mem“ 6.44 2 190408 NV Chapter ”Target interfaces and adapters“ * Added diagram showing J-Trace PRO connection with target device. 6.44 1 190321 EL Chapter ”J-Link software and documentation package“ * Section ”J-Link GDB Server“: Command line options corrected. 6.44 0 190306 NV Chapter ”J-Link software and documentation package“ * Section ”J-Link Commander“: Added memory zone example for command ”mem“. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 5 Manual Revision version Date By Description 6.42 0 190215 NV Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Script Files“: Added new Scripting functions for ETB initialization. Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Expanded ”map region“ documentation. 6.40 1 181217 SI Chapter ”J-Link software and documentation package“ * Section ” J-Link SWO Viewer: Added description of command line option “-usb”“. 6.40 0 181120 AG Chapter ”ARM SWD specifics“ added Chapter ”ARM SWD specifics“ * Section ”SWD multi-drop“ added 6.34 10 181025 NV Chapter ”J-Link software and documentation package“ * Section ”J-Link SWO Viewer“: Updated description and pictures. 6.34 9 181023 NV Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“: Added new J-Link command string ”RTTTelnetAllowNonLocalClient“. 6.34 8 101018 AG Chapter ”Target interfaces and adapters“ * Section ”19-pin JTAG/SWD and Trace connector“: Added information about pitch of connector. 6.34 7 180906 SI Chapter ”J-Link Commander“ * Section ” Commands: Added description of “VTREF”. 6.34 6 180905 NV Chapter “Working with J-Link and J-Trace” * Section “J-Link Script files”: Added new Script file functions to replace generic trace module initializations. 6.34 5 180816 LG Chapter “J-Link GDB Server” * Section “Supported remote (monitor) commands”: Added new monitor command “flash erase”. 6.34 4 180704 AG Chapter “J-Link software and documentation package” * Section “J-Flash Lite” added. 6.34 3 180524 LG Chapter “J-Link software and documentation package” * Section “J-Link Commander (Command line tool)”: Added new command line option “-Log”. 6.34 2 180517 LG Chapter “Open Flashloader” * Section “XML Tags and Attributes”: Added new attribute “Aliases”. 6.34 1 180516 NV Chapter “J-Link software and documentation package” * Section “J-Link SWO Viewer”: Refined CL option descriptions. AG 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 6.34 0 180511 6.32 4 180417 NV Chapter “J-Flash SPI” * Section “Command Line Interface”: Updated description of CL option jflashlog. * Section “Command Line Interface”: Updated description of CL option jlinklog. 6.32 3 180409 NV 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()”. 6.32 2 180327 LG Chapter “Working with J-Link and J-Trace” * Section “J-Link Command Strings”: Added new J-Link command string “MemPreserveOnReset”. 6.32 1 180327 AG Moved contents of chapter “Segger-specific GDB protocol extensions” to separate manual (UM08036) 6.32 0 180323 AG Moved J-Link GDB Server to separate chapter Added Segger specific GDB protocol extension qSeggerSTRACE:caps Added Segger specific GDB protocol extension qSeggerSTRACE:GetInstStats 6.30 2 180314 AG Chapter “Working with J-Link and J-Trace” * Section “J-Link Command Strings”: Added new J-Link command string “SetAllowStopMode”. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 6 Manual Revision version 6.30 1 Date 180309 By Description NV Chapter “Working with J-Link and J-Trace” * Section “J-Link Script Files”:      Added new function SWO_EnableTarget();. * Section “J-Link Script Files”:      Renamed function GetSWOBaseClock() to SWO_GetSWOBaseClock();      Added unit information of clock speed value. 6.30 0 180206 EL 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(); 6.24 1 180124 EL Chapter “Working with J-Link and J-Trace” * Section “J-Link Comamnd Strings”: Updated. 6.24 0 180111 LG Chapter “J-Link software and documentation package” * Section “J-Link GDB Server”: Added new GDBServer monitor commands: ReadAP, ReadDP, WriteAP and WriteDP. NV 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. 6.22 0 171214 6.20 8 171123 AG 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. 6.20 7 171025 EL Chapter “Monitor Mode Debugging” * Section “Enable Monitor Debugging”: Updated 6.20 6 171013 EL 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 6.20 5 171011 NG Updated links to SEGGER wiki:      Low power mode debugging      J-Link script files      J-Link Command Strings 6.20 4 171011 NG 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() 6.20 3 171006 NG Chapter “Working with J-Link and J-Trace” * Section “Script file API functions”: Added return values for various functions 6.20 2 171005 EL Chapter “Open Flashloader” J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 7 Manual Revision version Date By Description * Section “Add. Info / Considerations / Limitations”: Updated 6.20 1 170922 NG Chapter “Working with J-Link and J-Trace” * Section “J-Link Command Strings”: Updated      Added new command string “EnableLowPowerHandlingMode” 6.16 0 170320 EL Chapter “Open Flashloader”      Added “AlwaysPresent” as new attribute to the 6.14 6 170407 NV Chapter “Working with J-Link and J-Trace” * Section “J-Link scriptfiles”: Updated      “JLINK_ExecCommand()” description 6.14 5 170320 EL Chapter “J-Flash SPI”      Updated screenshots NV Chapter “Working with J-Link and J-Trace” * Section “J-Link scriptfiles”:      Added: “JLINK_ExecCommand()”      Section “Keil MDK-ARM” added for Command string execution NV 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” NV 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. NV Chapter “Working with J-Link and J-Trace” * Section “Exec Commands”: Updated      SetResetPulseLen      TraceSampleAdjust Chapter “Trace” * Section “Tracing via trace pins”: Updated 6.14 6.14 6.14 6.14 4 3 2 1 170317 170220 170216 170210 6.14 0 170201 AG Chapter “Working with J-Link” * Section “Exec Commands”: Updated      SelectTraceSource      SetRAWTRACEPinDelay      ReadIntoTraceCache Chapter “Trace” added. 6.10a 0 160820 EL Chapter “Working With J-Link” * Section “Exec Commands”: Updated ExcludeFlashCacheRanges. 6.00i 0 160802 EL Chapter “Introduction” * Removed “Model Feature Lists” Chapter “Adding Support for New Devices”:      renamed to “Open Flash Loader” Chapter “Open Flash Loader” updated. 6.00 1 160617 EL Chapter “J-Flash SPI” * Added chapter “Custom Command Sequences” 6.00 0 160519 AG Chapter “Adding Support for New Devices” added. 5.12f 0 160503 AB Chapter “Related Software” * Section “J-Link RTT Viewer” updated and moved from section “RTT”. 5.12d 1 160427 AG Chapter “Working with J-Link and J-Trace” * Section “J-Link script files” updated. 5.12d 0 160425 AG Chapter “Working with J-Link and J-Trace” * Section “J-Link script files” updated. 5.12c 0 160413 NG Chapter “Related Software” * Section “J-Link Commander”      Typo fixed. NG 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. 5.12c 1 J-Link / J-Trace (UM08001) 160418 © 2004-2021 SEGGER Microcontroller GmbH 8 Manual Revision version Date By Description Chapter “Flash Download” * Section “Debugging applications that change flash contents at runtime” added. 5.10u 0 160317 AG Chapter “Monitor Mode Debugging” * Section “Target application performs reset” added. 5.10t 0 160314 AG Chapter “Monitor Mode Debugging” * Section “Enable Monitor Debugging” updated. * Section “Forwarding of Monitor Interrupts” added. 5.10 3 160309 EL Chapter “J-Flash SPI” updated. 5.10 2 160215 AG Chapter “RTT” updated. 5.10 1 151204 AG Chapter “RDI” updated. Chapter “Semihosting” added. 5.10 0 151127 NG Chapter “Related Software” * Section “J-Scope” removed. 5.02m 0 151125 AG Chapter “Working with J-Link and J-Trace” * Section “The J-Link settings file” added. Chapter “Low Power Debugging” added. 5.02l 0 151123 AG Various Chapters * Some typos corrected. 5.02i 1 151106 RH Chapter “J-Flash SPI” * Section “Send custom commands” added. 5.02i 0 151105 RH 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. 5.02f 1 151022 NG Chapter “Related Software” * Section “J-Scope” updated. 5.02f 1 151022 EL Chapter “Target interfaces and adapters” * Section “Reference voltage (VTref)” added. 5.02f 0 151007 RH Chapter “Working with J-Link and J-Trace” * Section “J-Link script files” updated. 5.02e 0 151001 AG Chapter “Working with J-Link and J-Trace” * Section “J-Link script files” updated 5.02c 1 150925 NG Chapter “Licensing” * Section “Original SEGGER products” updated. Chapter “Flash download” * Section “Setup for various debuggers (CFI flash)” updated. 5.02c 0 150916 RH Chapter “Flash download” * Section “Setup for various debuggers (SPIFI flash)” added. 5.02c 0 150914 RH Chapter “Introduction” * Section “J-Link / J-Trace models” updated. * Section “Supported OS”      Added Windows 10 5.02a 0 150903 AG Chapter “Monitor Mode Debugging” added. 5.02 0 150820 AG Chapter “Working with J-Link and J-Trace” * Section “J-Link Command Strings”      “DisableCortexMXPSRAutoCorrectTBit” added. 5.02 0 150813 AG Chapter “Monitor Mode Debugging” added. 5.00 1 150728 NG Chapter “Related Software” * Section “J-Link Commander”      Sub-Section “Command line options” updated. 5.00 0 150609 AG Chapter “Flash download” * Section “QSPI flash support” added. Chapter “Flash breakpoints” * Section “Flash Breakpoints in QSPI flash” added 5.00 0 150520 EL Chapter “J-Flash SPI” * Initial version added J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 9 Manual Revision version Date By Description 4.99b 0 150520 EL Chapter “Related Software” * Section “J-Link STM32 Unlock”      Added command line options 4.99a 0 150429 AG Chapter “Target interfaces and Adapters” Chapter “20-pin J-Link connector”, section “Pinout for SPI” added. 4.98d 0 150427 EL Chapter “Related Software” * Section “Configure SWO output after device reset” updated. 4.98b 0 150410 AG Chapter “Licensing” * Section “J-Trace for Cortex-M” updated. 4.98 0 150320 NG 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 4.96f 0 150204 JL Chapter “Related Software” * Section “GDB Server”      Exit code description added. 4.96 0 141219 JL Chapter “RTT” added. Chapter “Related Software” * Section “GDB Server”      Command line option “-strict” added.      Command line option “-timeout” added. 4.90d 0 141112 NG Chapter “Related Software” * Section “J-Link Remote Server” updated. * Section “J-Scope” updated. 4.90c 0 140924 JL Chapter “Related Software” * Section “JTAGLoad” updated. 4.90b 1 140813 EL 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. 4.90b 0 140813 NG Chapter “Related Software” * Section “J-Scope” added. 4.86 2 140606 AG Chapter “Device specifics” * Section “Silicon Labs - EFM32 series devices” added 4.86 1 140527 JL Chapter “Related Software” * Section “GDB Server” Command line options -halt / -nohalt added. Description for GDB Server CL version added. 4.86 0 140519 AG Chapter “Flash download” Section “Mentor Sourcery CodeBench” added. EL 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.“ 4.84 0 140321 4.82 1 140228 EL 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” 4.82 0 140218 JL Chapter “Related Software” * Section “GDB Server” Command line option -notimeout added. 4.80f 0 140204 JL Chapter “Related Software” * Section “GDB Server”      Command line options and remote commands added. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 10 Manual Revision version Date By Description Chapter “Related Software” * Section “GDB Server”      Remote commands and command line options description improved. Several corrections. 4.80 1 131219 JL/ NG 4.80 0 131105 JL Chapter “Related Software” * Section “GDB Server”      SEGGER-specific GDB protocol extensions added. 4.76 3 130823 JL Chapter “Flash Download” * Replaced references to GDB Server manual. Chapter “Working with J-Link” * Replaced references to GDB Server manual. 4.76 2 130821 JL Chapter “Related Software” * Section “GDB Server”      Remote commands added. 4.76 1 130819 JL Chapter “Related Software” * Section “SWO Viewer”      Sample code updated. 4.76 0 130809 JL Chapter “Related Software” * Sections reordered and updated. Chapter “Setup” * Section “Using JLinkARM.dll moved here. 4.71b 0 130507 JL Chapter ”Related Software“ * Section ”SWO Viewer“      Added new command line options. 4.66 0 130221 JL Chapter ”Introduction“ * Section ”Supported OS“      Added Linux and Mac OSX 4.62b 0 130219 EL Chapter ”Introduction“ * Section ”J-Link / J-Trace models“      Clock rise and fall times updated. 4.62 0 130129 JL Chapter ”Introduction“ * Section ”J-Link / J-Trace models“      Sub-section ”J-link ULTRA“ updated. 4.62 0 130124 EL Chapter ”Target interfaces and adapters“ * Section ”9-pin JTAG/SWD connector“      Pinout description corrected. 4.58 1 121206 AG Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated. 4.58 0 121126 JL Chapter ”Working with J-Link“ * Section ”J-Link script files“      Sub-section ”Executing J-Link script files“ updated. 4.56b 0 121112 JL Chapter ”Related Software“ * Section ”J-Link SWO Viewer“      Added sub-section ”Configure SWO output after device reset“ 4.56a 0 121106 JL Chapter ”Related Software“ * Section ”J-Link Commander“      Renamed ”Commander script files“ to ”Commander files“ and      ”script mode“ to ”batch mode“. 4.56 0 121022 AG Renamed ”J-Link TCP/IP Server“ to ”J-Link Remote Server“ 4.54 1 121009 JL Chapter ”Related Software“ * Section ”TCP/IP Server“, subsection ”Tunneling Mode“ added. 4.54 0 120913 EL Chapter ”Flash Breakpoints“ * Section ”Licensing“ updated. Chapter ”Device specifics“ * Section ”Freescale“, subsection ”Data flash support“ added. 4.53c 0 120904 EL Chapter ”Licensing“ * Section ”Device-based license“ updated. EL 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“ 4.51h 0 J-Link / J-Trace (UM08001) 120717 © 2004-2021 SEGGER Microcontroller GmbH 11 Manual Revision version Date By Description * Section ”J-Link Commander“ updated. 4.51e 1 120704 EL Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated and corrected. Added reset type 8. 4.51e 0 120704 AG Chapter ”Device specifics“ * Section ”ST“ updated and corrected. 4.51b 0 120611 EL Chapter ”J-Link and J-Trace related software“ * Section ”SWO Viewer“ added. 4.51a 0 120606 EL 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. 4.47a 0 120419 AG Chapter ”Device specifics“ * Section ”Texas Instruments“ updated. 4.46 0 120416 EL Chapter ”Support“ updated. 4.42 0 120214 EL Chapter ”Working with J-Link“ * Section ”J-Link script files“ updated. 4.36 1 110927 EL 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. 4.36 0 110909 AG Chapter ”Working with J-Link“ * Section ”J-Link script files“ updated. 4.26 1 110513 KN Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ corrected. 4.26 0 110427 KN Several corrections. AG Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ corrected. Chapter ”Device specifics“ * Section ”ST Microelectronics“ updated. 4.24 1 110228 4.24 0 110216 AG 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. 4.23d 0 110202 AG 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. 4.21g 0 101130 AG 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. 4.21 0 101025 AG Chapter “Device specifics” * Section “Freescale” updated. 4.20j 0 101019 AG Chapter “Working with J-Link” * Section “Reset strategies” updated. 4.20b 0 100923 AG Chapter “Working with J-Link” * Section “Reset strategies” updated. AG 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” 0.00 90 J-Link / J-Trace (UM08001) 100818 © 2004-2021 SEGGER Microcontroller GmbH 12 Manual Revision version Date By Description * Section “J-Link Configurator added.” 0.00 89 100630 AG Several corrections. 0.00 88 100622 AG Chapter “J-Link and J-Trace related software” * Section “SWO Analyzer” added. 0.00 87 100617 AG Several corrections. 0.00 86 100504 AG Chapter “Introduction” * Section “J-Link / J-Trace models” updated. Chapter “Target interfaces and adapters” * Section “Adapters” updated. 0.00 85 100428 AG Chapter “Introduction” * Section “J-Link / J-Trace models” updated. 0.00 84 100324 KN Chapter “Working with J-Link and J-Trace” * Several corrections Chapter Flash download & flash breakpoints * Section “Supported devices” updated 0.00 83 100223 KN Chapter “Introduction” * Section “J-Link / J-Trace models” updated. 0.00 82 100215 AG Chapter “Working with J-Link” * Section “J-Link script files” added. 0.00 81 100202 KN Chapter “Device Specifics” * Section “Luminary Micro” updated. Chapter “Flash download and flash breakpoints” * Section “Supported devices” updated. 0.00 80 100104 KN Chapter “Flash download and flash breakpoints * Section ”Supported devices“ updated 0.00 79 091201 AG Chapter ”Working with J-Link and J-Trace“ * Section ”Reset strategies“ updated. Chapter ”Licensing“ * Section ”J-Link OEM versions“ updated. 0.00 78 091023 AG Chapter ”Licensing“ * Section ”J-Link OEM versions“ updated. 0.00 77 090910 AG Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated. KN 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 AG Chapter ”Introduction“ * Section ”J-Link / J-Trace models“ updated. Chapter ”Working with J-Link and J-Trace“ * Section ”SWD interface“ updated. KN 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 KN 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 AG Chapter ”Working with J-Link“ * Section ”J-Link control panel“ updated. Chapter ”Flash download and flash breakpoints“ * Section ”Supported devices“ updated. 0.00 0.00 0.00 0.00 0.00 76 75 74 73 72 J-Link / J-Trace (UM08001) 090828 090729 090722 090701 090618 © 2004-2021 SEGGER Microcontroller GmbH 13 Manual Revision version Date By Description Chapter ”Device specifics“ * Section ”NXP“ updated. 0.00 71 090616 AG Chapter ”Device specifics“ * Section ”NXP“ updated. 0.00 70 090605 AG Chapter ”Introduction“ * Section ”Common features of the J-Link product family“ updated. AG Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated. * Section ”Indicators“ updated. Chapter ”Flash download and flash breakpoints“ * Section ”Supported devices“ updated. 0.00 69 090515 0.00 68 090428 AG Chapter ”J-Link and J-Trace related software“ * Section ”J-Link STM32 Commander“ added. Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated. 0.00 67 090402 AG Chapter ”Working with J-Link“ * Section ”Reset strategies“ updated. 0.00 66 090327 AG 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. 0.00 65 090320 AG Several changes in the manual structure. 0.00 64 090313 AG Chapter ”Working with J-Link“ * Section ”Indicators“ added. 0.00 63 090212 AG Chapter ”Hardware“ * Several corrections. * Section ”Hardware Versions“ Version 8.0 added. 0.00 62 090211 AG 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. 0.00 61 090120 TQ Chapter ”Working with J-Link“ * Section ”Cortex-M3 specific reset strategies“ 0.00 60 090114 AG Chapter ”Working with J-Link“ * Section ”Cortex-M3 specific reset strategies“ 0.00 59 090108 KN Chapter Hardware * Section ”Target board design for JTAG“ updated. * Section ”Target board design for SWD“ added. 0.00 58 090105 AG Chapter ”Working with J-Link Pro“ * Section ”Connecting J-Link Pro the first time“ updated. AG 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. 0.00 57 081222 0.00 56 081219 AG Chapter ”Working with J-Link Pro“ * Section ”FAQs“ added. Chapter ”Support and FAQs“ * Section ”Frequently Asked Questions“ updated. 0.00 55 081218 AG Chapter ”Hardware“ updated. 0.00 54 081217 AG Chapter ”Working with J-Link and J-Trace“ * Section ”J-Link Command Strings“ updated. 0.00 53 081216 AG Chapter ”Working with J-Link Pro“ updated. 0.00 52 081212 AG Chapter ”Working with J-Link Pro“ added. Chapter ”Licensing“ * Section ”Original SEGGER products“ updated. 0.00 51 081202 KN Several corrections. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 14 Manual Revision version Date By Description 0.00 50 081030 AG Chapter ”Flash download and flash breakpoints“ * Section ”Supported devices“ corrected. 0.00 49 081029 AG Several corrections. 0.00 48 080916 AG Chapter ”Working with J-Link and J-Trace“ * Section ”Connecting multiple J-Links /      J-Traces to your PC“ updated. 0.00 47 080910 AG Chapter ”Licensing“ updated. 0.00 46 080904 AG Chapter ”Licensing“ added. Chapter ”Hardware“      Section ”J-Link OEM versions“ moved to chapter ”Licensing“ 0.00 45 080902 AG Chapter ”Hardware“      Section ”JTAG+Trace connector“ JTAG+Trace      connector pinout corrected.      Section ”J-Link OEM versions“ updated. 0.00 44 080827 AG Chapter ”J-Link control panel“ moved to chapter ”Working with J-Link“. Several corrections. 0.00 43 080826 AG Chapter ”Flash download and flash breakpoints“      Section ”Supported devices“ updated. 0.00 42 080820 AG Chapter ”Flash download and flash breakpoints“      Section ”Supported devices“ updated. 0.00 41 080811 AG Chapter ”Flash download and flash breakpoints“ updated. Chapter ”Flash download and flash breakpoints“, section ”Supported devices“ updated. 0.00 40 080630 AG Chapter ”Flash download and flash breakpoints“ updated. Chapter ”J-Link status window“ renamed to ”J-Link control panel“ Various corrections. AG 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. 0.00 39 080627 0.00 38 080618 AG Chapter ”Support and FAQs“      Section ”Frequently Asked Questions“ updated Chapter ”Reset strategies“      Section ”Cortex-M3 specific reset strategies“ updated. 0.00 37 080617 AG Chapter ”Reset strategies“      Section ”Cortex-M3 specific reset strategies“ updated. 0.00 36 080530 AG Chapter ”Hardware“      Section ”Differences between different versions“ updated. Chapter ”Working with J-Link and J-Trace“      Section ”Cortex-M3 specific reset strategies“ added. 0.00 35 080215 AG Chapter ”J-Link and J-Trace related software“      Section ”J-Link software and documentation package in detail“ updated. 0.00 34 080212 AG 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. 0.00 33 080207 AG Chapter ”Flash download and flash breakpoints“ added Chapter ”Device specifics:“      Section ”ATMEL - AT91SAM7 - Recommended init sequence“ added. 0.00 32 080129 SK Chapter ”Device specifics“:      Section ”NXP - LPC - Fast GPIO bug“ list of device enhanced. 0.00 31 080103 SK Chapter ”Device specifics“:      Section ”NXP - LPC - Fast GPIO bug“ updated. 0.00 30 071211 AG Chapter ”Device specifics“:      Section ”Analog Devices“ updated.      Section ”ATMEL“ updated. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 15 Manual Revision version Date By Description      Section ”Freescale“ added.      Section ”Luminary Micro“ added.      Section ”NXP“ updated.      Section ”OKI“ added.      Section ”ST Microelectronics“ updated.      Section ”Texas Instruments“ updated. Chapter ”Related software“:      Section ”J-Link STR91x Commander“ updated 0.00 29 070912 SK Chapter ”Hardware“, section ”Target board design“ updated. 0.00 28 070912 SK Chapter ”Related software“:      Section ”J-LinkSTR91x Commander“ added. Chapter ”Device specifics“:      Section ”ST Microelectronics“ added.      Section ”Texas Instruments“ added.      Subsection ”AT91SAM9“ added. 0.00 28 070912 AG Chapter ”Working with J-Link/J-Trace“:      Section ”J-Link Command Strings“ updated. 0.00 27 070827 TQ Chapter ”Working with J-Link/J-Trace“:      Section ”J-Link Command Strings“ updated. SK Chapter ”Introduction“:      Section ”Features of J-Link“ updated. Chapter ”Background Information“:      Section ”Embedded Trace Macrocell“ added.      Section ”Embedded Trace Buffer“ added. 0.00 26 070710 0.00 25 070516 SK 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. 0.00 24 070323 SK Chapter ”Setup“:      ”Uninstalling the J-Link driver“ updated.      ”Supported ARM cores“ updated. 0.00 23 070320 SK Chapter ”Hardware“:      ”Using the JTAG connector with SWD“ updated. 0.00 22 070316 SK Chapter ”Hardware“:      ”Using the JTAG connector with SWD“ added. 0.00 21 070312 SK Chapter ”Hardware“:      ”Differences between different versions“ supplemented. 0.00 20 070307 SK Chapter ”J-Link / J-Trace related software“:      ”J-Link GDB Server“ licensing updated. 0.00 19 070226 SK Chapter ”J-Link / J-Trace related software“ updated and reorganized. Chapter ”Hardware“      ”List of OEM products“ updated 0.00 18 070221 SK Chapter ”Device specifics“ added Subchapter ”J-Link Command Strings“ added 0.00 17 070131 SK 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 0.00 16 061222 SK Chapter ”Preface“: ”Company description“ added. J-Link picture changed. 0.00 15 060914 OO 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. 0.00 14 060818 TQ Subchapter 4.7 ”Using DCC for memory reads“ added. 0.00 13 060711 OO Subchapter 5.2.2: Corrected JTAG+Trace connector pinout table. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 16 Manual Revision version Date By Description 0.00 12 060628 OO Subchapter 4.1: Added ARM966E-S to List of supported ARM cores. 0.00 11 060607 SK Subchapter 5.5.2.2 changed. Subchapter 5.5.2.3 added. SK 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 0.00 10 060526 0.00 9 060324 OO 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. 0.00 8 060117 OO Chapter ”Related Software“: Added JLinkARM.dll. Screenshots updated. 0.00 7 051208 OO Chapter Working with J-Link: Sketch added. 0.00 6 051118 OO 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. 0.00 5 051103 TQ Chapter Setup: ”JTAG Speed“ added. 0.00 4 051025 OO Chapter Background information: ”Flash programming“ added. Chapter Setup: ”Scan chain configuration“ added. Some smaller changes. 0.00 3 051021 TQ Performance values updated. 0.00 2 051011 TQ Chapter ”Working with J-Link“ added. 0.00 1 050818 TW Initial Version J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 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 Language by Kernighan and Richie (ISBN 0--13--1103628), which describes the standard in C programming 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 Text that you enter at the command prompt or that appears on the display (that is system functions, file- or pathnames). Parameter Parameters in API functions. Sample Sample code in program examples. Sample comment Comments in program examples. Reference Reference to chapters, sections, tables and figures or other documents. GUIElement Buttons, dialog boxes, menu names, menu commands. Emphasis Very important sections. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 18 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 19 Table of contents 1 Introduction ..................................................................................................................28 1.1 1.2 1.3 1.4 1.5 1.6 2 Licensing ..................................................................................................................... 36 2.1 2.2 2.3 3 Requirements .............................................................................................. 29 Supported OS .............................................................................................. 30 Common features of the J-Link product family ................................................. 31 Supported CPU cores ....................................................................................32 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 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 Components requiring a license ..................................................................... 37 Legal use of SEGGER J-Link software ............................................................. 38 2.2.1 Use of the software with 3rd party tools .............................................. 38 Illegal Clones ...............................................................................................39 J-Link software and documentation package ............................................................. 40 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Software overview ........................................................................................41 J-Link Commander (Command line tool) ......................................................... 42 3.2.1 Command line options ....................................................................... 42 3.2.2 Using J-Link Command Files ............................................................... 42 J-Link Remote Server ................................................................................... 43 3.3.1 List of available commands ................................................................ 43 3.3.2 Tunneling mode ................................................................................ 44 3.3.3 Connecting to J-Link/ J-Trace using J-Link Remote Server ....................... 45 3.3.4 Encrypted connection .........................................................................47 J-Mem Memory Viewer ................................................................................. 48 J-Flash ........................................................................................................ 49 J-Flash Lite ................................................................................................. 50 3.6.1 Limitations in comparison to J-Flash .................................................... 50 3.6.2 Usage .............................................................................................. 50 J-Link RTT Viewer ........................................................................................ 52 3.7.1 RTT Viewer Startup ........................................................................... 52 3.7.2 Connection Settings ...........................................................................53 3.7.3 The Terminal Tabs ............................................................................. 53 3.7.4 Sending Input ...................................................................................54 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 20 3.8 3.9 3.10 3.11 3.12 3.13 4 3.7.5 Logging Terminal output .................................................................... 54 3.7.6 Logging Data .................................................................................... 54 3.7.7 Command line options ....................................................................... 55 3.7.8 Menus and Shortcuts ......................................................................... 57 3.7.9 Using "virtual" Terminals in RTT .......................................................... 59 3.7.10 Using Text Control Codes ................................................................. 59 J-Link SWO Viewer .......................................................................................60 3.8.1 J-Link SWO Viewer CL ....................................................................... 60 3.8.2 Usage .............................................................................................. 61 3.8.3 List of available command line options .................................................61 3.8.4 Configure SWO output after device reset ..............................................63 3.8.5 Target example code for terminal output .............................................. 64 SWO Analyzer ..............................................................................................66 JTAGLoad (Command line tool) .................................................................... 67 J-Link RDI (Remote Debug Interface) ........................................................... 69 3.11.1 Flash download and flash breakpoints ................................................ 69 Processor specific tools ............................................................................... 70 3.12.1 J-Link STR91x Commander (Command line tool) ................................. 70 3.12.2 J-Link STM32 Unlock (Command line tool) .......................................... 73 J-Link Software Developer Kit (SDK) .............................................................76 J-Link GDB Server ......................................................................................................77 4.1 4.2 4.3 J-Link GDB Server CL (Windows, Linux, Mac) .................................................. 79 Debugging with J-Link GDB Server .................................................................80 4.2.1 Setting up GDB Server GUI version ..................................................... 80 4.2.2 Setting up GDB Server CL version .......................................................80 4.2.3 GDB Server user interface ..................................................................81 4.2.4 Running GDB from different programs ................................................. 82 Supported remote (monitor) commands ..........................................................85 4.3.1 clrbp ................................................................................................86 4.3.2 cp15 ................................................................................................ 87 4.3.3 device ..............................................................................................87 4.3.4 DisableChecks ...................................................................................87 4.3.5 EnableChecks ................................................................................... 88 4.3.6 flash breakpoints ...............................................................................88 4.3.7 flash erase ....................................................................................... 88 4.3.8 getargs ............................................................................................ 88 4.3.9 go ................................................................................................... 88 4.3.10 halt ............................................................................................... 89 4.3.11 interface .........................................................................................89 4.3.12 jtagconf ..........................................................................................89 4.3.13 memU8 .......................................................................................... 90 4.3.14 memU16 ........................................................................................ 90 4.3.15 memU32 ........................................................................................ 90 4.3.16 reg ................................................................................................ 91 4.3.17 regs ...............................................................................................91 4.3.18 reset ..............................................................................................91 4.3.19 semihosting breakOnError ................................................................ 92 4.3.20 semihosting enable ..........................................................................92 4.3.21 semihosting IOClient ........................................................................92 4.3.22 semihosting ARMSWI ....................................................................... 93 4.3.23 semihosting ThumbSWI ....................................................................93 4.3.24 setargs ...........................................................................................93 4.3.25 setbp ............................................................................................. 94 4.3.26 sleep ..............................................................................................94 4.3.27 speed .............................................................................................94 4.3.28 step ............................................................................................... 95 4.3.29 SWO DisableTarget .......................................................................... 95 4.3.30 SWO EnableTarget ........................................................................... 95 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 21 4.4 4.5 4.6 4.7 5 4.3.31 SWO GetMaxSpeed ..........................................................................96 4.3.32 SWO GetSpeedInfo .......................................................................... 96 4.3.33 waithalt .......................................................................................... 96 4.3.34 wice ...............................................................................................97 4.3.35 ReadAP .......................................................................................... 97 4.3.36 ReadDP .......................................................................................... 97 4.3.37 WriteAP .......................................................................................... 98 4.3.38 WriteDP ..........................................................................................98 SEGGER-specific GDB protocol extensions ..................................................... 100 Command line options ................................................................................ 101 4.5.1 -cpu ...............................................................................................102 4.5.2 -device ...........................................................................................103 4.5.3 -endian .......................................................................................... 103 4.5.4 -gui ............................................................................................... 104 4.5.5 -if ..................................................................................................104 4.5.6 -ir ..................................................................................................104 4.5.7 -excdbg ..........................................................................................104 4.5.8 -jtagconf ........................................................................................ 105 4.5.9 -localhostonly ..................................................................................105 4.5.10 -log ..............................................................................................105 4.5.11 -logtofile .......................................................................................106 4.5.12 -halt .............................................................................................106 4.5.13 -nogui .......................................................................................... 106 4.5.14 -noir ............................................................................................ 106 4.5.15 -nolocalhostonly ............................................................................ 107 4.5.16 -nologtofile ................................................................................... 107 4.5.17 -nohalt ......................................................................................... 107 4.5.18 -noreset ....................................................................................... 108 4.5.19 -nosinglerun ..................................................................................108 4.5.20 -nosilent ....................................................................................... 108 4.5.21 -nostayontop .................................................................................108 4.5.22 -notimeout ....................................................................................109 4.5.23 -novd ........................................................................................... 109 4.5.24 -port ............................................................................................ 109 4.5.25 -rtos ............................................................................................ 109 4.5.26 -JLinkDevicesXMLPath .................................................................... 110 4.5.27 -jlinkscriptfile ................................................................................ 110 4.5.28 -powertarget ................................................................................. 110 4.5.29 -select ..........................................................................................110 4.5.30 -settingsfile ...................................................................................111 4.5.31 -silent .......................................................................................... 111 4.5.32 -singlerun ..................................................................................... 111 4.5.33 -speed ..........................................................................................111 4.5.34 -stayontop .................................................................................... 112 4.5.35 -timeout ....................................................................................... 112 4.5.36 -strict ........................................................................................... 112 4.5.37 -swoport .......................................................................................113 4.5.38 -telnetport .................................................................................... 113 4.5.39 -vd .............................................................................................. 113 4.5.40 -x ................................................................................................ 113 4.5.41 -xc ...............................................................................................114 Program termination ................................................................................... 115 4.6.1 Exit codes ...................................................................................... 115 Semihosting ...............................................................................................116 J-Mem ....................................................................................................................... 117 5.1 5.2 Setting up J-Mem .......................................................................................118 J-Mem user interface .................................................................................. 119 5.2.1 Go To .............................................................................................119 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 22 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 6 Setup ......................................................................................................................... 122 6.1 6.2 6.3 6.4 6.5 6.6 6.7 7 Access width ...................................................................................119 Fill memory .................................................................................... 119 Save memory data .......................................................................... 120 Periodic Refresh .............................................................................. 120 Command line options ..................................................................... 121 Installing the J-Link software and documentation pack .................................... 123 6.1.1 Setup procedure ..............................................................................123 Setting up the USB interface ....................................................................... 124 6.2.1 Verifying correct driver installation .....................................................124 6.2.2 Uninstalling the J-Link USB driver ......................................................125 Setting up the IP interface .......................................................................... 127 6.3.1 Configuring J-Link using J-Link Configurator ........................................127 6.3.2 Configuring J-Link using the webinterface ........................................... 127 FAQs ......................................................................................................... 129 J-Link Configurator ..................................................................................... 130 6.5.1 Configure J-Links using the J-Link Configurator ................................... 130 J-Link USB identification ..............................................................................132 6.6.1 Connecting to different J-Links connected to the same host PC via USB ... 132 Using the J-Link DLL ...................................................................................133 6.7.1 What is the JLink DLL? .................................................................... 133 6.7.2 Updating the DLL in third-party programs ...........................................133 6.7.3 Determining the version of JLink DLL ................................................. 133 6.7.4 Determining which DLL is used by a program ......................................134 Working with J-Link and J-Trace .............................................................................. 135 7.1 7.2 7.3 J-Link WiFi setup ........................................................................................136 Supported IDEs ..........................................................................................137 Connecting the target system ...................................................................... 138 7.3.1 Power-on sequence ..........................................................................138 7.3.2 Verifying target device connection ..................................................... 138 7.3.3 Problems ........................................................................................ 138 7.4 Indicators .................................................................................................. 139 7.4.1 Main indicator ................................................................................. 139 7.4.2 Input indicator ................................................................................ 139 7.4.3 Output indicator .............................................................................. 140 7.5 JTAG interface ............................................................................................141 7.5.1 Multiple devices in the scan chain ..................................................... 141 7.5.2 Sample configuration dialog boxes .....................................................141 7.5.3 Determining values for scan chain configuration .................................. 142 7.5.4 JTAG Speed .................................................................................... 143 7.6 SWD interface ............................................................................................145 7.6.1 SWD speed .....................................................................................145 7.6.2 SWO .............................................................................................. 145 7.7 Multi-core debugging .................................................................................. 147 7.7.1 How multi-core debugging works .......................................................147 7.7.2 Using multi-core debugging in detail .................................................. 148 7.7.3 Things you should be aware of ......................................................... 149 7.8 Connecting multiple J-Links / J-Traces to your PC ........................................... 150 7.8.1 How does it work? .......................................................................... 150 7.9 J-Link control panel .................................................................................... 152 7.9.1 Tabs ...............................................................................................152 7.10 Reset strategies ........................................................................................158 7.11 Using DCC for memory access ................................................................... 159 7.11.1 What is required? .......................................................................... 159 7.11.2 Target DCC handler ........................................................................159 7.11.3 Target DCC abort handler ............................................................... 159 7.12 The J-Link settings file .............................................................................. 160 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 23 7.13 7.14 7.15 7.16 7.17 8 Flash download .........................................................................................................230 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9 Introduction ............................................................................................... 231 Licensing ................................................................................................... 232 Supported devices ...................................................................................... 233 Setup for various debuggers (internal flash) .................................................. 234 Setup for various debuggers (CFI flash) ........................................................ 235 Setup for various debuggers (SPIFI flash) ..................................................... 236 QSPI flash support ..................................................................................... 237 8.7.1 Setup the DLL for QSPI flash download .............................................. 237 Using the DLL flash loaders in custom applications ......................................... 238 Debugging applications that change flash contents at runtime .......................... 239 Flash breakpoints ......................................................................................................240 9.1 9.2 9.3 9.4 9.5 9.6 10 7.12.1 SEGGER Embedded Studio ..............................................................160 7.12.2 Keil MDK-ARM (uVision) ................................................................. 160 7.12.3 IAR EWARM .................................................................................. 160 7.12.4 Mentor Sourcery CodeBench for ARM ............................................... 160 J-Link script files ...................................................................................... 161 7.13.1 Actions that can be customized ....................................................... 161 7.13.2 Script file API functions .................................................................. 168 7.13.3 Global DLL variables ...................................................................... 191 7.13.4 Global DLL constants ..................................................................... 195 7.13.5 Script file language ........................................................................ 197 7.13.6 Script file writing example .............................................................. 198 7.13.7 Executing J-Link script files .............................................................199 J-Link Command Strings ............................................................................200 7.14.1 List of available commands ............................................................. 200 7.14.2 Using J-Link Command Strings ........................................................ 225 Switching off CPU clock during debug ......................................................... 226 Cache handling .........................................................................................227 7.16.1 Cache coherency ........................................................................... 227 7.16.2 Cache clean area ........................................................................... 227 7.16.3 Cache handling of ARM7 cores ........................................................ 227 7.16.4 Cache handling of ARM9 cores ........................................................ 227 Virtual COM Port (VCOM) ...........................................................................228 7.17.1 Configuring Virtual COM Port ...........................................................228 Introduction ............................................................................................... 241 Licensing ................................................................................................... 242 9.2.1 Free for evaluation and non-commercial use ....................................... 242 Supported devices ...................................................................................... 243 Setup & compatibility with various debuggers ................................................ 244 9.4.1 Setup .............................................................................................244 9.4.2 Compatibility with various debuggers ................................................. 244 Flash Breakpoints in QSPI flash ....................................................................245 9.5.1 Setup .............................................................................................245 FAQ .......................................................................................................... 246 Monitor Mode Debugging ....................................................................................... 247 10.1 10.2 10.3 10.4 10.5 10.6 10.7 Introduction ............................................................................................. 248 Enable Monitor Debugging ......................................................................... 249 Availability and limitations of monitor mode ................................................. 250 10.3.1 Cortex-M3 .....................................................................................250 10.3.2 Cortex-M4 .....................................................................................250 Monitor code ............................................................................................ 251 Debugging interrupts ................................................................................ 252 Having servicing interrupts in debug mode .................................................. 253 Forwarding of Monitor Interrupts ................................................................ 254 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 24 10.8 11 Low Power Debugging ............................................................................................256 11.1 11.2 11.3 12 Target application performs reset (Cortex-M) ............................................... 255 Introduction ............................................................................................. 257 Activating low power mode handling for J-Link ............................................. 258 Restrictions .............................................................................................. 259 Open Flashloader ................................................................................................... 260 12.1 12.2 12.3 12.4 12.5 Introduction ............................................................................................. 261 General procedure .................................................................................... 262 Adding a new device .................................................................................263 Editing/Extending an Existing Device ...........................................................264 XML Tags and Attributes ............................................................................265 12.5.1 ..................................................................................265 12.5.2 ..................................................................................... 265 12.5.3 ................................................................................... 265 12.5.4 ........................................................................... 267 12.6 Example XML file ...................................................................................... 269 12.7 Add. Info / Considerations / Limitations ....................................................... 270 12.7.1 CMSIS Flash Algorithms Compatibility .............................................. 270 12.7.2 Supported Cores ............................................................................270 12.7.3 Information for Silicon Vendors ....................................................... 270 12.7.4 Template Projects and How To's ...................................................... 270 13 J-Flash SPI ............................................................................................................. 271 13.1 Introduction ............................................................................................. 272 13.1.1 What is J-Flash SPI? ...................................................................... 272 13.1.2 J-Flash SPI CL (Windows, Linux, macOS) ..........................................273 13.1.3 Features ....................................................................................... 273 13.1.4 Requirements ................................................................................ 273 13.2 Licensing ................................................................................................. 274 13.2.1 Introduction .................................................................................. 274 13.3 Getting Started ........................................................................................ 275 13.3.1 Setup ........................................................................................... 275 13.3.2 Using J-Flash SPI for the first time .................................................. 275 13.3.3 Menu structure .............................................................................. 276 13.4 Settings ...................................................................................................279 13.4.1 Project Settings ............................................................................. 279 13.4.2 Global Settings ..............................................................................283 13.5 Command Line Interface ........................................................................... 285 13.5.1 Overview ...................................................................................... 285 13.5.2 Command line options ....................................................................285 13.5.3 Batch processing ........................................................................... 287 13.5.4 Programming multiple targets in parallel ...........................................287 13.6 Creating a new J-Flash SPI project ............................................................. 290 13.7 Custom Command Sequences .................................................................... 291 13.7.1 Init / Exit steps ............................................................................. 291 13.7.2 Example ....................................................................................... 291 13.7.3 J-Flash SPI Command Line Version .................................................. 292 13.8 Device specifics ........................................................................................ 295 13.8.1 SPI flashes with multiple erase commands ........................................ 295 13.9 Target systems .........................................................................................296 13.9.1 Which flash devices can be programmed? ......................................... 296 13.10 Performance ........................................................................................... 297 13.10.1 Performance values ...................................................................... 297 13.11 Background information ........................................................................... 298 13.11.1 SPI interface connection ............................................................... 298 13.12 Support ................................................................................................. 299 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 25 13.12.1 13.12.2 14 RDI .......................................................................................................................... 300 14.1 14.2 14.3 14.4 14.5 15 Introduction ............................................................................................. 324 SWD multi-drop ....................................................................................... 325 15.2.1 How it works ................................................................................ 325 15.2.2 Setting up SWD multi-drop in the J-Link software .............................. 325 15.2.3 J-Link support ............................................................................... 325 RTT ......................................................................................................................... 326 16.1 16.2 16.3 16.4 16.5 16.6 16.7 17 Introduction ............................................................................................. 301 14.1.1 Features ....................................................................................... 301 Licensing ................................................................................................. 302 Setup for various debuggers ...................................................................... 303 14.3.1 ARM AXD (ARM Developer Suite, ADS) ............................................. 303 14.3.2 ARM RVDS (RealView developer suite) ..............................................305 14.3.3 GHS MULTI ................................................................................... 310 Configuration ........................................................................................... 313 14.4.1 Configuration file JLinkRDI.ini ..........................................................313 14.4.2 Using different configurations .......................................................... 313 14.4.3 Using multiple J-Links simultaneously ...............................................313 14.4.4 Configuration dialog ....................................................................... 313 Semihosting ............................................................................................. 322 14.5.1 Unexpected / unhandled SWIs .........................................................322 ARM SWD specifics ................................................................................................323 15.1 15.2 16 Troubleshooting ........................................................................... 299 Contacting support .......................................................................299 Introduction ............................................................................................. 327 How RTT works ........................................................................................ 328 16.2.1 Target implementation ....................................................................328 16.2.2 Locating the Control Block .............................................................. 328 16.2.3 Internal structures ......................................................................... 328 16.2.4 Requirements ................................................................................ 329 16.2.5 Performance ..................................................................................329 16.2.6 Memory footprint ........................................................................... 329 RTT Communication .................................................................................. 330 16.3.1 RTT Viewer ................................................................................... 330 16.3.2 RTT Client .....................................................................................330 16.3.3 RTT Logger ................................................................................... 330 16.3.4 RTT in other host applications ......................................................... 331 Implementation ........................................................................................ 332 16.4.1 API functions ................................................................................ 332 16.4.2 Configuration defines ..................................................................... 338 ARM Cortex - Background memory access ................................................... 341 Example code .......................................................................................... 342 FAQ ........................................................................................................ 343 Trace ....................................................................................................................... 344 17.1 Introduction ............................................................................................. 345 17.1.1 What is backtrace? ........................................................................ 345 17.1.2 What is streaming trace? ................................................................345 17.1.3 What is code coverage? ..................................................................345 17.1.4 What is code profiling? ................................................................... 346 17.2 Tracing via trace pins ................................................................................ 347 17.2.1 Cortex-M specifics ..........................................................................347 17.2.2 Trace signal timing ........................................................................ 347 17.2.3 Adjusting trace signal timing on J-Trace ............................................347 17.2.4 J-Trace models with support for streaming trace ................................ 348 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 26 17.3 Tracing with on-chip trace buffer ................................................................ 349 17.3.1 CPUs that provide tracing via pins and on-chip buffer ......................... 349 17.4 Target devices with trace support ............................................................... 350 17.5 Streaming trace ....................................................................................... 351 17.5.1 Download and execution address differ .............................................351 17.5.2 Do streaming trace without prior download ....................................... 351 18 Target interfaces and adapters ...............................................................................352 18.1 18.2 18.3 18.4 18.5 19 Background information .......................................................................................... 366 19.1 19.2 19.3 19.4 19.5 20 20-pin J-Link connector ............................................................................. 353 18.1.1 Pinout for JTAG ............................................................................. 353 18.1.2 Pinout for SWD ............................................................................. 355 18.1.3 Pinout for SWD + Virtual COM Port (VCOM) ...................................... 357 18.1.4 Pinout for SPI ............................................................................... 358 18.1.5 Pinout for QSPI ............................................................................. 359 19-pin JTAG/SWD and Trace connector ........................................................360 18.2.1 Connecting the target board ........................................................... 361 18.2.2 Target power supply ...................................................................... 361 9-pin JTAG/SWD connector ........................................................................ 363 Reference voltage (VTref) .......................................................................... 364 Adapters ..................................................................................................365 JTAG ....................................................................................................... 367 19.1.1 Test access port (TAP) ....................................................................367 19.1.2 Data registers ............................................................................... 367 19.1.3 Instruction register ........................................................................ 367 19.1.4 The TAP controller ......................................................................... 367 Embedded Trace Macrocell (ETM) ................................................................370 19.2.1 Trigger condition ............................................................................370 19.2.2 Code tracing and data tracing ......................................................... 370 19.2.3 J-Trace integration example - IAR Embedded Workbench for ARM ......... 370 Embedded Trace Buffer (ETB) .................................................................... 374 Flash programming ................................................................................... 375 19.4.1 How does flash programming via J-Link / J-Trace work? ...................... 375 19.4.2 Data download to RAM ................................................................... 375 19.4.3 Data download via DCC ..................................................................375 19.4.4 Available options for flash programming ........................................... 375 J-Link / J-Trace firmware ........................................................................... 377 19.5.1 Firmware update ........................................................................... 377 19.5.2 Invalidating the firmware ................................................................377 Designing the target board for trace .......................................................................379 20.1 Overview of high-speed board design ..........................................................380 20.1.1 Avoiding stubs ...............................................................................380 20.1.2 Minimizing Signal Skew (Balancing PCB Track Lengths) ....................... 380 20.1.3 Minimizing Crosstalk ...................................................................... 380 20.1.4 Using impedance matching and termination ...................................... 380 20.2 Terminating the trace signal .......................................................................381 20.2.1 Rules for series terminators ............................................................ 381 20.3 Signal requirements .................................................................................. 382 21 Semihosting .............................................................................................................383 21.1 Introduction ............................................................................................. 384 21.1.1 Advantages ................................................................................... 384 21.1.2 Disadvantages ............................................................................... 384 21.2 Debugger support .....................................................................................385 21.3 Implementation ........................................................................................ 386 21.3.1 SVC instruction ............................................................................. 386 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 27 21.3.2 Breakpoint instruction .................................................................... 386 21.3.3 J-Link GDBServer optimized version ................................................. 386 21.4 Communication protocol ............................................................................ 389 21.4.1 Register R0 ...................................................................................389 21.4.2 Command SYS_OPEN (0x01) .......................................................... 389 21.4.3 Command SYS_CLOSE (0x02) ......................................................... 390 21.4.4 Command SYS_WRITEC (0x03) ....................................................... 390 21.4.5 Command SYS_WRITE0 (0x04) ....................................................... 391 21.4.6 Command SYS_WRITE (0x05) ......................................................... 391 21.4.7 Command SYS_READ (0x06) .......................................................... 391 21.4.8 Command SYS_READC (0x07) .........................................................392 21.4.9 Command SYS_ISTTY (0x09) .......................................................... 392 21.4.10 Command SYS_SEEK (0x0A) ......................................................... 392 21.4.11 Command SYS_FLEN (0x0C) ......................................................... 393 21.4.12 Command SYS_REMOVE (0x0E) .....................................................393 21.4.13 Command SYS_RENAME (0x0F) ..................................................... 393 21.4.14 Command SYS_GET_CMDLINE (0x15) ............................................ 394 21.4.15 Command SYS_EXIT (0x18) .......................................................... 394 21.5 Enabling semihosting in J-Link GDBServer ................................................... 395 21.5.1 SVC variant .................................................................................. 395 21.5.2 Breakpoint variant ......................................................................... 395 21.5.3 J-Link GDBServer optimized variant ................................................. 395 21.6 Enabling Semihosting in J-Link RDI + AXD .................................................. 396 21.6.1 Using SWIs in your application ........................................................ 396 22 Environmental Conditions & Safety ........................................................................ 397 22.1 J-Link ...................................................................................................... 398 22.1.1 Affected models .............................................................................398 22.2 Flasher .................................................................................................... 399 22.2.1 Affected models .............................................................................399 22.3 J-Trace .................................................................................................... 400 22.3.1 Affected models .............................................................................400 23 Support and FAQs .................................................................................................. 401 23.1 23.2 Measuring download speed ........................................................................ 402 Troubleshooting ........................................................................................ 403 23.2.1 General procedure ......................................................................... 403 23.3 Contacting support ................................................................................... 404 23.3.1 Contact Information ....................................................................... 404 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 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-2021 SEGGER Microcontroller GmbH 29 1.1 CHAPTER 1 Requirements 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 features are supported by each emulator, please refer to SEGGER debug probes on page 35. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 30 CHAPTER 1 1.2 Supported OS 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-2021 SEGGER Microcontroller GmbH 31 CHAPTER 1 1.3 Common features of the J-Link product family 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-2021 SEGGER Microcontroller GmbH 32 1.4 CHAPTER 1 Supported CPU cores 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-2021 SEGGER Microcontroller GmbH 33 CHAPTER 1 1.5 Built-in intelligence for supported CPU-cores 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 PCside 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 JLink firmware. This means, all target sequences (JTAG/SWD/…) are generated on the PCside 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 performance 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-2021 SEGGER Microcontroller GmbH 34 CHAPTER 1 1.5.2.1 • • • Built-in intelligence for supported CPU-cores 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 JLink, 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-2021 SEGGER Microcontroller GmbH 35 CHAPTER 1 1.6 Where to find further information 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 1.6.1.1 SEGGER debug probes 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-2021 SEGGER Microcontroller GmbH 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-2021 SEGGER Microcontroller GmbH 37 2.1 CHAPTER 2 Components requiring a license 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-2021 SEGGER Microcontroller GmbH 38 CHAPTER 2 2.2 Legal use of SEGGER J-Link software 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 prohibited 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 products 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-2021 SEGGER Microcontroller GmbH 39 2.3 CHAPTER 2 Illegal Clones Illegal Clones Clones are copies of SEGGER products which use the copyrighted SEGGER Firmware without 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 reasons, 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 JLink software with clones. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 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-2021 SEGGER Microcontroller GmbH 41 CHAPTER 3 3.1 Software overview Software overview The J-Link Software and Documentation Package, which is available for download from segger.com/downloads/jlink , 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. J-Link GDB Server The J-Link GDB Server is a server connecting to the GNU Debugger (GDB) via TCP/IP. It is required for toolchains using the GDB protocol to connect to J-Link. J-Link GDB Server command line version Command line version of the J-Link GDB Server. Same functionality as the GUI version. J-Link Remote Server Utility which provides the possibility to use J-Link / J-Trace remotely via TCP/IP. J-Mem Target memory viewer. Shows the memory content of a running target and allows editing as well. J-Flasha Stand-alone flash programming application. For more information about J-Flash please refer to J-Flash ARM User’s Guide (UM08003). J-Flash Lite Stand-alone flash programming application. Reduced feature set of J-Flash J-Link RTT Viewer Free-of-charge utility for J-Link. Displays the terminal output of the target using RTT. Can be used in parallel with a debugger or stand-alone. J-Link SWO Viewer 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. J-Link SWO Analyzer Command line tool that analyzes SWO RAW output and stores it into a file. JTAGLoad Command line tool that opens an svf file and sends the data in it via J-Link / J-Trace to the target. J-Link Configurator 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 . RDI supporta Provides Remote Debug Interface (RDI) support. This allows the user to use J-Link with any RDI-compliant debugger. Processor specific tools 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-2021 SEGGER Microcontroller GmbH 42 CHAPTER 3 3.2 J-Link Commander (Command line tool) J-Link Commander (Command line tool) For more information on the commands supported by the J-Link Commander, please refer to the SEGGER wiki: SEGGER Wiki: J-Link commander 3.2.1 Command line options For more information on the command line options supported by the J-Link Commander, please refer to the SEGGER wiki: SEGGER Wiki: J-Link commander 3.2.2 Using J-Link Command Files For more information on how to use J-Link Command Files with J-Link Commander, please refer to the SEGGER wiki: SEGGER Wiki: J-Link commander J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 43 CHAPTER 3 3.3 J-Link Remote Server 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 Specifies to connect to a J-Link with a specific S/N. Only valid for LAN mode. -TunnelServer Specify a tunnel server to connect to (default: jlink.segger.com:19020). Only valid for tunnel mode. -TunnelBySN Specifies to identify at tunnel server via J-Link S/N. Only valid for tunnel mode. -TunnelByName Specifies to identify at tunnel server via custom name. Only valid for tunnel mode. -TunnelPW Specifies to protect the connection with a password. Only valid for tunnel mode. -TunnelPort Specifies to connect to a tunnel server listening on a specific port. Only valid for tunnel mode. -TunnelEncrypt Specifies to encrypt any transferred data of a tunneled connection -select [=] Specify how to connect to JLink. port 1 Selects the IP port on which the J-Link Remote Server is listening. UseTunnel 1 Starts J-Link Remote Server in tunneling mode SelectEmuBySN 1 Selects the J-Link to connect to by its serial number. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 44 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: can be established and the debugger is connected to the J-Link. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 45 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 for a Remote Server running in LAN mode. IP tunnel:[:[: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-2021 SEGGER Microcontroller GmbH 46 CHAPTER 3 J-Link Remote Server Troubleshooting Problem Solution Remote server cannot connect to tunnel server. 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. J-Link Commander cannot connect to tunnel server. 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. 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: 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-2021 SEGGER Microcontroller GmbH 47 CHAPTER 3 3.3.4 J-Link Remote Server 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-2021 SEGGER Microcontroller GmbH 48 3.4 CHAPTER 3 J-Mem Memory Viewer 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 117 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 49 3.5 CHAPTER 3 J-Flash J-Flash J-Flash is an application to program data images to the flash of a target device. With JFlash 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-2021 SEGGER Microcontroller GmbH 50 CHAPTER 3 3.6 J-Flash Lite 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 • • • • 3.6.2 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 preselected on startup) 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 programming of the target: Dialog element Function “…” button Selects the application image (bin, hex, mot, …) to program “Erase chip” button Erases all flash banks of the device “Program Device” button Programs the selected application image J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 51 J-Link / J-Trace (UM08001) CHAPTER 3 J-Flash Lite © 2004-2021 SEGGER Microcontroller GmbH 52 CHAPTER 3 3.7 J-Link RTT Viewer 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 326. 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-2021 SEGGER Microcontroller GmbH 53 CHAPTER 3 3.7.2 J-Link RTT Viewer 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 automatically, 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 SEGGER_RTT_TerminalOut(). RTT Viewer displays the Terminals in different tabs. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 54 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-2021 SEGGER Microcontroller GmbH 55 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 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 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 56 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 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 for a list of available J-Links in the local subnet. Syntax --host Example JLinkRTTViewer.exe --host 192.168.1.17 3.7.7.6 --speed Sets the interface speed in kHz for target communication. Syntax --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 Example JLinkRTTViewer.exe --scriptfile C:\tmp\ 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 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 57 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 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 ]> [, 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… Opens the connect dialog and connects to the targets F2 -> Disconnect Disconnects from the target F3 -> Exit Closes connection and exit RTT Viewer. Alt-F4 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-2021 SEGGER Microcontroller GmbH 58 CHAPTER 3 Menu entry J-Link RTT Viewer Contents Shortcut -> Open Terminal on output If selected, a terminal is automatically created, if data for this terminal is received. -> Show Log Opens or closes the Log Tab. Alt-L Opens or closes the Terminal Tab. AltShift-0 AltShift-F Terminals -> Terminals… -> Terminal 0 - 15 Input menu elements Menu entry -> Clear input field Contents Clears the input field without sending entered data. Shortcut Button “Clear” Input -> Sending… -> Send on Input If selected, entered input will be sent directly to the target while typing. -> Send on Enter If selected, entered input will be sent when pressing Enter. -> Block if FIFO full If checked, RTT Viewer will retry to send all input to the target when the target buffer is full. Input -> End of line… -> Windows format (CR +LF) -> Unix format (LF) -> Mac format (CR) -> None Selects the end of line character to be sent on Enter. Input -> Echo input… -> Echo to “All Terminals” If checked, sent input will be displayed in the All Terminals Tab. -> Echo to “Terminal 0” If checked, sent input will be displayed in the Terminal Tab 0. Logging menu elements Menu entry -> Start Terminal logging… Contents Starts logging terminal data to a file. Shortcut F5 -> 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… Displays information about all available RTT channels. 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-2021 SEGGER Microcontroller GmbH 59 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 SEGGER_RTT_SetTerminal(). Output of only one string via a specific Terminal can be done with SEGGER_RTT_TerminalOut(). The sequences sent to change the Terminal are interpreted by RTT Viewer. Other applications 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 Terminal. 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-2021 SEGGER Microcontroller GmbH 60 CHAPTER 3 3.8 J-Link SWO Viewer 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-2021 SEGGER Microcontroller GmbH 61 CHAPTER 3 3.8.2 J-Link SWO Viewer 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 JLink 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 Selects a set of itm stimulus ports which should be used to listen to. -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. 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 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 62 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 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 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 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 Example -itmport 0 3.8.3.6 -outputfile Define a file to which the output of SWO Viewer is printed. Syntax -outputfile J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 63 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 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 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 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 #define ITM_TPR (*(volatile unsigned int*)0xE0000E00) // ITM Enable (*(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-2021 SEGGER Microcontroller GmbH 64 CHAPTER 3 J-Link SWO Viewer #define DWT_CTRL #define FFCR (*(volatile unsigned int*)0xE0001000) // DWT Control Register (*(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 Run the JLink-plugin configuration. The screenshot below shows a debug session in IDE. For download and more information about emIDE, please refer to http://emide.org . J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 83 CHAPTER 4 Debugging with J-Link GDB Server Console GDB can be used stand-alone as a console application. To connect GDB to GDB Server enter target remote localhost:2331 into the running GDB. Within GDB all GDB commands and the remote monitor commands are available. For more information about debugging with GDB refer to its online manual available at http:// sourceware.org/gdb/current/onlinedocs/gdb/ . A typical startup of a debugging session can be like: (gdb) file C:/temp/Blinky.elf Reading symbols from C:/temp/Blinky.elf...done. (gdb) target remote localhost:2331 Remote debugging using localhost:2331 0x00000000 in ?? () (gdb) monitor reset Resetting target (gdb) load Loading section .isr_vector, size 0x188 lma 0x8000000 Loading section .text, size 0x568 lma 0x8000188 Loading section .init_array, size 0x8 lma 0x80006f0 Loading section .fini_array, size 0x4 lma 0x80006f8 Loading section .data, size 0x428 lma 0x80006fc Start address 0x8000485, load size 2852 Transfer rate: 146 KB/sec, 570 bytes/write. (gdb) break main Breakpoint 1 at 0x800037a: file Src\main.c, line 38. (gdb) continue Continuing. Breakpoint 1, main () at Src\main.c:38 38 Cnt = 0; (gdb) J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 84 CHAPTER 4 Debugging with J-Link GDB Server Eclipse (CDT) Eclipse is an open source platform-independent software framework, which has typically been used to develop integrated development environment (IDE). Therefore Eclipse can be used as C/C++ IDE, if you extend it with the CDT plug-in ( http://www.eclipse.org/cdt/ ). CDT means “C/C++ Development Tooling” project and is designed to use the GDB as default debugger and works without any problems with the GDB Server. Refer to http://www.eclipse.org for detailed information about Eclipse. Note We only support problems directly related to the GDB Server. Problems and questions related to your remaining toolchain have to be solved on your own. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 85 CHAPTER 4 4.3 Supported remote (monitor) commands Supported remote (monitor) commands J-Link GDB Server comes with some functionalities which are not part of the standard GDB. These functions can be called either via a gdbinit file passed to GDB Server or via monitor commands passed directly to GDB, forwarding them to GDB Server. To indicate to GDB to forward the command to GDB Server ’monitor’ has to be prepended to the call. For example a reset can be triggered in the gdbinit file with “reset” or via GDB with “monitor reset”. The following remote commands are available: Remote command Explanation clrbp Removes an instruction breakpoint. cp15 Reads or writes from/to cp15 register. device Select the specified target device. DisableChecks Do not check if an abort occurred after memory read (ARM7/9 only). EnableChecks Check if an abort occurred after memory read (ARM7/9 only). flash breakpoints Enables/Disables flash breakpoints. flash erase Erases the flash memory of the target device. getargs Get the arguments for the application. go Starts the target CPU. halt Halts the target CPU. jtagconf Configures a JTAG scan chain with multiple devices on it. memU8 Reads or writes a byte from/to given address. memU16 Reads or writes a halfword from/to given address. memU32 Reads or writes a word from/to given address. reg Reads or writes from/to given register. regs Reads and displays all CPU registers. reset Resets and halts the target CPU. semihosting breakOnError Enable or disable halting the target on semihosting error. semihosting enable Enables semihosting. semihosting IOClient Set semihosting I/O to be handled via Telnet port or GDB. semihosting ARMSWI Sets the SWI number used for semihosting in ARM mode. semihosting ThumbSWI Sets the SWI number used for semihosting in thumb mode. setargs Set the arguments for the application. setbp Sets an instruction breakpoint at a given address. sleep Sleeps for a given time period. speed Sets the JTAG speed of J-Link / J-Trace. step Performs one or more single instruction steps. SWO DisableTarget Undo target configuration for SWO and disable it in J-Link. SWO EnableTarget Configure target for SWO and enable it in J-Link. SWO GetMaxSpeed Prints the maximum supported SWO speed for J-Link and Target CPU. SWO GetSpeedInfo Prints the available SWO speed and its minimum divider. waithalt Waits for target to halt code execution. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 86 CHAPTER 4 Remote command Supported remote (monitor) commands Explanation wice Writes to given IceBreaker register. ReadAP Reads the specified CoreSight DAP-AP register. ReadDP Reads the specified CoreSight DAP-DP register. WriteAP Writes the specified CoreSight DAP-AP register. WriteDP Writes the specified CoreSight DAP-DP register. The Following remote commands are deprecated and only available for backward compatibility: Remote command Explanation device Selects the specified target device. Note: Use command line option -device instead. interface Selects the target interface. Note: Use command line option -if instead. speed Sets the JTAG speed of J-Link / J-Trace. Note: For the initial connection speed, use command line option -speed instead. Note The remote commands are case-insensitive. Note Optional parameters are set into square brackets. Note The examples are described as follows: Lines starting with ’#’ are comments and not used in GDB / GDB Server. Lines starting with ’>’ are input commands from the GDB. Lines starting with ’ monitor clrbp 1 > monitor ci 1 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 87 CHAPTER 4 4.3.2 Supported remote (monitor) commands cp15 Reads or writes from/to cp15 register. If is specified, this command writes the data to the cp15 register. Otherwise this command reads from the cp15 register. For further information please refer to the ARM reference manual. Syntax cp15 , , , [= ] The parameters of the function are equivalent to the MCR instructions described in the ARM documents. Example #Read: > monitor cp15 1, 2, 6, 7 < Reading CP15 register (1,2,6,7 = 0x0460B77D) #Write: > monitor cp15 1, 2, 6, 7 = 0xFFFFFFFF 4.3.3 device Note Deprecated. Use command line option -device instead. Selects the specified target device. This is necessary for the connection and some special handling of the device. Note The device should be selected via commandline option -device when starting GDB Server. Syntax device Example > monitor device STM32F417IG < Selecting device: STM32F417IG 4.3.4 DisableChecks Disables checking if a memory read caused an abort (ARM7/9 devices only). On some CPUs during the init sequence for enabling access to the internal memory (for example on the TMS470) some dummy reads of memory are required which will cause an abort as long as the access-init is not completed. Syntax DisableChecks J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 88 CHAPTER 4 4.3.5 Supported remote (monitor) commands EnableChecks Enables checking if a memory read caused an abort (ARM7/9 devices only). On some CPUs during the init sequence for enabling access to the internal memory (for example on the TMS470) some dummy reads of memory are required which will cause an abort as long as the access-init is not completed. The default state is: Checks enabled. Syntax EnableChecks 4.3.6 flash breakpoints This command enables/disables the Flash Breakpoints feature. By default Flash Breakpoints are enabled and can be used for evaluation. Syntax monitor flash breakpoints = Example #Disable Flash Breakpoints: > monitor flash breakpoints = 0 < Flash breakpoints disabled #Enable Flash Breakpoins: > monitor flash breakpoints = 1 < Flash breakpoints enabled 4.3.7 flash erase This command erases the flash memory of the target device. Syntax flash erase 4.3.8 getargs Get the currently set argument list which will be given to the application when calling semihosting command SYS_GET_CMDLINE (0x15). The argument list is given as one string. Syntax getargs Example #No arguments set via setargs: > monitor getargs < No arguments. #Arguments set via setargs: > monitor getargs < Arguments: test 0 1 2 arg0=4 4.3.9 go Starts the target CPU. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 89 CHAPTER 4 Supported remote (monitor) commands Syntax go Example > monitor go 4.3.10 halt Halts the target CPU. Syntax halt Example > monitor halt 4.3.11 interface Note Deprecated. Use command line option -if instead. Selects the target interface used by J-Link / J-Trace. Syntax interface 4.3.12 jtagconf Configures a JTAG scan chain with multiple devices on it. is the sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device. is the number of devices closer to TDI. For more detailed information of how to configure a scan chain with multiple devices please refer to Determining values for scan chain configuration . Note To make sure the connection to the device can be established correctly, it is recommended to configure the JTAG scan chain via command line options at the start of GDB Server. Syntax jtagconf Example #Select the second device, where there is 1 device in front with IRLen 4 > monitor jtagconf 4 1 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 90 CHAPTER 4 4.3.13 Supported remote (monitor) commands memU8 Reads or writes a byte from/to a given address. If is specified, this command writes the value to the given address. Otherwise this command reads from the given address. Syntax memU8 [= ] Example #Read: > monitor memU8 0x50000000 < Reading from address 0x50000000 (Data = 0x04) #Write: > monitor memU8 0x50000000 = 0xFF < Writing 0xFF @ address 0x50000000 4.3.14 memU16 Reads or writes a halfword from/to a given address. If is specified, this command writes the value to the given address. Otherwise this command reads from the given address. Syntax memU16 [= ] Example #Read: > monitor memU16 0x50000000 < Reading from address 0x50000000 (Data = 0x3004) #Write: > monitor memU16 0x50000000 = 0xFF00 < Writing 0xFF00 @ address 0x50000000 4.3.15 memU32 Reads or writes a word from/to a given address. If is specified, this command writes the value to the given address. Otherwise this command reads from the given address. This command is similar to the long command. Syntax memU32 [= ] Example #Read: > monitor memU32 0x50000000 < Reading from address 0x50000000 (Data = 0x10023004) #Write: > monitor memU32 0x50000000 = 0x10023004 < Writing 0x10023004 @ address 0x50000000 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 91 CHAPTER 4 4.3.16 Supported remote (monitor) commands reg Reads or writes from/to given register. If is specified, this command writes the value into the given register. If is specified, this command writes the memory content at address to register . Otherwise this command reads the given register. Syntax reg [= ] or reg [= ()] Example #Write value to register: > monitor reg pc = 0x00100230 < Writing register (PC = 0x00100230) #Write value from address to register: > monitor reg r0 = (0x00000040) < Writing register (R0 = 0x14813004) #Read register value: > monitor reg PC < Reading register (PC = 0x00100230) 4.3.17 regs Reads all CPU registers. Syntax regs Example > monitor regs < PC = 00100230, CPSR = 20000013 (SVC mode, ARM) R0 = 14813004, R1 = 00000001, R2 = 00000001, R3 = 000003B5 R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000 USR: R8 =00000000, R9 =00000000, R10=00000000, R11 =00000000, R12 =00000000 R13=00000000, R14=00000000 FIQ: R8 =00000000, R9 =00000000, R10=00000000, R11 =00000000, R12 =00000000 R13=00200000, R14=00000000, SPSR=00000010 SVC: R13=002004E8, R14=0010025C, SPSR=00000010 ABT: R13=00200100, R14=00000000, SPSR=00000010 IRQ: R13=00200100, R14=00000000, SPSR=00000010 UND: R13=00200100, R14=00000000, SPSR=00000010 4.3.18 reset Resets and halts the target CPU. Make sure the device is selected prior to using this command to make use of the correct reset strategy. Note There are different reset strategies for different CPUs. Moreover, the reset strategies which are available differ from CPU core to CPU core. J-Link can perform various reset strategies and always selects the best fitting strategy for the selected device. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 92 CHAPTER 4 Supported remote (monitor) commands Syntax reset Example > monitor reset < Resetting target 4.3.19 semihosting breakOnError Enables or disables halting the target at the semihosting breakpoint / in SVC handler if an error occurred during a semihosting command, for example a bad file handle for SYS_WRITE. The GDB Server log window always shows a warning in these cases. breakOnError is disabled by default. Syntax semihosting breakOnerror Example #Enable breakOnError: > monitor semihosting breakOnError 1 4.3.20 semihosting enable Enables semihosting with the specified vector address. If no vector address is specified, the SWI vector (at address 0x8) will be used. GDBServer will output semihosting terminal data from the target via a separate connection on port 2333. Some IDEs already establish a connection automatically on this port and show terminal data in a specific window in the IDE. For IDEs which do not support semihosting terminal output directly, the easiest way to view semihosting output is to open a telnet connection to the GDBServer on port 2333. The connection on this port can be opened all the time as soon as GDBServer is started, even before this remote command is executed. Syntax semihosting enable [] Example > monitor semihosting enable < Semihosting enabled (VectorAddr = 0x08) 4.3.21 semihosting IOClient GDB itself can handle (file) I/O operations, too. With this command it is selected whether to print output via TELNET port (2333), GDB, or both. is • • • 1 for TELNET Client (Standard port 2333) (Default) 2 for GDB Client or 3 for both (Input via GDB Client) Syntax semihosting IOClient J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 93 CHAPTER 4 Supported remote (monitor) commands Example #Select TELNET port as output source > monitor semihosting ioclient 1 < Semihosting I/O set to TELNET Client #Select GDB as output source > monitor semihosting ioclient 2 < Semihosting I/O set to GDB Client #Select TELNET port and GDB as output source > monitor semihosting ioclient 3 < Semihosting I/O set to TELNET and GDB Client 4.3.22 semihosting ARMSWI Sets the SWI number used for semihosting in ARM mode. The default value for the ARMSWI is 0x123456. Syntax semihosting ARMSWI Example > monitor semihosting ARMSWI 0x123456 < Semihosting ARM SWI number set to 0x123456 4.3.23 semihosting ThumbSWI Sets the SWI number used for semihosting in thumb mode. The default value for the ThumbSWI is 0xAB Syntax semihosting ThumbSWI Example > monitor semihosting ThumbSWI 0xAB < Semihosting Thumb SWI number set to 0xAB 4.3.24 setargs Set arguments for the application, where all arguments are in one separated by whitespaces. The argument string can be gotten by the application via semihosting command SYS_GET_CMDLINE (0x15). Semihosting has to be enabled for getting the argumentstring (see semihosting enable ). “monitor setargs” can be used before enabling semihosting. The maximum length for is 512 characters. Syntax setargs Example > monitor setargs test 0 1 2 arg0=4 < Arguments: test 0 1 2 arg0=4 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 94 CHAPTER 4 4.3.25 Supported remote (monitor) commands setbp Sets an instruction breakpoint at the given address, where can be 0x03 for ARM instruction breakpoints (Instruction width 4 Byte, mask out lower 2 bits) or 0x01 for THUMB instruction breakpoints (Instruction width 2 Byte, mask out lower bit). If no mask is given, an ARM instruction breakpoint will be set. Syntax setbp [] Example #Set a breakpoint (implicit for ARM instructions) > monitor setbp 0x00000000 #Set a breakpoint on a THUMB instruction > monitor setbp 0x00000100 0x01 4.3.26 sleep Sleeps for a given time, where is the time period in milliseconds to delay. While sleeping any communication is blocked until the command returns after the given period. Syntax sleep Example > monitor sleep 1000 < Sleep 1000ms 4.3.27 speed Note Deprecated. For setting the initial connection speed, use command line option -speed instead. Sets the JTAG speed of J-Link / J-Trace. Speed can be either fixed (in kHz), automatic recognition or adaptive. In general, Adaptive is recommended if the target has an RTCK signal which is connected to the corresponding RTCK pin of the device (S-cores only). For detailed information about the different modes, refer to JTAG Speed . The speed has to be set after selecting the interface, to change it from its default value. Syntax speed |auto|adaptive Example > monitor speed auto < Select auto target interface speed (8000 kHz) > monitor speed 4000 < Target interface speed set to 4000 kHz > monitor speed adaptive < Select adaptive clocking instead of fixed JTAG speed J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 95 CHAPTER 4 4.3.28 Supported remote (monitor) commands step Performs one or more single instruction steps, where is the number of instruction steps to perform. If is not specified only one instruction step will be performed. Syntax step [] or si [] Example > monitor step 3 4.3.29 SWO DisableTarget Disables the output of SWO data on the target (Undoes changes from SWO EnableTarget) and stops J-Link to capture it. Syntax SWO DisableTarget Example #Disable capturing SWO from stimulus ports 0 and 1 > monitor SWO DisableTarget 3 < SWO disabled successfully. 4.3.30 SWO EnableTarget Configures the target to be able to output SWO data and starts J-Link to capture it. CPU and SWO frequency can be 0 for auto-detection. If CPUFreq is 0, J-Link will measure the current CPU speed. If SWOFreq is 0, J-Link will use the highest available SWO speed for the selected / measured CPU speed. Note CPUFreq has to be the speed at which the target will be running when doing SWO. If the speed is different from the current speed when issuing CPU speed auto-detection, getting SWO data might fail. SWOFreq has to be a quotient of the CPU and SWO speeds and their prescalers. To get available speed, use SWO GetSpeedInfo. PortMask can be a decimal or hexadecimal Value. Values starting with the Prefix “0x” are handled hexadecimal. Syntax SWO EnableTarget monitor SWO EnableTarget 0 0 1 0 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 96 CHAPTER 4 Supported remote (monitor) commands < SWO enabled successfully. #Configure SWO for stimulus ports 0-2, fixed SWO frequency and measure CPU frequency > monitor SWO EnableTarget 0 1200000 5 0 < SWO enabled successfully. #Configure SWO for stimulus ports 0-255, fixed CPU and SWO frequency > monitor SWO EnableTarget 72000000 6000000 0xFF 0 < SWO enabled successfully. 4.3.31 SWO GetMaxSpeed Prints the maximum SWO speed supported by and matching both, J-Link and the target CPU frequency. Syntax SWO GetMaxSpeed Example #Get SWO speed for 72MHz CPU speed > monitor SWO GetMaxSpeed 72000000 < Maximum supported SWO speed is 6000000 Hz. 4.3.32 SWO GetSpeedInfo Prints the base frequency and the minimum divider of the connected J-Link. With this information, the available SWO speeds for J-Link can be calculated and the matching one for the target CPU frequency can be selected. Syntax SWO GetSpeedInfo Example > monitor SWO GetSpeedInfo < Base frequency: 60000000Hz, MinDiv: 8 # Available SWO speeds for J-Link are: 7.5MHz, 6.66MHz, 6MHz, ... 4.3.33 waithalt Waits for target to halt code execution, where is the maximum time period in milliseconds to wait. Syntax waithalt or wh Example #Wait for halt with a timeout of 2 seconds > monitor waithalt 2000 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 97 CHAPTER 4 4.3.34 Supported remote (monitor) commands wice Writes to given IceBreaker register, where is the data to write. Syntax wice or rmib Example > monitor wice 0x0C 0x100 4.3.35 ReadAP Reads the specified CoreSight DAP-AP register. Note - ARM specifies register addresses for JTAG (0x0, 0x4, 0x8, …) and register indexes for SWD (0, 1, 2, …). This API always works with register indexes, so: - Addr 0x0 = RegIndex 0 - Addr 0x4 = RegIndex 1 - Addr 0x8 = RegIndex 2 - Addr 0xC = RegIndex 3 - In case a WAIT response is received from the DAP, J-Link will retry the access until OK/FAULT is received or the operation times out (100ms). - Performs a fully qualified read. This means that for AP accesses which are “registered”, J-Link performs an implicit read of AP-RDBUFF after the AP access, to get the actual value. Syntax ReadAP [] Example > > < > > < # Select AP[0] (AHB-AP) AP bank 0 monitor WriteDP 2 0x00000000 O.K. # Read AHB-AP TAR monitor ReadAP 1 O.K.:0x08000000 4.3.36 ReadDP Reads the specified CoreSight DAP-DP register. Note - ARM specifies register addresses for JTAG (0x0, 0x4, 0x8, …) and register indexes for SWD (0, 1, 2, …). This API always works with register indexes, so: - Addr 0x0 = RegIndex 0 - Addr 0x4 = RegIndex 1 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 98 CHAPTER 4 Supported remote (monitor) commands - Addr 0x8 = RegIndex 2 - Addr 0xC = RegIndex 3 - In case a WAIT response is received from the DAP, J-Link will retry the access until OK/FAULT is received or the operation times out (100ms). - Performs a fully qualified read. This means that for AP accesses which are “registered”, J-Link performs an implicit read of DP-RDBUFF after the DP access, to get the actual value. Syntax ReadDP [] Example > # Read CTRL/STAT > monitor ReadDP 1 < O.K.:0xF0000000 4.3.37 WriteAP Writes the specified CoreSight DAP-AP register. Note - ARM specifies register addresses for JTAG (0x0, 0x4, 0x8, …) and register indexes for SWD (0, 1, 2, …). This API always works with register indexes, so: - Addr 0x0 = RegIndex 0 - Addr 0x4 = RegIndex 1 - Addr 0x8 = RegIndex 2 - Addr 0xC = RegIndex 3 - In case a WAIT response is received from the DAP, J-Link will retry the access until OK/FAULT is received or the operation times out (100ms). Syntax WriteAP [, ] Example > > < > > < # Select AP[0] (AHB-AP) AP bank 0 monitor WriteDP 2 0x00000000 O.K. # Write AHB-AP TAR monitor WriteAP 1 0x08000000 O.K. 4.3.38 WriteDP Writes the specified CoreSight DAP-DP register. Note - ARM specifies register addresses for JTAG (0x0, 0x4, 0x8, …) and register indexes for SWD (0, 1, 2, …). This API always works with register indexes, so: - Addr 0x0 = RegIndex 0 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 99 CHAPTER 4 Supported remote (monitor) commands - Addr 0x4 = RegIndex 1 - Addr 0x8 = RegIndex 2 - Addr 0xC = RegIndex 3 - In case a WAIT response is received from the DAP, J-Link will retry the access until OK/FAULT is received or the operation times out (100ms). Syntax WriteDP [, ] Example > # Write SELECT register: Select AP[0] (AHB-AP) AP bank 15 > monitor WriteDP 2 0x000000F0 < O.K. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 100 4.4 CHAPTER 4 SEGGER-specific GDB protocol extensions SEGGER-specific GDB protocol extensions J-Link GDB Server implements some functionality which are not part of the standard GDB remote protocol in general query packets. These SEGGER-specific general query packets can be sent to GDB Server on the low-level of GDB, via maintenance commands, or with a custom client connected to GDB Server. As these extensions are not of interest for the regular user, they have been added to a separate manual that describes the SEGGER-specific GDB protocol extensions that have been added to J-Link GDB Server. The manual is available for download on the SEGGER website: UM08036 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 101 CHAPTER 4 4.5 Command line options Command line options There are several command line options available for the GDB Server which allow configuration of the GDB Server before any connection to a J-Link is attempted or any connection from a GDB client is accepted. Note Using GDB Server CL, device, interface, endian and speed are mandatory options to correctly connect to the target, and should be given before connection via GDB. Using GDB Server GUI the mandatory options can also be selected in the configuration dialog. Command line option Explanation -device Selects the connected target device. -endian Selects the device endianness. -if Selects the interface to connect to the target. -speed Selects the target communication speed. Note Using multiple instances of GDB Server, setting custom values for port, SWOPort and TelnetPort is necessary. Command line option Explanation -port Select the port to listen for GDB clients. -swoport Select the port to listen for clients for SWO RAW output. -telnetport Select the port to listen for clients for printf output. The GDB Server GUI version uses persistent settings which are saved across different instances and sessions of GDB Server. These settings can be toggled via the checkboxes in the GUI. Note GDB Server CL always starts with the settings marked as default. For GUI and CL, the settings can be changed with following command line options. For all persistent settings there is a pair of options to enable or disable the feature. Command line option Explanation -ir Initialize the CPU registers on start of GDB Server. (Default) -noir Do not initialize CPU registers on start of GDB Server. -localhostonly Allow only localhost connections (Windows default) -nolocalhostonly Allow connections from outside localhost (Linux default) -logtofile Generate a GDB Server log file. -nologtofile Do not generate a GDB Server log file. (Default) -halt Halt the target on start of GDB Server. (Default) -nohalt Do not halt the target on start of GDB Server. -silent Do not show log output. -nosilent Show log output. (Default) J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 102 CHAPTER 4 Command line option Command line options Explanation -stayontop Set the GDB Server GUI to be the topmost window. -nostayontop Do not be the topmost window. (Default) -timeout Set the time after which the target has to be connected. -notimeout Set infinite timeout for target connection. -vd Verify after downloading. -novd Do not verify after downloading. (Default) Following additional command line options are available. These options are temporary for each start of GDB Server. Command line option Explanation -excdbg Enable exception debugging. -jtagconf Configures a JTAG scan chain with multiple devices on it. -log Logs the GDB Server communication to a specific file. -rtos Selects a RTOS plugin (DLL file) -singlerun Starts GDB Server in single run mode. -s Same as -singlerun -nosinglerun Starts GDB Server in no single run mode. (Default) -nos Same as -nosinglerun -noreset Starts GDB Server in no reset mode. -JLinkDevicesXMLPath Specifies a search path where to look for a file that might specify additional devices -powertarget Power target after specified delay (1-9). 0 turns off power. -gui Do not suppress DLL dialogs. (Default) -nogui Suppress DLL Dialogs. -jlinkscriptfile Specifies a J-Link script file. -select Selects the interface to connect to J-Link (USB/IP). -settingsfile Selects the J-Link Settings File. -strict Starts GDB Server in strict mode. -x Executes a gdb file on first connection. -xc Executes a gdb file on every connection. -cpu Selects the CPU core. Deprecated, use -device instead. 4.5.1 -cpu Pre-select the CPU core of the connected device, so the GDB Server already knows the register set, even before having established a connection to the CPU. Note Deprecated, please use -device instead. Anyhow, it does not hurt if this option is set, too. Syntax -CPU Example jlinkgdbserver -CPU ARM7_9 J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 103 CHAPTER 4 Command line options Add. information The following table lists all valid values for : Supported CPU cores CPU_FAMILY_ARM7_9 Pre-select ARM7 and ARM9 as CPU cores. CPU_FAMILY_CORTEX_A_R Pre-select Cortex-A and Cortex-R as CPU cores. CPU_FAMILY_CORTEX_M Pre-select Cortex-M as CPU core. CPU_FAMILY_RX600 Pre-select Renesas RX600 as CPU core. 4.5.2 -device Tells GDBServer to which device J-Link is connected before the connect sequence is actually performed. It is recommended to use the command line option to select the device instead of using the remote command since for some devices J-Link already needs to know the device at the time of connecting to it since some devices need special connect sequences (e.g. devices with TI ICEPick modules). In such cases, it is not possible to select the device via remote commands since they are configured after the GDB client already connected to GDBServer and requested the target registers which already requires a connection to the target. Note Using GDB Server CL this option is mandatory to correctly connect to the target, and should be given before connection via GDB. Syntax -device Example jlinkgdbserver -device AT91SAM7SE256 Add. information For a list of all valid values for , please refer to List of supported target devices . 4.5.3 -endian Sets the endianness of the target where endianness can either be “little” or “big”. Syntax -endian Example jlinkgdbserver -endian little Note When using GDB Server CL this option is mandatory to correctly connect to the target, and should be given before connection via GDB. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 104 CHAPTER 4 4.5.4 Command line options -gui Do not suppress DLL dialogs. Syntax -gui Example jlinkgdbserver -gui 4.5.5 -if Selects the target interface which is used by J-Link to connect to the device. The default value is JTAG. Syntax -if Example jlinkgdbserver -if SWD Add. information Currently, the following values are accepted for : • • • • JTAG SWD FINE 2-wire-JTAG-PIC32 4.5.6 -ir Initializes the CPU register with default values on startup. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via -noir or the GUI. Example jlinkgdbserver -ir 4.5.7 -excdbg Enables exception debugging. Exceptions on ARM CPUs are handled by exception handlers. Exception debugging makes the debugging of exceptions more user-friendly by passing a signal to the GDB client and returning to the causative instruction. In order to do this, a special exception handler is required as follows: __attribute((naked)) void OnHardFault(void){ __asm volatile ( " bkpt 10 \n" " bx lr \n" ); } The signal passed to the GDB client is the immediate value (10 in the example) of the software breakpoint instruction. specifies, how many instructions need to be J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 105 CHAPTER 4 Command line options executed until the exception return occurs. In most cases this will be 2 (which is the default value), if the handler function is set as the exception handler. If it is called indirectly as a subroutine from the exception handler, there may be more steps required. It is mandatory to have the function declared with the “naked” attribute and to have the bx lr instruction immediately after the software breakpoint instruction. Otherwise the software breakpoint will be treated as a usual breakpoint. Syntax -excdbg Example jlinkgdbserver -excdbg 4 4.5.8 -jtagconf Configures a JTAG scan chain with multiple devices on it. is the sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device. is the number of devices closer to TDI. For more detailed information of how to configure a scan chain with multiple devices please refer to Determining values for scan chain configuration . Syntax -jtagconf , Example #Select the second device, where there is 1 device in front with IRLen 4 jlinkgdbserver -jtagconf 4,1 4.5.9 -localhostonly Starts the GDB Server with the option to listen on localhost only (This means that only TCP/ IP connections from localhost are accepted) or on any IP address. To allow remote debugging (connecting to GDBServer from another PC), deactivate this option. If no parameter is given, it will be set to 1 (active). Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via command line option or the GUI. Syntax -LocalhostOnly Example jlinkgdbserver -LocalhostOnly 0 //Listen on any IP address (Linux/MAC default) jlinkgdbserver -LocalhostOnly 1 //Listen on localhost only (Windows default) 4.5.10 -log Starts the GDB Server with the option to write the output into a given log file. The file will be created if it does not exist. If it exists the previous content will be removed. Paths including spaces need to be set between quotes. Syntax -log J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 106 CHAPTER 4 Command line options Example jlinkgdbserver -log “C:\my path\to\file.log” 4.5.11 -logtofile Starts the GDB Server with the option to write the output into a log file. If no file is given via -log , the log file will be created in the GDB Server application directory. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via -nologtofile or the GUI. Syntax logtofile Example jlinkgdbserver -logtofile jlinkgdbserver -logtofile -log “C:\my path\to\file.log” 4.5.12 -halt Halts the target after connecting to it on start of GDB Server. For most IDEs this option is mandatory since they rely on the target to be halted after connecting to GDB Server. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via -nohalt or the GUI. Syntax -halt Example jlinkgdbserver -halt 4.5.13 -nogui Suppresses DLL dialogs. Syntax -nogui Example jlinkgdbserver -nogui 4.5.14 -noir Do not initialize the CPU registers on startup. Note J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 107 CHAPTER 4 Command line options For the GUI version, this setting is persistent for following uses of GDB Server until changed via -ir or the GUI. Syntax noir 4.5.15 -nolocalhostonly Starts GDB Server with the option to allow remote connections (from outside localhost). Same as -localhostonly 0 Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via command line option or the GUI. Syntax -nolocalhostonly 4.5.16 -nologtofile Starts the GDB Server with the option to not write the output into a log file. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via -nologtofile or the GUI. When this option is used after -log, no log file will be generated, when -log is used after this option, a log file will be generated and this setting will be overridden. Syntax -nologtofile Example jlinkgdbserver -nologtofile // Will not generate a log file jlinkgdbserver -nologtofile -log “C:\pathto\file.log” // Will generate a log file jlinkgdbserver -log “C:\pathto\file.log” -nologtofile // Will not generate a log file 4.5.17 -nohalt When connecting to the target after starting GDB Server, the target is not explicitly halted and the CPU registers will not be inited. After closing all GDB connections the target is started again and continues running. Some IDEs rely on the target to be halted after connect. In this case do not use -nohalt, but -halt. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via -halt or the GUI. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 108 CHAPTER 4 Command line options Syntax -nohalt Example jlinkgdbserver -nohalt 4.5.18 -noreset Perform no reset on connect, just halt the CPU Syntax -noreset Example jlinkgdbserver -norest 4.5.19 -nosinglerun Single run mode turned off. (Default) Syntax -nosinglerun Example jlinkgdbserver -nosinglerun 4.5.20 -nosilent Starts the GDB Server in non-silent mode. All log window messages will be shown. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via command line option or the GUI. Syntax -nosilent Example jlinkgdbserver -nosilent 4.5.21 -nostayontop Starts the GDB Server in non-topmost mode. All windows can be placed above it. Note For the CL version this setting has no effect. For the GUI version, this setting is persistent for following uses of GDB Server until changed via command line option or the GUI. Syntax -nostayontop J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 109 CHAPTER 4 Command line options Example jlinkgdbserver -nostayontop 4.5.22 -notimeout GDB Server automatically closes after a timeout of 5 seconds when no target voltage can be measured or connection to target fails. This command line option prevents GDB Server from closing, to allow connecting a target after starting GDB Server. Note The recommended order is to power the target, connect it to J-Link and then start GDB Server. Syntax -notimeout 4.5.23 -novd Do not explicitly verify downloaded data. Note For the GUI version, this setting is persistent for following uses of GDB Server until changed via command line option or the GUI. Syntax -novd 4.5.24 -port Starts GDB Server listening on a specified port. This option overrides the default listening port of the GDB Server. The default port is 2331. Note Using multiple instances of GDB Server, setting custom values for this option is necessary. Syntax -port Example jlinkgdbserver -port 2345 4.5.25 -rtos Specifies a RTOS plug-in (.DLL file for Windows, .SO file for Linux and Mac). If the file-name extension is not specified, it is automatically added depending on the PC’s operating system. The J-Link Software and Documentation Package comes with RTOS plug-ins for embOS and FreeRTOS pre-installed in the sub-directory “GDBServer”. A software development kit (SDK) for creating your own plug-ins is also available upon request on our website (https:// www.segger.com/downloads/jlink/#gdbserver_rtos). J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 110 CHAPTER 4 Command line options Syntax -rtos [.dll|.so] Example jlinkgdbserver -rtos GDBServer\RTOSPlugin_embOS 4.5.26 -JLinkDevicesXMLPath Specifies a search path where to look for a file. The given path may be absolute or relative to the location of the JLinkARM.dll. This is mainly used for preliminary / special devices where a vendor ships a file to specific customers and this file defines new devices that are not publicly available yet. Syntax -JLinkDevicesXMLPath Example jlinkgdbserver -JLinkDevicesXMLPath C:\Work\MyDevices\ 4.5.27 -jlinkscriptfile Passes the path of a J-Link script file to the GDB Server. This scriptfile is executed before the GDB Server starts the debugging / identifying communication with the target. 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 -jlinkscriptfile Example -jlinkscriptfile “C:\My Projects\Default.JLinkScript” 4.5.28 -powertarget Power target after specified delay (1-9 ms). 0 turns off power. Syntax -powertarget Value can can range from 0-9. Example jlinkgdbserver -powertarget 1 4.5.29 -select Specifies the host interface to be used to connect to J-Link. Currently, USB and TCP/IP are available. Syntax -select Settings > Control Panel > Add/ Remove Programs ) select Windows Driver Package - Segger (jlink) USB and click the Change/Remove button. 3. Confirm the uninstallation process. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 127 CHAPTER 6 6.3 Setting up the IP interface Setting up the IP interface Some emulators of the J-Link family have (or future members will have) an additional Ethernet interface, to communicate with the host system. These emulators will also come with a built-in web server which allows configuration of the emulator via web interface. In addition to that, you can set a default gateway for the emulator which allows using it even in large intranets. For simplicity the setup process of J-Link Pro (referred to as J-Link) is described in this section. 6.3.1 Configuring J-Link using J-Link Configurator The J-Link Software and Documentation Package comes with a free GUI-based utility called J-Link Configurator which auto-detects all J-Links that are connected to the host PC via USB & Ethernet. The J-Link Configurator allows the user to setup the IP interface of JLink. For more information about how to use the J-Link Configurator, please refer to JLink Configurator . 6.3.2 Configuring J-Link using the webinterface All emulators of the J-Link family which come with an Ethernet interface also come with a built-in web server, which provides a web interface for configuration. This enables the user to configure J-Link without additional tools, just with a simple web browser. The Home page of the web interface shows the serial number, the current IP address and the MAC address of the J-Link. The Network configuration page allows configuration of network related settings (IP address, subnet mask, default gateway) of J-Link. The user can choose between automatic IP assignment (settings are provided by a DHCP server in the network) and manual IP assignment by selecting the appropriate radio button. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 128 J-Link / J-Trace (UM08001) CHAPTER 6 Setting up the IP interface © 2004-2021 SEGGER Microcontroller GmbH 129 6.4 CHAPTER 6 FAQs FAQs Q: How can I use J-Link with GDB and Ethernet? A: You have to use the J-Link GDB Server in order to connect to J-Link via GDB and Ethernet. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 130 CHAPTER 6 6.5 J-Link Configurator J-Link Configurator Normally, no configuration is required, especially when using J-Link via USB. For special cases like having multiple older J-Links connected to the same host PC in parallel, they need to be re-configured to be identified by their real serial number when enumerating on the host PC. This is the default identification method for current J-Links (J-Link with hardware version 8 or later). For re-configuration of old J-Links or for configuration of the IP settings (use DHCP, IP address, subnet mask, …) of a J-Link supporting the Ethernet interface, SEGGER provides a GUI-based tool, called J-Link Configurator. The J-Link Configurator is part of the J-Link Software and Documentation Package and can be used free of charge. 6.5.1 Configure J-Links using the J-Link Configurator A J-Link can be easily configured by selecting the appropriate J-Link from the emulator list and using right click -> Configure. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 131 CHAPTER 6 J-Link Configurator In order to configure an old J-Link, which uses the old USB 0 - 3 USB identification method, to use the new USB identification method (reporting the real serial number) simply select “Real SN” as USB identification method and click the OK button. The same dialog also allows configuration of the IP settings of the connected J-Link if it supports the Ethernet interface. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 132 CHAPTER 6 6.6 J-Link USB identification J-Link USB identification In general, when using USB, there are two ways in which a J-Link can be identified: • • By serial number By USB address Default configuration of J-Link is: Identification by serial number. Identification via USB address is used for compatibility and not recommended. Background information “USB address” really means changing the USB-Product ID (PID). The following table shows how J-Links enumerate in the different identification modes. Identification PID Serial number Serial number (default) 0x0101 Serial number is real serial number of the J-Link or user assigned. USB address 0 (Deprecated) 0x0101 123456 USB address 1 (Deprecated) 0x0102 123456 USB address 2 (Deprecated) 0x0103 123456 USB address 3 (Deprecated) 0x0104 123456 6.6.1 Connecting to different J-Links connected to the same host PC via USB In general, when having multiple J-Links connected to the same PC, the J-Link to connect to is explicitly selected by its serial number. Most software/debuggers provide an extra field to type-in the serial number of the J-Link to connect to. A debugger / software which does not provide such a functionality, the J-Link DLL automatically detects that multiple J-Links are connected to the PC and shows a selection dialog which allows the user to select the appropriate J-Link to connect to. So even in IDEs which do not have an selection option for the J-Link, it is possible to connect to different J-Links. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 133 CHAPTER 6 6.7 Using the J-Link DLL Using the J-Link DLL 6.7.1 What is the JLink DLL? The J-LinkARM.dll is a standard Windows DLL typically used from C or C++, but also Visual Basic or Delphi projects. It makes the entire functionality of the J-Link / J-Trace available through the exported functions. The functionality includes things such as halting/stepping the ARM 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. 6.7.2 Updating the DLL in third-party programs The JLink DLL can be used by any debugger that is designed to work with it. Some debuggers are usually shipped with the J-Link DLL already installed. Anyhow it may make sense to replace the included DLL with the latest one available, to take advantage of improvements in the newer version. 6.7.2.1 Updating the J-Link DLL in the IAR Embedded Workbench for ARM (EWARM) 6.7.3 Determining the version of JLink DLL To determine which version of the JLinkARM.dll you are using, the DLL version can be viewed by right clicking the DLL in explorer and choosing Properties from the context menu. Click the Version tab to display information about the product version. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 134 CHAPTER 6 6.7.4 Using the J-Link DLL Determining which DLL is used by a program To verify that the program you are working with is using the DLL you expect it to use, you can investigate which DLLs are loaded by your program with tools like Sysinternals’ Process Explorer. It shows you details about the DLLs used by your program, such as manufacturer and version. Process Explorer is - at the time of writing - a free utility which can be downloaded from www.sysinternals.com . J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH Chapter 7 Working with J-Link and JTrace This chapter describes functionality and how to use J-Link and J-Trace. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 136 7.1 CHAPTER 7 J-Link WiFi setup J-Link WiFi setup For J-Link WiFi setup / specifics, please refer to the SEGGER wiki: https://wiki.segger.com/UM08001#J-Link_WiFi_setup J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 137 7.2 CHAPTER 7 Supported IDEs Supported IDEs J-Link supports almost all popular IDEs available today. If support for a IDE is lacking, feel free to get in contact with SEGGER. (see Contact Information ) For a list of supported 3rd-party debuggers and IDEs and documentation on how to get started with those IDEs and J-Link / J-Trace es well as on how to use the advanced features of J-Link / J-Trace with any of them, please refer to: SEGGER Wiki: Getting Started with Various IDEs and List of supported IDEs J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 138 CHAPTER 7 7.3 Connecting the target system Connecting the target system 7.3.1 Power-on sequence In general, J-Link / J-Trace should be powered on before connecting it with the target device. That means you should first connect J-Link / J-Trace with the host system via USB and then connect J-Link / J-Trace with the target device via JTAG. Power-on the device after you connected J-Link / J-Trace to it. 7.3.2 Verifying target device connection If the USB driver is working properly and your J-Link / J-Trace is connected with the host system, you may connect J-Link / J-Trace to your target hardware. Then start JLink.exe which should now display the normal J-Link / J-Trace related information and in addition to that it should report that it found a JTAG target and the target’s core ID. The screenshot below shows the output of JLink.exe . As can be seen, it reports a J-Link with one JTAG device connected. 7.3.3 Problems If you experience problems with any of the steps described above, read the chapter Support and FAQs for troubleshooting tips. If you still do not find appropriate help there and your JLink / J-Trace is an original SEGGER product, you can contact SEGGER support via e-mail. Provide the necessary information about your target processor, board etc. and we will try to solve your problem. A checklist of the required information together with the contact information can be found in chapter Support and FAQs as well. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 139 CHAPTER 7 7.4 Indicators Indicators J-Link uses indicators (LEDs) to give the user some information about the current status of the connected J-Link. All J-Links feature the main indicator. Some newer J-Links such as the J-Link Pro / Ultra come with additional input/output Indicators. In the following, the meaning of these indicators will be explained. 7.4.1 Main indicator For J-Links up to V7, the main indicator is single color (Green). J-Link V8 comes with a bicolor indicator (Green & Red LED), which can show multiple colors: green, red and orange. 7.4.1.1 Single color indicator (J-Link V7 and earlier) Indicator status Meaning GREEN, flashing at 10 Hz Emulator enumerates. GREEN, flickering Emulator is in operation. Whenever the emulator is executing a command, the LED is switched off temporarily. Flickering speed depends on target interface speed. At low interface speeds, operations typically take longer and the “OFF” periods are typically longer than at fast speeds. GREEN, constant Emulator has enumerated and is in idle mode. GREEN, switched off for 10ms once per second J-Link heart beat. Will be activated after the emulator has been in idle mode for at least 7 seconds. GREEN, flashing at 1 Hz Emulator has a fatal error. This should not normally happen. 7.4.1.2 Bi-color indicator (J-Link V8) Indicator status Meaning GREEN, flashing at 10 Hz Emulator enumerates. GREEN, flickering Emulator is in operation. Whenever the emulator is executing a command, the LED is switched off temporarily. Flickering speed depends on target interface speed. At low interface speeds, operations typically take longer and the “OFF” periods are typically longer than at fast speeds. GREEN, constant Emulator has enumerated and is in idle mode. GREEN, switched off for 10ms once per second J-Link heart beat. Will be activated after the emulator has been in idle mode for at least 7 seconds. ORANGE Reset is active on target. RED, flashing at 1 Hz Emulator has a fatal error. This should not normally happen. 7.4.2 Input indicator Some newer J-Links such as the J-Link Pro/Ultra come with additional input/output indicators. The input indicator is used to give the user some information about the status of the target hardware. 7.4.2.1 Bi-color input indicator Indicator status Meaning GREEN Target voltage could be measured. Target is connected. ORANGE Target voltage could be measured. RESET is pulled low (active) on target side. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 140 CHAPTER 7 Indicator status Meaning RESET is pulled low (active) on target side. If no target is connected, reset will also be active on target side. RED 7.4.3 Indicators Output indicator Some newer J-Links such as the J-Link Pro/Ultra come with additional input/output indicators. The output indicator is used to give the user some information about the emulator-totarget connection. 7.4.3.1 Bi-color output indicator Indicator status Meaning OFF Target power supply via Pin 19 is not active. GREEN Target power supply via Pin 19 is active. ORANGE Target power supply via Pin 19 is active. Emulator pulls RESET low (active). RED Emulator pulls RESET low (active). J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 141 CHAPTER 7 7.5 JTAG interface JTAG interface By default, only one device is assumed to be in the JTAG scan chain. If you have multiple devices in the scan chain, you must properly configure it. To do so, you have to specify the exact position of the CPU that should be addressed. Configuration of the scan is done by the target application. A target application can be a debugger such as the IAR C-SPY® debugger, ARM’s AXD using RDI, a flash programming application such as SEGGER’s JFlash, or any other application using J-Link / J-Trace. It is the application’s responsibility to supply a way to configure the scan chain. Most applications offer a dialog box for this purpose. 7.5.1 Multiple devices in the scan chain J-Link / J-Trace can handle multiple devices in the scan chain. This applies to hardware where multiple chips are connected to the same JTAG connector. As can be seen in the following figure, the TCK and TMS lines of all JTAG device are connected, while the TDI and TDO lines form a bus. Currently, up to 32 devices in the scan chain are supported. One or more of these devices can be CPU cores; the other devices can be of any other type but need to comply with the JTAG standard. 7.5.1.1 Configuration The configuration of the scan chain depends on the application used. Read JTAG interface for further instructions and configuration examples. 7.5.2 Sample configuration dialog boxes As explained before, it is the responsibility of the application to allow the user to configure the scan chain. This is typically done in a dialog box; some sample dialog boxes are shown below. SEGGER J-Flash configuration dialog This dialog box can be found at Options|Project settings. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 142 CHAPTER 7 JTAG interface SEGGER J-Link RDI configuration dialog box This dialog can be found under RDI|Configure for example in IAR Embedded Workbench®. For detailed information check the IAR Embedded Workbench user guide. 7.5.3 Determining values for scan chain configuration If only one device is connected to the scan chain, the default configuration can be used. In other cases, J-Link / J-Trace may succeed in automatically recognizing the devices on the scan chain, but whether this is possible depends on the devices present on the scan chain. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 143 CHAPTER 7 JTAG interface How do I configure the scan chain? 2 values need to be known: • • The position of the target device in the scan chain. The total number of bits in the instruction registers of the devices before the target device (IR len). The position can usually be seen in the schematic; the IR len can be found in the manual supplied by the manufacturers of the others devices. ARM7/ARM9 have an IR len of four. Sample configurations The diagram below shows a scan chain configuration sample with 2 devices connected to the JTAG port. Examples The following table shows a few sample configurations with 1,2 and 3 devices in different configurations. Device 0 Chip(IR len) Device 1 Chip(IR len) Device 2 Chip(IR len) Position IR len ARM(4) - - 0 0 ARM(4) Xilinx(8) - 0 0 Xilinx(8) ARM(4) - 1 8 Xilinx(8) Xilinx(8) ARM(4) 2 16 ARM(4) Xilinx(8) ARM(4) 0 0 ARM(4) Xilinx(8) ARM(4) 2 12 Xilinx(8) ARM(4) Xilinx(8) 1 8 The target device is marked in blue. 7.5.4 JTAG Speed There are basically three types of speed settings: • Fixed JTAG speed. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 144 CHAPTER 7 • • 7.5.4.1 JTAG interface Automatic JTAG speed. Adaptive clocking. These are explained below. Fixed JTAG speed The target is clocked at a fixed clock speed. The maximum JTAG speed the target can handle depends on the target itself. In general CPU cores without JTAG synchronization logic (such as ARM7-TDMI) can handle JTAG speeds up to the CPU speed, ARM cores with JTAG synchronization logic (such as ARM7-TDMI-S, ARM946E-S, ARM966EJ-S) can handle JTAG speeds up to 1/6 of the CPU speed. JTAG speeds of more than 10 MHz are not recommended. 7.5.4.2 Automatic JTAG speed Selects the maximum JTAG speed handled by the TAP controller. Note On ARM cores without synchronization logic, this may not work reliably, because the CPU core may be clocked slower than the maximum JTAG speed. 7.5.4.3 Adaptive clocking If the target provides the RTCK signal, select the adaptive clocking function to synchronize the clock to the processor clock outside the core. This ensures there are no synchronization problems over the JTAG interface. If you use the adaptive clocking feature, transmission delays, gate delays, and synchronization requirements result in a lower maximum clock frequency than with non-adaptive clocking. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 145 CHAPTER 7 7.6 SWD interface SWD interface The J-Link support ARMs Serial Wire Debug (SWD). SWD replaces the 5-pin JTAG port with a clock (SWDCLK) and a single bi-directional data pin (SWDIO), providing all the normal JTAG debug and test functionality. SWDIO and SWCLK are overlaid on the TMS and TCK pins. In order to communicate with a SWD device, J-Link sends out data on SWDIO, synchronous to the SWCLK. With every rising edge of SWCLK, one bit of data is transmitted or received on the SWDIO. 7.6.1 SWD speed Currently only fixed SWD speed is supported by J-Link. The target is clocked at a fixed clock speed. The SWD speed which is used for target communication should not exceed target CPU speed * 10 . The maximum SWD speed which is supported by J-Link depends on the hardware version and model of J-Link. For more information about the maximum SWD speed for each J-Link / J-Trace model, please refer to J-Link / J-Trace models on page 35. 7.6.2 SWO Serial Wire Output (SWO) support means support for a single pin output signal from the core. The Instrumentation Trace Macrocell (ITM) and Serial Wire Output (SWO) can be used to form a Serial Wire Viewer (SWV). The Serial Wire Viewer provides a low cost method of obtaining information from inside the MCU. Usually it should not be necessary to configure the SWO speed because this is usually done by the debugger. 7.6.2.1 Max. SWO speeds The supported SWO speeds depend on the connected emulator. They can be retrieved from the emulator. To get the supported SWO speeds for your emulator, use J-Link Commander: J-Link> si 1 //Select target interface SWD J-Link> SWOSpeed Currently, following speeds are supported: Emulator Speed formula Resulting max. speed J-Link V9 60MHz/n, n ≥ 8 7.5 MHz J-Link Pro/ULTRA V4 3.2GHz/n, n ≥ 64 50 MHz 7.6.2.2 Configuring SWO speeds The max. SWO speed in practice is the max. speed which both, target and J-Link can handle. J-Link can handle the frequencies described in SWO whereas the max. deviation between the target and the J-Link speed is about 3%. The computation of possible SWO speeds is typically done in the debugger. The SWO output speed of the CPU is determined by TRACECLKIN, which is normally the same as the CPU clock. Example 1 Target CPU running at 72 MHz. n is between 1 and 8192. Possible SWO output speeds are: 72MHz, 36MHz, 24MHz, ... J-Link V9: Supported SWO input speeds are: 60MHz / n, n>= 8: 7.5MHz, 6.66MHz, 6MHz, ... Permitted combinations are: SWO output 6MHz, n = 12 J-Link / J-Trace (UM08001) SWO input 6MHz, n = 10 Deviation percent 0 © 2004-2021 SEGGER Microcontroller GmbH 146 CHAPTER 7 SWO output SWO input SWD interface Deviation percent 4MHz, n = 18 4MHz, n = 15 0 … … ≤3 2MHz, n = 36 2MHz, n = 30 0 … … … TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT Example 2 Target CPU running at 10 MHz. Possible SWO output speeds are: 10MHz, 5MHz, 3.33MHz, ... J-Link V7: Supported SWO input speeds are: 6MHz / n, n>= 1: 6MHz, 3MHz, 2MHz, 1.5MHz, ... Permitted combinations are: SWO output SWO input Deviation percent 2MHz, n = 5 2MHz, n = 3 0 1MHz, n = 10 1MHz, n = 6 0 769kHz, n = 13 750kHz, n = 8 2.53 … … … J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 147 CHAPTER 7 7.7 Multi-core debugging Multi-core debugging J-Link / J-Trace is able to debug multiple cores on one target system connected to the same scan chain. Configuring and using this feature is described in this section. 7.7.1 How multi-core debugging works Multi-core debugging requires multiple debuggers or multiple instances of the same debugger. Two or more debuggers can use the same J-Link / J-Trace simultaneously. Configuring a debugger to work with a core in a multi-core environment does not require special settings. All that is required is proper setup of the scan chain for each debugger. This enables J-Link / J-Trace to debug more than one core on a target at the same time. The following figure shows a host, debugging two CPU cores with two instances of the same debugger. Both debuggers share the same physical connection. The core to debug is selected through the JTAG-settings as described below. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 148 CHAPTER 7 7.7.2 Multi-core debugging Using multi-core debugging in detail 1. Connect your target to J-Link / J-Trace. 2. Start your debugger, for example IAR Embedded Workbench for ARM. 3. Choose Project|Options and configure your scan chain. The picture below shows the configuration for the first CPU core on your target. 4. Start debugging the first core. 5. Start another debugger, for example another instance of IAR Embedded Workbench for ARM. 6. Choose Project|Options and configure your second scan chain. The following dialog box shows the configuration for the second ARM core on your target. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 149 CHAPTER 7 Multi-core debugging 7. Start debugging your second core. Core #1 Core #2 TAP number debugger #1 Core #3 TAP number debugger #2 ARM7TDMI ARM7TDMI-S ARM7TDMI 0 1 ARM7TDMI ARM7TDMI ARM7TDMI 0 2 ARM7TDMI-S ARM7TDMI-S ARM7TDMI-S 1 2 7.7.3 Things you should be aware of Multi-core debugging is more difficult than single-core debugging. You should be aware of the pitfalls related to JTAG speed and resetting the target. 7.7.3.1 JTAG speed Each core has its own maximum JTAG speed. The maximum JTAG speed of all cores in the same chain is the minimum of the maximum JTAG speeds. For example: • • • 7.7.3.2 Core #1: 2MHz maximum JTAG speed Core #2: 4MHz maximum JTAG speed Scan chain: 2MHz maximum JTAG speed Resetting the target All cores share the same RESET line. You should be aware that resetting one core through the RESET line means resetting all cores which have their RESET pins connected to the RESET line on the target. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 150 CHAPTER 7 7.8 Connecting multiple J-Links / J-Traces to your PC Connecting multiple J-Links / J-Traces to your PC In general, it is possible to have an unlimited number of J-Links / J-Traces connected to the same PC. Current J-Link models are already factory-configured to be used in a multi-J-Link environment, older J-Links can be re-configured to use them in a multi-J-link environment. 7.8.1 How does it work? USB devices are identified by the OS by their product ID, vendor id and serial number. The serial number reported by current J-Links is a unique number which allows to have an almost unlimited number of J-Links connected to the same host at the same time. In order to connect to the correct J-Link, the user has to make sure that the correct J-Link is selected (by SN or IP). In cases where no specific J-Link is selected, following pop up will shop and allow the user to select the proper J-Link: The sketch below shows a host, running two application programs. Each application communicates with one CPU core via a separate J-Link. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 151 CHAPTER 7 Connecting multiple J-Links / J-Traces to your PC Older J-Links may report USB0-3 instead of unique serial number when enumerating via USB. For these J-Links, we recommend to re-configure them to use the new enumeration method (report real serial number) since the USB0-3 behavior is obsolete. Re-configuration can be done by using the J-Link Configurator, which is part of the J-Link Software and Documentation Package. For further information about the J-Link Configurator and how to use it, please refer to J-Link Configurator . Re-configuration to the old USB 0-3 enumeration method In some special cases, it may be necessary to switch back to the obsolete USB 0-3 enumeration method. For example, old IAR EWARM versions supports connecting to a J-Link via the USB0-3 method only. As soon as more than one J-Link is connected to the pc, there is no opportunity to pre-select the J-Link which should be used for a debug session. Below, a small instruction of how to re-configure J-Link to enumerate with the old obsolete enumeration method in order to prevent compatibility problems, a short instruction is give on how to set USB enumeration method to USB 2 is given: Config area byte Meaning 0 USB-Address. Can be set to 0-3, 0xFF is default which means USB-Address 0. 1 Enumeration method 0x00 / 0xFF: USB-Address is used for enumeration. 0x01: Real-SN is used for enumeration. Example for setting enumeration method to USB 2: 1. 2. 3. 4. Start J-Link Commander (JLink.exe) which is part of the J-Link software Enter wconf 0 02 // Set USB-Address 2 Enter wconf 1 00 // Set enumeration method to USB-Address Power-cycle J-Link in order to apply new configuration. Re-configuration to REAL-SN enumeration can be done by using the J-Link Configurator, which is part of the JLink Software and Documentation Package. For further information about the J-Link Configurator and how to use it, please refer to J-Link Configurator . J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 152 CHAPTER 7 7.9 J-Link control panel J-Link control panel Since software version V3.86 J-Link the J-Link control panel window allows the user to monitor the J-Link status and the target status information in real-time. It also allows the user to configure the use of some J-Link features such as flash download, flash breakpoints and instruction set simulation. The J-Link control panel window can be accessed via the JLink tray icon in the tray icon list. This icon is available when the debug session is started. To open the status window, simply click on the tray icon. 7.9.1 Tabs The J-Link status window supports different features which are grouped in tabs. The organization of each tab and the functionality which is behind these groups will be explained in this section 7.9.1.1 General In the General section, general information about J-Link and the target hardware are shown. Moreover the following general settings can be configured: • • • Show tray icon: If this checkbox is disabled the tray icon will not show from the next time the DLL is loaded. Start minimized: If this checkbox is disabled the J-Link status window will show up automatically each time the DLL is loaded. Always on top: If this checkbox is enabled the J-Link status window is always visible even if other windows will be opened. The general information about target hardware and J-Link which are shown in this section, are: • • • • • • • Process: Shows the path of the file which loaded the DLL. J-Link: Shows OEM of the connected J-Link, the hardware version and the Serial number. If no J-Link is connected it shows “not connected” and the color indicator is red. Target interface: Shows the selected target interface (JTAG/SWD) and the current JTAG speed. The target current is also shown. (Only visible if J-Link is connected) Endian: Shows the target endianness (Only visible if J-Link is connected) Device: Shows the selected device for the current debug session. License: Opens the J-Link license manager. About: Opens the about dialog. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 153 CHAPTER 7 7.9.1.2 J-Link control panel Settings In the Settings section project- and debug-specific settings can be set. It allows the configuration of the use of flash download and flash breakpoints and some other target specific settings which will be explained in this topic. Settings are saved in the configuration file. This configuration file needs to be set by the debugger. If the debugger does not set it, settings can not be saved. All settings which are modified during the debug session have to be saved by pressing Save settings, otherwise they are lost when the debug session is closed. Section: Flash download In this section, settings for the use of the J-Link FlashDL feature and related settings can be configured. When a license for J-Link FlashDL is found, the color indicator is green and “License found” appears right to the J-Link FlashDL usage settings. • • • • • Auto: This is the default setting of J-Link FlashDL usage. If a license is found J-Link FlashDL is enabled. Otherwise J-Link FlashDL will be disabled internally. On: Enables the J-Link FlashDL feature. If no license has been found an error message appears. Off: Disables the J-Link FlashDL feature. Skip download on CRC match: J-Link checks the CRC of the flash content to determine if the current application has already been downloaded to the flash. If a CRC match occurs, the flash download is not necessary and skipped. (Only available if J-Link FlashDL usage is configured as Auto or On ) Verify download: If this checkbox is enabled J-Link verifies the flash content after the download. (Only available if J-Link FlashDL usage is configured as Auto or On ) Section: Flash breakpoints: In this section, settings for the use of the FlashBP feature and related settings can be configured. When a license for FlashBP is found, the color indicator is green and “License found” appears right to the FlashBP usage settings. • • • • Auto: This is the default setting of FlashBP usage. If a license has been found the FlashBP feature will be enabled. Otherwise FlashBP will be disabled internally. On: Enables the FlashBP feature. If no license has been found an error message appears. Off: Disables the FlashBP feature. Show window during program : When this checkbox is enabled the “Programming flash” window is shown when flash is re-programmed in order to set/clear flash breakpoints. Flash download and flash breakpoints independent settings These settings do not belong to the J-Link flash download and flash breakpoints settings section. They can be configured without any license needed. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 154 CHAPTER 7 • • • • • • • 7.9.1.3 J-Link control panel Log file: Shows the path where the J-Link log file is placed. It is possible to override the selection manually by enabling the Override checkbox. If the Override checkbox is enabled a button appears which let the user choose the new location of the log file. Settings file: Shows the path where the configuration file is placed. This configuration file contains all the settings which can be configured in the Settings tab. Override device selection: If this checkbox is enabled, a dropdown list appears, which allows the user to set a device manually. This especially makes sense when J-Link can not identify the device name given by the debugger or if a particular device is not yet known to the debugger, but to the J-Link software. Allow caching of flash contents : If this checkbox is enabled, the flash contents are cached by J-Link to avoid reading data twice. This speeds up the transfer between debugger and target. Allow instruction set simulation: If this checkbox is enabled, instructions will be simulated as far as possible. This speeds up single stepping, especially when FlashBPs are used. Save settings: When this button is pushed, the current settings in the Settings tab will be saved in a configuration file. This file is created by J-Link and will be created for each project and each project configuration (e.g. Debug_RAM, Debug_Flash). If no settings file is given, this button is not visible. Modify breakpoints during execution: This dropdown box allows the user to change the behavior of the DLL when setting breakpoints if the CPU is running. The following options are available: Allow: Allows settings breakpoints while the CPU is running. If the CPU needs to be halted in order to set the breakpoint, the DLL halts the CPU, sets the breakpoints and restarts the CPU. Allow if CPU does not need to be halted: Allows setting breakpoints while the CPU is running, if it does not need to be halted in order to set the breakpoint. If the CPU has to be halted the breakpoint is not set. Ask user if CPU needs to be halted: If the user tries to set a breakpoint while the CPU is running and the CPU needs to be halted in order to set the breakpoint, the user is asked if the breakpoint should be set. If the breakpoint can be set without halting the CPU, the breakpoint is set without explicit confirmation by the user. Do not allow: It is not allowed to set breakpoints while the CPU is running. Break/Watch In the Break/Watch section all breakpoints and watchpoints which are in the DLL internal breakpoint and watchpoint list are shown. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 155 CHAPTER 7 J-Link control panel Section: Code Lists all breakpoints which are in the DLL internal breakpoint list are shown. • • • • • Handle: Shows the handle of the breakpoint. Address: Shows the address where the breakpoint is set. Mode: Describes the breakpoint type (ARM/THUMB) Permission: Describes the breakpoint implementation flags. Implementation: Describes the breakpoint implementation type. The breakpoint types are: RAM, Flash, Hard. An additional TBC (to be cleared) or TBS (to be set) gives information about if the breakpoint is (still) written to the target or if it’s just in the breakpoint list to be written/cleared. Note It is possible for the debugger to bypass the breakpoint functionality of the J-Link software by writing to the debug registers directly. This means for ARM7/ARM9 cores write accesses to the ICE registers, for Cortex-M3 devices write accesses to the memory mapped flash breakpoint registers and in general simple write accesses for software breakpoints (if the program is located in RAM). In these cases, the J-Link software cannot determine the breakpoints set and the list is empty. Section: Data In this section, all data breakpoints which are listed in the DLL internal breakpoint list are shown. • • • • • • • 7.9.1.4 Handle: Shows the handle of the data breakpoint. Address: Shows the address where the data breakpoint is set. AddrMask: Specifies which bits of Address are disregarded during the comparison for a data breakpoint match. (A 1 in the mask means: disregard this bit) Data: Shows on which data to be monitored at the address where the data breakpoint is set. Data Mask: Specifies which bits of Data are disregarded during the comparison for a data breakpoint match. (A 1 in the mask means: disregard this bit) Ctrl: Specifies the access type of the data breakpoint (read/write). CtrlMask: Specifies which bits of Ctrl are disregarded during the comparison for a data breakpoint match. Log In this section the log output of the DLL is shown. The user can determine which function calls should be shown in the log window. Available function calls to log: Register read/write, Memory read/write, set/clear breakpoint, step, go, halt, is halted. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 156 CHAPTER 7 7.9.1.5 J-Link control panel CPU Regs In this section the name and the value of the CPU registers are shown. 7.9.1.6 Target Power In this section currently just the power consumption of the target hardware is shown. 7.9.1.7 SWV In this section SWV information are shown. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 157 CHAPTER 7 • • • • • • J-Link control panel Status: Shows the encoding and the baudrate of the SWV data received by the target (Manchester/UART, currently J-Link only supports UART encoding). Bytes in buffer: Shows how many bytes are in the DLL SWV data buffer. Bytes transferred: Shows how many bytes have been transferred via SWV, since the debug session has been started. Refresh counter: Shows how often the SWV information in this section has been updated since the debug session has been started. Host buffer: Shows the reserved buffer size for SWV data, on the host side. Emulator buffer: Shows the reserved buffer size for SWV data, on the emulator side. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 158 CHAPTER 7 7.10 Reset strategies Reset strategies Wiki article J-Link Reset Strategies J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 159 CHAPTER 7 7.11 Using DCC for memory access Using DCC for memory access The ARM7/9 architecture requires cooperation of the CPU to access memory when the CPU is running (not in debug mode). This means that memory cannot normally be accessed while the CPU is executing the application program. The normal way to read or write memory is to halt the CPU (put it into debug mode) before accessing memory. Even if the CPU is restarted after the memory access, the real time behavior is significantly affected; halting and restarting the CPU costs typically multiple milliseconds. For this reason, most debuggers do not even allow memory access if the CPU is running. However, there is one other option: DCC (Direct communication channel) can be used to communicate with the CPU while it is executing the application program. All that is required is the application program to call a DCC handler from time to time. This DCC handler typically requires less than 1 s per call. The DCC handler, as well as the optional DCC abort handler, is part of the J-Link software package and can be found in the Samples\DCC\IAR directory of the package. 7.11.1 • • • What is required? An application program on the host (typically a debugger) that uses DCC. A target application program that regularly calls the DCC handler. The supplied abort handler should be installed (optional). An application program that uses DCC is JLink.exe . 7.11.2 Target DCC handler The target DCC handler is a simple C-file taking care of the communication. The function DCC_Process() needs to be called regularly from the application program or from an interrupt handler. If an RTOS is used, a good place to call the DCC handler is from the timer tick interrupt. In general, the more often the DCC handler is called, the faster memory can be accessed. On most devices, it is also possible to let the DCC generate an interrupt which can be used to call the DCC handler. 7.11.3 Target DCC abort handler An optional DCC abort handler (a simple assembly file) can be included in the application. The DCC abort handler allows data aborts caused by memory reads/writes via DCC to be handled gracefully. If the data abort has been caused by the DCC communication, it returns to the instruction right after the one causing the abort, allowing the application program to continue to run. In addition to that, it allows the host to detect if a data abort occurred. In order to use the DCC abort handler, 3 things need to be done: • • • Place a branch to DCC_Abort at address 0x10 (“vector” used for data aborts). Initialize the Abort-mode stack pointer to an area of at least 8 bytes of stack memory required by the handler. Add the DCC abort handler assembly file to the application. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 160 CHAPTER 7 7.12 The J-Link settings file The J-Link settings file Most IDEs provide a path to a J-Link settings file on a per-project-per-debug-configuration basis. This file is used by J-Link to store various debug settings that shall survive between debug sessions of a project. It also allows the user to perform some override of various settings. If a specific behavior / setting can be overridden via the settings file, is explained in the specific sections that describe the behavior / setting. Since the location and name of the settings file is different for various IDEs, in the following the location and naming convention of the J-Link settings file for various IDEs is explained. 7.12.1 SEGGER Embedded Studio Settings file with default settings is created on first start of a debug session. There is one settings file per build configuration for the project. Naming is: __.jlink The settings file is created in the same directory where the project file (*.emProject) is located. Example: The SES project is called “MyProject” and has two configurations “Debug” and “Release”. For each of the configurations, a settings file will be created at the first start of the debug session: _MyProject_Debug.jlink _MyProject_Release.jlink 7.12.2 Keil MDK-ARM (uVision) Settings file with default settings is created on first start of a debug session. There is one settings file per project. Naming is: JLinksettings.ini The settings file is created in the same directory where the project file (*.uvprojx) is located. 7.12.3 IAR EWARM Settings file with default settings is created on first start of a debug session. There is one settings file per build configuration for the project. Naming is: _.jlink The settings file is created in a “settings” subdirectory where the project file is located. 7.12.4 Mentor Sourcery CodeBench for ARM CodeBench does not directly specify a J-Link settings file but allows the user to specify a path to one in the project settings under Debugger -> Settings File . We recommend to copy the J-Link settings file template from $JLINK_INST_DIR$\Samples\JLink\SettingsFiles\Sample.jlinksettings to the directory where the CodeBench project is located, once when creating a new project. Then select this file in the project options. J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 161 CHAPTER 7 7.13 J-Link script files J-Link script files In some situations it it necessary to customize some actions performed by J-Link. In most cases it is the connection sequence and/or the way in which a reset is performed by J-Link, since some custom hardware needs some special handling which cannot be integrated into the generic part of the J-Link software. J-Link script files are written in C-like syntax in order to have an easy start to learning how to write J-Link script files. The script file syntax supports most statements (if-else, while, declaration of variables, …) which are allowed in C, but not all of them. Moreover, there are some statements that are script file specific. The script file allows maximum flexibility, so almost any target initialization which is necessary can be supported. 7.13.1 Actions that can be customized The script file support allows customizing of different actions performed by J-Link. Depending on whether the corresponding function is present in the script file or not, a generically implemented action is replaced by an action defined in a script file. In the following all JLink actions which can be customized using a script file are listed and explained. Action Prototype ConfigTargetSettings() int ConfigTargetSettings (void); InitTarget() int InitTarget (void); SetupTarget() int SetupTarget (void); ResetTarget() int ResetTarget (void); InitEmu() int InitEMU (void); OnTraceStop() int OnTraceStop (void); OnTraceStart() int OnTraceStart (void); AfterResetTarget() int AfterResetTarget (void); SWO_EnableTarget() int SWO_EnableTarget (void); SWO_GetSWOBaseClock() U32 SWO_GetSWOBaseClock (U32 CPUclock); HandleBeforeFlashProg() int HandleBeforeFlashProg (void); HandleAfterFlashProg() int HandleAfterFlashProg (void); StartETM() int StartETM (void); StopETM() int StopETM (void); StartTPIU() int StartTPIU (void); StopTPIU() int StopTPIU (void); StartTMC() int StartTMC (void); StopTMC() int StopTMC (void); StartPTM() int StartPTM (void); StopPTM() int StopPTM (void); StartTF() int StartTF (void); StopTF() int StopTF (void); StartETB() int StartETB (void); StopETB() int StopETB (void); J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 162 CHAPTER 7 J-Link script files Note The default return values for all listed functions above are: Return value 7.13.1.1 Meaning ≥0 O.K. ICEPick (6-bits IRLen) -> Cortex-M (4-bits IRLen) -> TDO JLINK_CORESIGHT_Configure("IRPre=0;DRPre=0;IRPost=6;DRPost=1;IRLenDevice=4;"); v = JLINK_CORESIGHT_ReadDP(JLINK_CORESIGHT_DP_REG_CTRL_STAT); JLINK_SYS_Report1("DAP-CtrlStat: " v) Known setup parameters Parameter Type Explanation IRPre DecValue Sum of IRLen of all JTAG devices in the JTAG chain, closer to TDO than the actual one J-Link shall communicate with. DRPre DecValue Number of JTAG devices in the JTAG chain, closer to TDO than the actual one, J-Link shall communicate with. IRPost DecValue Sum of IRLen of all JTAG devices in the JTAG chain, following the actual one, J-Link shall communicate with. DRPost DecValue Number of JTAG devices in the JTAG chain, following the actual one, J-Link shall communicate with. IRLenDevice DecValue IRLen of the actual device, J-Link shall communicate with. PerformTIFInit DecValue J-Link / J-Trace (UM08001) 0: Do not output switching sequence etc. once JLINK_CORESIGHT_Configure() completes. © 2004-2021 SEGGER Microcontroller GmbH 173 CHAPTER 7 7.13.2.7 J-Link script files JLINK_CORESIGHT_ReadAP() Reads a specific AP register. For JTAG, makes sure that AP is selected automatically. Makes sure that actual data is returned, meaning for register read-accesses which usually only return data on the second access, this function performs this automatically, so the user will always see valid data. Prototype int JLINK_CORESIGHT_ReadAP(int RegIndex); Parameter RegIndex Return value Description Specifies the index of the AP register to read. Description ≠ -1 Data read = -1 Error Example v = JLINK_CORESIGHT_ReadAP(JLINK_CORESIGHT_AP_REG_DATA); JLINK_SYS_Report1("DATA: " v); 7.13.2.8 JLINK_CORESIGHT_ReadDP() Reads a specific DP register. For JTAG, makes sure that DP is selected automatically. Makes sure that actual data is returned, meaning for register read-accesses which usually only return data on the second access, this function performs this automatically, so the user will always see valid data. Prototype int JLINK_CORESIGHT_ReadDP(int RegIndex); Parameter RegIndex Return value Description Specifies the index of the DP register to read. Description ≠ -1 Data read = -1 Error Example v = JLINK_CORESIGHT_ReadDP(JLINK_CORESIGHT_DP_REG_IDCODE); JLINK_SYS_Report1("DAP-IDCODE: " v); 7.13.2.9 JLINK_CORESIGHT_ReadDAP() Reads a specific AP/DP register. For JTAG, makes sure that AP/DP is selected automatically. Makes sure that actual data is returned, meaning for register read-accesses which usually only return data on the second access, this function performs this automatically, so the user will always see valid data. Prototype int JLINK_CORESIGHT_ReadDAP(int RegIndex, int APnDP, U32* Data); J-Link / J-Trace (UM08001) © 2004-2021 SEGGER Microcontroller GmbH 174 CHAPTER 7 Parameter J-Link script files Description RegIndex Specifies the index of the AP/DP register to read. APnDP 0: DP register 1: AP register Data Pointer to buffer for data read Return Value Return value Description ≥0 O.K. (Number of repetitions needed before read was accepted / returned valid data)
8.18.00 J-TRACE PRO FOR CORTEX-M 价格&库存

很抱歉,暂时无法提供与“8.18.00 J-TRACE PRO FOR CORTEX-M”相匹配的价格&库存,您可以联系我们找货

免费人工找货