Page 1
J-Link / J-Trace User Guide JTAG Emulators for ARM Cores A product of SEGGER Microcontroller GmbH & Co. KG Release date: 07-12-04...
Page 2
Please make sure your manual is the latest edition. While the information herein is assumed to be accurate, SEGGER Microcontroller GmbH & Co. KG (the manufacturer) assumes no responsibility for any errors or omissions. The manufacturer makes and you receive no warranties or conditions, express, implied, statutory or in any communication with you.
Page 5
About this document This document describes J-Link and J-Trace. It provides an overview over the major features of J-Link and J-Trace, gives you some background information about JTAG, ARM and Tracing in general and describes J-Link and J-Trace related software pack- ages available from Segger.
Page 6
Apart from its main focus on software tools, SEGGER developes and produces program- ming tools for flash microcontrollers, as well as J-Link, a JTAG emulator to assist in devel- opment, debugging and production, which has rapidly become the industry standard for debug access to ARM cores.
Specifications for J-Trace ................15 1.3.3 Download speed ..................16 Requirements..................17 2 Setup..........................19 Installing the J-Link ARM software and documen-tation pack ......20 2.1.1 Setup procedure..................21 2.1.2 Verifying correct driver installation ............. 24 Uninstalling the J-Link USB driver .............. 26 Connecting the target system..............
Page 8
4.4.1 How does it work? ................... 50 4.4.2 Configuring multiple J-Links / J-Traces ............51 4.4.3 Connecting to a J-Link / J-Trace with non default USB-Address...... 52 Multi-core debugging ................53 4.5.1 How multi-core debugging works............... 53 4.5.2 Using multi-core debugging in detail ............54 4.5.3...
Page 9
Embedded Trace Macrocell (ETM)............... 97 Embedded Trace Buffer (ETB) ..............98 Flash programming .................. 99 7.6.1 How does flash programming via J-Link / J-Trace work ?....... 99 7.6.2 Data download to RAM ................99 7.6.3 Data download via DCC ................99 7.6.4...
Introduction J-Link overview J-Link is a JTAG emulator designed for ARM cores. It connects via USB to a PC run- ning Microsoft Windows 2000, Windows XP, Windows 2003 or Windows Vista. J-Link has a built-in 20-pin JTAG connector, which is compatible with the standard 20-pin connector defined by ARM.
Requirements Host System To use J-Link or J-Trace you need a host system running Windows 2000, Windows XP, Windows 2003, or Windows Vista. Target System An ARM7 or ARM9 target system is required. The system should have a standardized 20-pin connector as defined by ARM Ltd. for a simple JTAG connection. The individual pins are described in section JTAG Connector on page 74.
Chapter 2 Setup This chapter describes the setup procedure required in order to work with J-Link / J- Trace. Primarily this includes the installation of the J-Link software and documenta- tion package, which also includes a kernel mode J-Link USB driver in your host sys- tem.
J-Link USB driver. Some of the applications require an additional license, free trial licenses are avaliable upon request from www.segger.com. Refer to chapter J-Link and J-Trace related software on page 33 for an overview about the J-Link software and documentation pack. J-Link / J-Trace User Guide...
To install the J-Link ARM software and documentation pack, follow this procedure: Note: We recommend to check if a newer version of the J-Link software and doc- umentation pack is available for download before starting the installation. Check therefore the J-Link related download section of our website: http://www.segger.com/download_jlink.html...
Page 23
The J-Link software and documentation pack is successfully installed on your PC. Connect your J-Link via USB with your PC. The J-Link will be identified and after a short period the J-Link LED stopps rapidly flashing and stays on permanently.
In addition you can verify the driver installation by consulting the Windows device manager. If the driver is installed and your J-Link / J-Trace is connected to your com- puter, the device manager should list the J-Link USB driver as a node below "Univer- sal Serial Bus controllers"...
Page 25
Right-click on the driver to open a context menu which contains the command Prop- erties. If you select this command, a J-Link driver Properties dialog box is opened and should report: This device is working properly. If you experience problems, refer to the chapter Support and FAQs on page 107 for help.
CHAPTER 2 Setup Uninstalling the J-Link USB driver If J-Link / J-Trace is not properly recognized by Windows and therefore does not enu- merate, it make sense to uninstall the J-Link USB driver. This might be the case when: •...
2.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...
IAR C-SPY® debugger, ARM’s AXD using RDI, a flash programming appli- cation such as SEGGER’s J-Flash, 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.
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.
This chapter describes Segger’s J-Link / J-Trace related software portfoliowhich cov- ers nearly all phases of the development of embedded applications. The support of the remote debug interface (RDI) and the J-Link GDBServer allows an easy J-Link integration in all relevant toolchains.
J-Link and J-Trace related software J-Link related software 3.1.1 J-Link software and documentation package J-Link is shipped with a bundle of applications. Some of the applications require an additional license, free trial licenses are available upon request from www.seg- ger.com. Software Description JLinkARM.dll...
3.2.1 J-Link Commander (Command line tool) J-Link Commander (JLink.exe) is a tool that can be used for verifying proper instal- lation of the USB driver and to verify the connection to the ARM chip, as well as for simple analysis of the target system. It permits some simple commands, such as memory dump, halt, step, go and ID-check, as well as some more in-depths analysis of the state of the ARM core and the ICE breaker module.
The J-Link TCP/IP 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.
However, to actually program devices via J-Flash ARM and J-Link / J-Trace you are required to obtain a license key from us. Evaluation licenses are available free of charge. For further information go to our website or contact us directly.
The J-Link RDI software is an remote debug interface for J-Link. It makes it possible to use J-Link with any RDI compliant debugger. The main part of the software is an RDI-compliant DLL, which needs to be selected in the debugger. There are two addi- tional features available which build on the RDI software foundation.
Page 39
How does this work? Basically, it is very simple the J-Link RDI software reprograms a sector of the flash to set or clear a breakpoint. What performance can I expect? A RAM code, specially designed for this purpose, sets and clears flash breakpoints extremely fast;...
GDB is freely available from the GNU commitee under: http://www.gnu.org/software/gdb/download/ J-Link GDB Server is distributed as "free for evaluation and non commercial use". The software can be used free of charge for educational and nonprofit purposes without additional license.
The J-Link Software Developer Kit is needed if you want to write your own program with J-Link / J-Trace. The J-Link DLL is a standard Windows DLL typically used from C programs (Visual Basic or Delphi projects are also possible). It makes the entire...
What is the JLinkARM.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.
Working with J-Link and J-Trace Supported ARM Cores J-Link / J-Trace has been tested with the following cores, but should work with any ARM7/ARM9 and Cortex-M3 core. If you experience problems with a particular core, do not hesitate to contact Segger.
Some CPUs can actually be halted before executing any instruction, because the start of the CPU is delayed after reset release. If a pause has been specified, J-Link waits for the specified time before trying to halt the CPU. This can be useful if a bootloader which resides in flash or ROM needs to be started after reset.
Page 48
No reset is performed. Nothing happens. 4.2.1.5 Type 4: Hardware, halt with WP The hardware RESET pin is used to reset the CPU. After reset release, J-Link continu- ously tries to halt the CPU using a watchpoint. This typically halts the CPU shortly after reset release;...
4.3.4 Cache handling of ARM9 cores ARM9 cores with cache require J-Link / J-Trace to handle the caches during debug. If the processor enters debug state with caches enabled, J-Link / J-Trace does the fol- lowing: When entering debug state J-Link / J-Trace performs the following: •...
• The product id (PID) for J-Link / J-Trace #2 is 102 and so on. A different PID means that J-Link / J-Trace is identified as a different device, requir- ing a new driver. The sketch below shows a host, running two application programs. Each application communicates with one ARM core via a separate J-Link.
The system will recognize a new J-Link / J-Trace and will prompt for a driver. Click OK and browse to the J-Link USB driver for your new J-Link / J-Trace. For your second J-Link / J-Trace this would be JLink1.sys, for your third J-Link / J- Trace this would be JLink2.sys.
Connecting to a J-Link / J-Trace with non default USB- Address Restart JLink.exe and type usb 1 to connect to J-Link / J-Trace #1. You may connect other J-Links / J-Traces to your PC and connect to them as well. To connect to an unconfigured J-Link / J-Trace (with default address "0"), restart...
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. 4.5.1 How multi-core debugging works Multi-core debugging requires multiple debuggers or multiple instances of the same debugger.
Multiple devices in the scan chain J-Link / J-Trace can handle multiple devices in the scan chain. This applies to hard- ware 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.
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 pack- age.
Working with J-Link and J-Trace Command strings The behaviour of the J-Link can be customized via command strings passed to the JLinkARM.dll which controls J-Link. Applications such as the J-Link Commander, but also the C-SPY debugger which is part of the IAR Embedded Workbench, allow pass- ing one or more command strings.
Page 61
To avoid stalling the debug session, a critical memory area can be excluded from access: J-Link will not try to read or write to critical memory areas and instead ignore the access silently. Some debuggers (such as IAR C-SPY) can try to access memory in such areas by dereferencing non-initialized pointers even if the debugged program (the debuggee) is working perfectly.
SupplyPower = 1 4.8.1.10 SupplyPowerDefault This command activates power supply over pin 19 of the JTAG connector perma- nently. The KS (Kickstart) versions of J-Link have the V5 supply over pin 19 acti- vated by default. Typical applications This feature is usefull for some eval boards that can be powered over the JTAG con- nector.
Page 65
4.8.2.2 IAR Embedded Workbench The J-Link command strings can be supplied using the C-SPY debugger of the IAR Embedded Workbench. Open the Project options dialog box and select Debugger. On the Extra Options page, select Use command line options. Enter --...
Indirectly reading solves the fast GPIO problem, because only direct regis- ter access corrupts the register contents. Define a 256 byte aligned area in RAM of the LPC target device with the J-Link com- mand map ram and define afterwards the memory area which should be read indirect with the command map indirectread to use the indirectly reading feature of J-Link.
All devices of this family are supported by J-Link. 5.4.4.1 Flash erasing The devices have 3 TAP controllers built-in. When starting J-Link exe, it reports 3 JTAG devices. A special tool, J-Link STR9 Commander is available to directly access the flash controller of the device. This tool can be used to erase the flash of the con- troller even if a program is in flash which causes the ARM core to stall.
Typically left open on target hardware. Table 6.1: J-Link / J-Trace pinout Pins 4, 6, 8, 10, 12, 14, 16, 18, 20 are GND pins connected to GND in J-Link. They should also be connected to GND in the target system.
Typically left open on target hardware. Table 6.2: J-Link / J-Trace SWD pinout Pins 4, 6, 8, 10, 12, 14, 16, 18, 20 are GND pins connected to GND in J-Link. They should also be connected to GND in the target system.
Adapters 6.5.1 JTAG 14 pin adapter An adapter is available to use J-Link / J-Trace with targets using this 14 pin 0.1" mat- ing JTAG connector. The following table shows the mapping between the 14 pin adapter and the standard 20 pin JTAG interface.
JTAG probes) to 5V. Most targets have JTAG signals at voltage levels between 1.2V and 3.3V for J-Link and 3.0V up to 3.6V for J-Trace. These targets can be used with J-Link / J-Trace without a 5V adapter. Higher voltages are common primarily in the automotive sector.
J-Links have the hardware version printed on the back label. If this is not the case with your J-Link, start JLink.exe. As part of the initial mes- sage, the hardware version is displayed.
Page 86
5V target supply (pin 19) of Kick-Start versions of J-Link is current monitored and limited. J-Link automatically switches off 5V supply in case of over-current to protect both J-Link and host computer. Peak current (<= 10 ms) limit is 1A, operating current limit is 300mA.
In any case, it should be possible to use the J-Link software with these OEM versions. How- ever, proper function cannot be guaranteed for OEM versions. SEGGER Microcontrol- ler does not support OEM versions;...
No additional special trace port is required, so that the ETB can be read via J-Link. The trace functionality via J-Link is is limited by the size of the ETB. While capturing runs, the trace information in the buffer will be overwritten every time the buffer size has been reached.
Flash programming J-Link / J-Trace comes with a DLL, which allows - amongst other functionalities - reading and writing RAM, CPU registers, starting and stopping the CPU, and setting breakpoints. The standard DLL does not have API functions for flash programming.
Page 100
RDI, (Remote debug interface) is a standard for "debug transfer agents" such as J- Link. It allows using J-Link from any RDI compliant debugger. RDI by itself does not include download to flash. To debug in flash, you need to somehow program your application program (debuggee) into the flash.
Every time you connect to J-Link / J-Trace, JLinkARM.dll checks if its embedded firm- ware is newer than the one used the J-Link / J-Trace. The DLL will then update the firmware automatically. This process takes less than 3 seconds and does not require a reboot.
Support and FAQs This chapter contains troubleshooting tips together with solutions for common prob- lems which might occur when using J-Link / J-Trace. There are several steps you can take before contacting support. Performing these steps can solve many problems and often eliminates the need for assistance.
12. Start JLink.exe. 13. If JLink.exe displays the J-Link / J-Trace serial number and the target proces- sor’s core ID, the J-Link / J-Trace is working properly and cannot be the cause of your problem. 14. If JLink.exe is unable to read the target processor’s core ID you should analyze the communication between your target and J-Link / J-Trace with a logic analyzer or oscilloscope.
J-Link / J-Trace and the target device. 9.2.1 Start sequence This is the signal sequence output by J-Link / J-Trace at start of JLink.exe. It should be used as reference when tracing potential J-Link / J-Trace related hardware prob- lems.
General procedure on page 108. You may also try your J-Link / J-Trace with another PC and if possible with another target system to see if it works there. If the device functions correctly, the USB setup on the original machine or your target hardware is the source of the problem, not J-Link / J-Trace.
Can J-Link / J-Trace read back the status of the JTAG pins? Yes, the status of all pins can be read. This includes the outputs of J-Link / J-Trace as well as the supply voltage, which can be useful to detect hardware problems on the target system.
Page 114
Glossary Adaptive clocking A technique in which a clock signal is sent out by J-Link / J-Trace. J-Link / J-Trace waits for the returned clock before generating the next clock pulse. The technique allows the J-Link / J-Trace interface unit to adapt to differing signal drive capabilities and differing cable lengths.
Page 116
The electronic clock signal which times data on the TAP data lines TMS, TDI, and TDO. The electronic signal input to a TAP controller from the data source (upstream). Usu- ally, this is seen connecting the J-Link / J-Trace Interface Unit to the first TAP control- ler. J-Link / J-Trace User Guide...
Page 117
The electronic signal output from a TAP controller to the data sink (downstream). Usually, this is seen connecting the last TAP controller to the J-Link / J-Trace Inter- face Unit. Test Access Port (TAP) The port used to access a device's TAP Controller. Comprises TCK, TMS, TDI, TDO, and nTRST (optional).
Need help?
Do you have a question about the J-Link and is the answer not in the manual?
Questions and answers