Phaedsys has now closed |
J-Link is a small JTAG Emulator for ARM cores. It connects via USB to the Windows (2000/XP) PC host.
Different software products are available for J-Link and are listed in the table below.
Type |
Description |
J-Link Tunnel Mode provides remote debugging over the internet even if the target sits behind a firewall. |
|
RDI software for J-Link |
|
J-Link software supporting software breakpoints in flash |
|
makes the entire functionality of J-Link available through the exported functions |
|
An enhanced version of the JLinkARM.DLL, which contains additional API functions for Flash programming. |
|
Flash programming software for ARM cores |
|
Translates the GDB monitor commands into J-Link commands |
|
J-Scope is J-link add on software to analyse and visualize data on a microcontroller in real-time, while the target is running. |
|
With RTT it is possible to output information from the target micro controller as well as sending input to the application at a very high speed without affecting the target's real time behaviour. |
|
J-Link Debugger is a full-featured graphical debugger for embedded applications. THIS IS IN BETA PHASE |
J-Scope is J-link add on software to analyze and visualize data on a microcontroller in real-time, while the target is running. It does not require features like SWO or any extra pin on the target, but uses the available standard debug port.
J-Scope can show the value of multiple variables in an oscilloscope-like style. It reads an elf file and allows selection of a number of variables to visualize. You can simply connect the target microcontroller to your J-Link, flash your application and start J-Scope.
With a few steps you can configure J-Scope, and select the symbols to be shown. The configuration can be stored in project files for easy re-use and portability.
Each symbol selected in J-Scope can be configured separately. Move the graph up and down to change the zero-base-line or change its resolution. Choose whether to visualize the symbol in the graph or only show its value in the watch panel. Analyze the collected data, scroll through the visualized graphs, zoom in and out or save the data to a file for further analysis.
J-Scope can be used in parallel to your debugging environment and extends your IDE's debugging experience.
J-Scope is part of the J-Link Software and Documentation Package (JScope.exe). Start J-Scope by double-clicking on the executable. In the configuration dialogue, select your elf-file. For most targets, the configuration does not have to be specified. If there are any problems, select your target device and configure the interface accordingly. Click OK. The Symbol Selection Dialogue opens.
Select the symbols of your application, you want to watch and Analyze. Click OK to start J-Scope.
Data sampling can be started via the record-button(red dot) in the toolbar.
The configuration of elf-file and selected symbols can be saved into a J-Scope Project to be easily reused.
J-Scope Projects can be opened via the menu or simply dropping them onto the executable.
For more information about how to use J-Scope, please refer to the J-Link User Guide (UM08001).
J-Scope uses the High-Speed Sampling feature (HSS) of J-Link which allows to periodically read data from a target microcontroller without stopping it.
HSS does not require any additional pin, like needed for SWO, on the target. Everything is done via the JTAG / SWD connection.
HSS can only be used on targets which allow background memory access. Which are Cortex-M and Renesas RX targets.
This allows non-intrusive analysis of the data without breaking any real-time behaviour of the target application.
To use HSS , only a J-Link is required. For best results and experience, a J-Link PRO / ULTRA+ is recommended.
J-Scope and HSS can be used with any target, which is supported by J-Link and allows background memory access while the target is running.
Core |
HSS |
---|---|
ARM7, ARM9, ARM11 |
|
Cortex-M0, Cortex-M1, Cortex-M3, Cortex-M4 |
|
Cortex-A, Cortex-R |
|
RX100, RX200, RX600 |
|
PIC32 |
J-Link Model |
Max. no. of variables |
Max. sampling frequency |
---|---|---|
J-Link PRO (V4 or later) |
100 |
Unlimited1 |
J-Link ULTRA+ (V4 or later) |
100 |
Unlimited1 |
J-Link PLUS (V9 or later) |
10 |
1 kHz |
J-Link BASE (V9 or later) |
10 |
1 kHz |
J-Link EDU (V9 or later) |
10 |
1 kHz |
Other models |
10 |
50 Hz2 |
1: Only limit is the bandwidth of the debug interface
2: Emulated via PC. No built-in firmware / hardware support
SEGGER's Real Time Terminal (RTT) is the new technology for interactive user I/O in embedded applications.
With RTT it is possible to output information from the target microcontroller as well as sending input to the application at a very high speed without affecting the target's real time behaviour.
RTT supports multiple up (to the host) and down (to the target) channels to write and read data of different kinds. The default implementation uses one channel per direction:
Channel | Typical Purpose |
---|---|
Up-channel 0 | Terminal output |
Down-Channel 0 | Keyboard input |
Data from Up-channel 0 can be read via a Telnet connection to localhost:19021, which is opened by the J-Link software locally on the computer, when the J-Link is active. The Telnet connection also receives keyboard input for Down-channel 0.
The J-Link RTT Client, which automatically connects and re-connects to an open J-Link connection is part of the J-Link Software and Documentation Pack and can be used instead of a simple Telnet client.
SEGGER RTT can be used with any J-Link model and any supported target processor which allows background memory access, which are Cortex-M and RX targets.
Real Time Terminal uses one ring buffer per channel, and corresponding data structures describing their state in the target system’s memory. Up and down channels can be configured separately.
The data to be written to the host is stored in the buffer in the target's memory. The data structures are periodically monitored by the J-Link probe and the buffer content is read only when necessary.
Data from the host is written by the J-Link to the In-buffer in the target's memory and can be read from there by the embedded application.
RTT does not need any additional pin or hardware, despite the J-Link connected via the standard debug port to the target. It does not require any configuration of the target or in the debugging environment and can even be used with varying target speeds.
SEGGER RTT can be used in parallel to a running debug session, without intrusion, as well as without any IDE or debugger at all.
A simple Telnet Client can be attached to any instance of J-Link.
The performance of SEGGER RTT is significantly higher than any other technology used to output data to a host PC. An average line of text can be output in one microsecond or less. Basically only the time to do a single memcopy(),
The speed comparison was done on an STM32F407 Cortex-M4 running at 168 MHz using IAR EWARM and IAR's standard libraries for printf() via SWO and Semihosting. Overhead for printf() calls removed.
The SEGGER RTT implementation is written in ANSI C and can be integrated into any embedded application using the code, available for download below.
RTT can be used via a simple and easy to use API. It is even possible to override the standard printf() functions to use RTT. Using RTT reduces the time taken for printf() to a minimum and allows printing debug-information to the host PC, while the application is performing time critical, real time tasks.
The SEGGER RTT implementation includes a simple implementation of printf() which can be used to write a formatted string via RTT. SEGGER_RTT_Printf() is smaller than most standard library printf implementations and does not require heap and only a configurable amount of stack.
The SEGGER RTT implementation is fully configurable with pre-processor defines. Reading and writing can be made task-safe with Lock() and Unlock() routines, the number of buffers, as well as the size of the terminal buffers can be set up easily
Function Name |
Description |
---|---|
SEGGER_RTT_Read() |
Read data from an input buffer. |
SEGGER_RTT_Write() |
Write data to an output buffer. |
SEGGER_RTT_WriteString() |
Write a zero-terminated string to an output buffer. |
SEGGER_RTT_printf() |
Write a formatted string to an output buffer. |
SEGGER_RTT_GetKey() |
Get one character from input buffer 0. |
SEGGER_RTT_HasKey() |
Check if a character is available in input buffer 0. |
SEGGER_RTT_WaitKey() |
Wait for a character to be available in input buffer 0 and get it. |
SEGGER_RTT_ConfigUpBuffer() |
Configure an up (output) buffer. |
SEGGER_RTT_ConfigDownBuffer() |
Configure a down (input) buffer. |
Memory |
Usage |
---|---|
ROM Usage |
~500 Bytes |
RAM Usage |
24 Bytes fixed + (24 + SizeofBuffer) Bytes / channel |
Download RTT Implementation and Sample Code
RTT is kept as simple as possible and can be used without any configuration.
/********************************************************************* * SEGGER MICROCONTROLLER GmbH & Co KG * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 2014 SEGGER Microcontroller GmbH & Co KG * * * * www.segger.com Support: support@segger.com * * * ********************************************************************** ---------------------------------------------------------------------- File : RTT.c Purpose : Simple implementation for output via RTT. It can be used with any IDE. -------- END-OF-HEADER --------------------------------------------- */ #include "SEGGER_RTT.h" static void _Delay(int period) { int i = 100000*period; do { ; } while (i--); } int main(void) { do { SEGGER_RTT_WriteString(0, "Hello World from SEGGER!\r\n"); _Delay(100); } while (1); return 0; } /*************************** End of file ****************************/
The low-level functions used in libraries for printf() can often be easily overridden, to provide own output functions.
The SEGGER RTT implementation pack includes the required code for GCC/Newlib, IAR and KEIL MDK which can simply be included in the project to retarget printf() to output the data via RTT.
Additionally the SEGGER RTT implementation pack includes a simplified version of printf(), SEGGER_RTT_printf(), which can be used to print formatted strings via RTT, directly, without a standard library.
RTT can be used with any target, which is supported by J-Link and allows background memory access while the target is running.
Core | RTT |
---|---|
Cortex-M0, Cortex-M1, Cortex-M3, Cortex-M4 | |
RX100, RX200, RX600 |
Instead of running an external Telnet client, RTT can also be directly integrated in any PC application, like a debugger, in either of two ways.
The application can either establish a socket connection to the RTT Telnet Server (listening on localhost:19021)
or use the J-Link RTT API which is part of the J-Link SDK, to directly configure RTT and get / send data.
Q: |
How does J-Link find the RTT buffer? |
A: | There are 2 ways: If the Debugger (IDE) knows the address of the SEGGER_RTT structure, it passes it to J-Link. This is for example done by J-Link Debugger. If an other debugger that is not SEGGER-RTT aware is used, such as IAR's Embedded Workbench or emIDE, then J-Link searches for the ID in the known target RAM during execution of the program, transparently in the background. The process of locating the ID string takes just fractions of a second and does not delay program execution. |
|
|
Q: | Can this also be used on targets that do not have the SWO pin? |
A: | Yes, the debug interface is used. This can be JTAG or SWD (2pins only!) on most Cortex-M devices, or even the FINE interface on some Renesas devices, just like the Infineon SPD interface (single pin!) |
|
|
Q: |
Can this also be used on Cortex-M0 and M0+? |
A: | Yes. |
|
|
Q: |
Some terminal output (printf) Solutions "crash" program execution when executed outside of the debug environment, because they use a Software breakpoint that triggers a hardfault without debugger or halt because SWO is not initialized. That makes it impossible to run a Debug-build in stand-alone mode. |
A: | SEGGER-RTT uses non-blocking mode per default, which means it does not halt program execution if no debugger is present and J-Link is not even connected. The application program will continue to work. |
J-Link Debugger is currently in an open beta phase. There might be some limitations in functionality. To get information about updates and new versions, subscribe to the J-Link Debugger update notification list.
J-Link Debugger is a full-featured graphical debugger for embedded applications.
With J-Link Debugger it is possible to debug any embedded application on C source and assembly level. J-Link Debugger can load applications built with any toolchain / IDE or debug the target's resident application without any source.
J-Link Debugger includes all needed debug information windows and makes use of the best performance of J-Link debug probes.
The user interface is designed to be used intuitively and is fully configurable. All windows can be moved, re-sized and closed to fit the need of any developer.
Debug Information Windows for any purpose (Disassembly, Memory, Globals and Locals, (Live) Watches, CPU and Peripheral Registers, ...
Fully customizable windows.
Scriptable project files to set up everything automatically. Project files are exchangeable between computers and / or developers to provide the same base and look, machine independent.
New Project Wizard to ease the basic configuration of new projects.
J-Link Debugger is currently available for Windows only.
The setup can be downloaded from the link below and installs J-Link Debugger with just three clicks. Multiple versions of J-Link Debugger can be installed on the same PC without problem, as they can co-exist in different directories. Application settings are shared across the versions.
J-Link Debugger V1.53 for Windows [5,972 kb] md5 checksum: 10F60B5F07FFB6CA09B0BA1A1558D1AD |
When starting J-Link Debugger for the first time, the New Project Wizard will guide through the setup of the first project. Target device, connection settings and the data file can be selected and the project is ready to run a debug session.
When starting J-Link Debugger again, a welcome dialog pops up, to open a recent project, or create a new one.
Debugging with J-Link Debugger can be controlled with the most common keyboard shortcuts or buttons from the toolbars, to be used intuitively.
To start debugging, a J-Link and the target have to be connected to the PC. J-Link Debugger can download the application code, if there is a file selected, to the target.
A debug session is started with F5 or the green On/Off button from the toolbar.
After starting, the code is downloaded and the application is reset and runs to main(). The reset behaviour can be changed via the System Variables.
J-Link Debugger features the most usable debug information windows to give full overview and control over the target application.
The Source Viewer highlights the current line of execution and gives information about the application. The instructions to be executed can also be shown in the Disassembly. J-Link Debugger allows stepping on source level, as well as on instruction level.
The Memory, Global, Local and Watched Data and the Registers Windows show information about the current state and content of the target. The data can also be written and changed from any of these windows.
J-Link Debugger includes a Terminal which allows communication with the target in the most common ways. It can display SWO data, handle semihosting commands and even show output and send input with SEGGER's Real Time Terminal.
J-Link Debugger can be controlled via keyboard shortcuts and mouse interaction with the GUI.
Additionally J-Link Debugger provides console based control commands. These commands can be executed via the Console of J-Link Debugger. Each command which is executed via keyboard or mouse action is shown in the Console to allow easy copy&paste of commands.
Command | Parameter | Shortcut | Action |
---|---|---|---|
help.about |
| F1 | Show about dialog |
console.help |
|
| Show available commands |
debug.start / debug.continue |
| F5 | Start / Resume Debugging |
debug.stop |
| Shift - F5 | End Debugging |
debug.stepinto |
| F10 | Next source line / instruction |
debug.stepover |
| F11 | Step into source line / instruction |
debug.stepout |
| Shift - F11 | Step out of function |
break.set / break.clear | Address | F9 | Set / Clear breakpoint on current line / instruction |
break.enable / break.clear | Address | F8 | Temporaryly Disable / Enable breakpoint |
set.cpu | CPU name |
| Set target's CPU name |
set.device | Target name |
| Set target's device name |
set.hostif | [USB|IP] |
| Set host interface |
set.targetif | [JTAG|SWD] |
| Set target interface |
set.tifspeed | "[0-50000] [Hz|kHz|MHZ]" |
| Set target interface speed |
This example project file shows the necessary commands to be able to start a debug session:
set.device STM32F407IE set.cpu Cortex-M4 set.hostif USB set.targetif SWD set.tifspeed "4 Mhz" file.open "C:/Project/Output/Start_STM32.elf"
J-Link Debugger is currently in an open beta phase and continuously under development.
Following limitations are currently known and will be lifted in the official release version:
Cortex-M support only.
Some commands cannot be executed anytime.
Local variables in the Watch Window are evaluated even in other call frames.
Step out of functions with no source info does not break after stepping out.
Following features and improvements are planned for future versions:
Software version for Mac OSX and Linux
Support for ARM7/9, Cortex-A/R
Support for Renesas RX
Improved command scripting
Remote Debugging via the SEGGER J-Link is possible over the internet even if the target sits behind a firewall using J-Link Tunnel Mode, it is now possible to quickly access a J-Link connected to a PC on a remote network. Software development of a product can be done in multiple locations and without regards to the location of the target hardware, as is often necessary.
The PC (Server) hosting the connected J-Link and target hardware needs nothing more. All that is required is a running instance of the SEGGER J-Link Remote Server in Tunnel Mode. Once the JLink is connected, the SEGGER Tunnel Server (Tunnel) offers up the J-Link for a remote debugging session. The user of the remote PC (Client) may then connect via the Tunnel Server to the desired J-Link and target hardware. From the engineers perspective, it is as if the hardware is on their desk.
The JLink-RDI software is an RDI interface for J-Link. It makes it possible to use J-Link with any RDI compliant debugger. The package consists of 2 DLLs, which need to be copied to the same folder. In order to use these DLLs, they need to be selected in the debugger. It is a separate item and not included in the J-Link software.
The J-Link RDI software contains an add. feature, called Flash break points (short FlashBPs). This feature requires an add. license. It adds the ability to set an unlimited number of software breakpoints in flash memory areas, rather than just the 2 hardware breakpoints.
How do breakpoints work?
There are basically 2 types of breakpoints in a computer system: Hard ones and soft ones. Hard BPs require a dedicate hardware unit for every hardware breakpoint. In other words, the hardware dictates how many hardware breakpoints can be set simultaneously. ARM7 and ARM 9 cores have 2 breakpoint units (called "watchpoint units" in ARM's documentation), allowing 2 hardware breakpoints to be set. Hardware breakpoints do not require modification of the program code. Software breakpoints are different: The debugger modifies the program and replaces the breakpointed instruction with a special value. Add. soft BPs do not require add. hardware units in the processor, since simply more instructions are replaced. This is a standard procedure that most debuggers are capable of, however, it requires the program to be located in RAM.
What is special about software breakpoints in flash ?
It allows you to set an unlimited number of breakpoints even if your application program is not located in RAM, but in Flash memory. This is a scenario which was very rare before ARM-microcontrollers hit the market. This new technology makes very powerful, yet inexpensive ARM microcontrollers available for systems, which required external RAM before. The downside of this new technology is that it is not possible to debug larger programs on these Micros in RAM, since the RAM is not big enough to hold program and data (typically, these chips contain about 4 times as much flash as RAM), and therefore with standard debuggers, only 2 breakpoints can be set. The 2 breakpoint limit makes debugging very tough; a lot of times the debugger requires 2 breakpoints to simply step over a line of code. With software breakpoints in Flash, this limitation is gone.
How does this work ?
Basically 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; on micros with fast flash the difference between breakpoints in RAM and Flash is hardly noticeable
How is this performance achieved ?
We have put a lot of effort in making FlashBPs really usable and convenient. Flash sectors are programmed only when necessary; this is usually the moment execution of the target program is started. A lot of times, more then one breakpoint is located in the same flash sector, which allows programming multiple breakpoints by programming just a single sector. The contents of program memory are cached, avoiding time consuming reading of the flash sectors. A smart combination of software and hardware breakpoints allows us to use hardware breakpoints a lot of times, especially when the debugger is source level-stepping, avoiding reprogramming of the flash in these situations. A built-in instruction set simulator further reduces the number of flash operations which need to be performed. This minimizes delays for the user, maximizing the life time of the flash. All resources of the ARM micro are available to the application program, no memory is lost for debugging. All of the optimizations described above can be disabled.
The J-Link DLL is a standard Windows DLL typically used from "C" (Visual Basic or Delphi projects are also doable). It makes the entire functionality of J-Link available thru 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 an ARM core. Sample applications are a memory viewer, DCC communication program, Debugger or flash programming tool, such as J-Flash as well as a small command line program Jlink.exe, which is also available in source code form.
The standard DLL does not have API functions for flash programming. However, the functionality offered can be used to program the flash. In that case a flashloader is required
.
What do I need to write my own program with J-Link?
The J-Link SDK is needed if you want to write your own program with J-Link. The listed files in the table below are included in the J-Link SDK. For more information on how to obtain a license please contact us
Files |
Contents |
GLOBAL.h |
Header files that must be included to use the DLL functions. These files contain the defines, typedefs and function declarations. |
JLinkARM.lib |
Library contains the exports of the JLinkDLL. |
JLinkARM.dll |
The DLL itself. |
main.c |
Sample application, which calls some JLinkARM DLL functions. |
JLink.dsp |
Project files of the sample application. Double click "JLink.dsw" to open the project. |
JLink.exe |
Compiled version of the sample application. |
JLinkARMDLL.pdf |
Documentation. |
Release.html |
Release notes. |
JMem.exe |
Life memory viewer (Displays content of target memory). |
JLinkServer.exe |
J-Link TCP/IP server (allows using J-Link via TCP/IP networks). |
jlink.inf |
J-Link ARM USB driver. |
Requirements
The following items are required to develop software for J-Link:
PC running Win2K or XP
J-Link A RM
ARM target system
x86 compiler, linker, opt. IDE
Development environment (compiler)
Any "C/C++" compiler will do. Workspace (Project) file is for Microsoft Visual Studio (V6.0) or Visual Studio .net (V7.0 or newer).
Other compilers will work as well, but no example workspace is provided
An enhanced version of the J-Link SDK, which contains additional API functions for Flash programming. The add. API functions (Prefixed JLINKARM_FLASH_) allow erasing and programming the flash memory. This DLL comes with a sample executable, as well as with source code of this executable and a project file. It can be an interesting option if you want to write your own programs for production purposes. This DLL also requires an extra license from SEGGER; please contact us for more information.
Additional API functions included in the Flash SDK
The following table lists the additional Flash SDK API routines:
Flash functions |
|
---|---|
Routine |
Explanation |
JLINKARM_FLASH_AddBank() |
Adds a flash bank. |
JLINKARM_FLASH_DelBank() |
Deletes a flash bank. |
JLINKARM_FLASH_SetBankPara() |
Sets a bank parameter. |
JLINKARM_FLASH_SetClockSpeed() |
Sets the CPU clock speed. |
JLINKARM_FLASH_EraseRequired() |
Erases all required sectors to program data file. |
JLINKARM_FLASH_Program() |
Programs data file into flash memory. |
JLINKARM_FLASH_Verify() |
Compares data file with memory content. |
JLINKARM_FLASH_OpenDataFile() |
JLINKARM_FLASH_OpenDataFile() Opens a data file. |
JLINKARM_FLASH_CloseDataFile() |
Closes a data file. |
JLINKARM_FLASH_GetNumLoadedBytes() |
JLINKARM_FLASH_GetNumLoadedBytes() Returns number of bytes in data file. |
J-Flash is a PC software running on Windows 2000/XP systems, which enables you to program your Flash EEPROM devices via the On-Chip Debug connector (JTAG) on your target system.
A J-Link hardware, which connects via USB interface with the PC, is needed. J-Flash works with any ARM7/9 system and supports all common external flashes, as well as the programming of internal flash of ARM microcontrollers.
It allows you to ERASE, FILL, Program BLANK CHECK, CHECKSUM, UPLOAD flash content, and VIEW MEMORY functions of the software with your flash devices. Purchasing a license will turn off the time limitation.
Features
Works with any ARM7 / ARM9 and Cortex-M3 chip
ARM microcontrollers (internal flash) supported
most external flash chips can be programmed (See list of supported devices)
High speed programming: up to 150 kByte/sec (dep. on flash device)
Very high speed blank check: App. 16 Mybte /sec (depends on target)
Smart read-back: Only non blank-portions of flash transferred and saved
Free 30 day trial version available
Easy to use, comes with projects for standard eval boards
GDB / GDB Server overview
The GNU Project Debugger (GDB) is a freely available debugger, distributed under the terms of the GPL. It connects to an emulator via a TCP/IP connection. It can connect to every emulator for which a GDB server software is available. The latest Unix version of the GDB is freely available from the GNU commitee under: http://www.gnu.org/software/gdb/download/
Hardware requirements
To use the J-Link GDB Server, you have to meet the following hardware requirements:
PC running Win2K / XP
USB port
J-Link / J-Trace
User interface
The J-Link GDB Server's user interface shows information about the debugging process and the target connected via JTAG.
It shows:
host IP address, that is connected to the J-Link GDB Server
connection status of J-Link
information about the target core
measured target voltage
bytes that have been downloaded
status of target
log output of the J-Link GDB Server (optional, if log window is checked)
initial and current JTAG speed
target endianess
J-Link GDB Server supports several remote commands from the GDB. This commands can be used from within a gdbinit file or the GDB console to initialize the target board and to setup J-Link GDB Server specific parameters.
Remote command |
Explanation |
ClrBP |
Removes an instruction breakpoint. |
Endian |
Sets endianess of the target. |
Go |
Starts the target CPU. |
Halt |
Halts the target CPU. |
JTAGConf |
Configures a JTAG scan chain with multiple devices on it. |
Long |
Reads or writes from/to given address. |
Reg |
Reads or writes from/to given register. |
Reset |
Resets and halts the target CPU. |
Select |
Selects the way J-Link is connected to host system. |
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. |
WaitHalt |
Waits for target to halt code execution. |
WIce |
Writes to given IceBreaker register. |
Phaedsys has now closed |