Difference between revisions of "J-Link RDI"

From SEGGER Wiki
Jump to: navigation, search
(Configuring to use J-Link RDI)
 
(3 intermediate revisions by the same user not shown)
Line 12: Line 12:
 
% Since we had no request regarding RDI in a long time and no officially supported IDE used the RDI interface, this can be postponed until we eventually decide to invest time into RDI.
 
% Since we had no request regarding RDI in a long time and no officially supported IDE used the RDI interface, this can be postponed until we eventually decide to invest time into RDI.
 
%
 
%
TBD:
 
eliminate {,},\,,...
 
 
------>
 
------>
  +
[[File:JLinkRDI_setup.png | thumb | right | 350px]] <!---- keep this here?? ---->
 
 
RDI (Remote Debug Interface) is a standard defined by ARM, trying to standardize a debugger / debug probe interface.
 
RDI (Remote Debug Interface) is a standard defined by ARM, trying to standardize a debugger / debug probe interface.
 
It is defined only for cores that have the same CPU register set as ARM7 CPUs.
 
It is defined only for cores that have the same CPU register set as ARM7 CPUs.
  +
RDI is an Application Programming Interface (API) that defines a standard set of data structures and functions that abstract hardware for debugging purposes.
  +
J-Link RDI mainly consists of a DLL designed for ARM cores to be used with any RDI compliant debugger.
  +
The J-Link DLL featured flash download and flash breakpoints can also be used with J-Link RDI.
  +
 
This article describes how to use the J-Link RDI DLL which comes with the [[J-Link Software and Documentation Pack]], available for download on the [https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack SEGGER homepage].<br>
 
This article describes how to use the J-Link RDI DLL which comes with the [[J-Link Software and Documentation Pack]], available for download on the [https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack SEGGER homepage].<br>
 
The J-Link RDI DLL allows the user to use J-Link with any RDI-compliant debugger and IDE.
 
The J-Link RDI DLL allows the user to use J-Link with any RDI-compliant debugger and IDE.
Line 26: Line 28:
   
 
'''Note:''' The RDI software (as well as flash breakpoints and flash downloads) do not require a license if the target device is an LPC2xxx.
 
'''Note:''' The RDI software (as well as flash breakpoints and flash downloads) do not require a license if the target device is an LPC2xxx.
 
 
<div class="toclimit-2">
 
<div class="toclimit-2">
 
__TOC__
 
__TOC__
</div>
+
</div><br clear=all>
  +
= Features =
 
= Introduction =
 
Remote Debug Interface (RDI) is an Application Programming Interface (API) that defines a standard set of data structures and functions that abstract hardware for debugging purposes.
 
J-Link RDI mainly consists of a DLL designed for ARM cores to be used with any RDI compliant debugger.
 
The J-Link DLL feature flash download and flash breakpoints can also be used with J-Link RDI.
 
[[File:JLinkRDI_setup.wmf]] <!---- keep this here?? ---->
 
 
== Features ==
 
 
* Can be used with every RDI compliant debugger.
 
* Can be used with every RDI compliant debugger.
 
* Easy to use.
 
* Easy to use.

Latest revision as of 09:27, 16 July 2020

JLinkRDI setup.png

RDI (Remote Debug Interface) is a standard defined by ARM, trying to standardize a debugger / debug probe interface. It is defined only for cores that have the same CPU register set as ARM7 CPUs. RDI is an Application Programming Interface (API) that defines a standard set of data structures and functions that abstract hardware for debugging purposes. J-Link RDI mainly consists of a DLL designed for ARM cores to be used with any RDI compliant debugger. The J-Link DLL featured flash download and flash breakpoints can also be used with J-Link RDI.

This article describes how to use the J-Link RDI DLL which comes with the J-Link Software and Documentation Pack, available for download on the SEGGER homepage.
The J-Link RDI DLL allows the user to use J-Link with any RDI-compliant debugger and IDE.

There are two additional features available which build on the RDI software foundation. Each additional feature requires an RDI license in addition to its own license. Evaluation licenses are available free of charge. For further information go to our website or contact us directly.

Note: The RDI software (as well as flash breakpoints and flash downloads) do not require a license if the target device is an LPC2xxx.


Features

  • Can be used with every RDI compliant debugger.
  • Easy to use.
  • Flash download feature of J-Link DLL is available.
  • Flash breakpoints feature of J-Link DLL is available.
  • Instruction set simulation (improves debugging performance).

Licensing

In order to use the J-Link RDI software a license is necessary for each J-Link. For some devices J-Link comes with a device-based license. All J-Link models above J-Link BASE come with a full license for J-Link RDI. For more information about licensing itself and which devices have a device-based license, please refer to the SEGGER homepage

Setup for various debuggers

J-Link RDI consists of an additional DLL (JLinkRDI.dll) which builds the interface between the RDI API and the normal J-Link DLL.

Please refer to Getting Started with Various IDEs for information on how to get started with any IDE officially supported by J-Link / J-Trace. If official support is not implemented natively but via RDI, the RDI setup procedure will also be explained there.
In the following, the RDI setup procedure for a few not officially supported IDEs is explained.

ARM AXD (ARM Developer Suite, ADS)

Software version

The JLinkRDI.dll has been tested with ARM's AXD version 1.2.0 and 1.2.1. There should be no problems with other versions of ARM's AXD. All screenshots are taken from ARM's AXD version 1.2.0.

Configuring to use J-Link RDI

  1. Start the ARM debugger and select Options | Configure Target.... This opens the Choose Target dialog box:
    jlinkrdi axd 01.gif
  2. Press the Add Button to add the JLinkRDI.dll.
    jlinkrdi axd 02.gif
  3. Now J-Link RDI is available in the Target Environments list:
    jlinkrdi axd 03.gif
  4. Select J-Link and press OK to connect to the target via J-Link.
    For more information about the generic setup of J-Link RDI, please refer to Configuration.
    After downloading an image to the target board, the debugger window looks as follows:
    jlinkrdi axd 05.gif

ARM RVDS (RealView developer suite)

Software version

J-Link RDI has been tested with ARM RVDS version 2.1 and 3.0. There should be no problems with earlier versions of RVDS (up to version v3.0.1). All screenshots are taken from ARM's RVDS version 2.1.
Note: RVDS version 3.1 does not longer support RDI protocol to communicate with the debugger.

Configuring to use J-Link RDI

  1. Start the Real View debugger:
    jlinkrdi rvds 01.gif
  2. Select File | Connection | Connect to Target.
    jlinkrdi rvds 02.gif
  3. In the Connection Control dialog use the right mouse click on the first item and select Add/Remove/Edit Devices.
    jlinkrdi rvds 03.gif
  4. Now select Add DLL to add the JLinkRDI.dll. Select the installation path of the software, for example: C:\Program Files\SEGGER\JLinkARM_V350g\JLinkRDI.dll
    jlinkrdi rvds 04.gif
  5. After adding the DLL, an additional Dialog opens and asks for description: (These values are voluntary, if you do not want change them, just click OK) Use the following values and click on OK:
    • Short Name: JLinkRDI
    • Description: J-Link RDI Interface.
    jlinkrdi rvds 06.gif
  6. Back in the RDI Target List Dialog, select JLink-RDI and click Configure. For more information about the generic setup of J-Link RDI, please refer to Configuration.
    jlinkrdi rvds 07.gif
  7. Click the OK button in the configuration dialog. Now close the RDI Target List dialog. Make sure your target hardware is already connected to J-Link.
  8. In the Connection control dialog, expand the JLink ARM RDI Interface and select the ARM_0 processor. Close the Connection Control window.
    jlinkrdi rvds 08.gif
  9. Now the RealView Debugger is connected to J-Link.
    jlinkrdi rvds 09.gif
  10. A project or an image is needed for debugging. After downloading, J-Link is used to debug the target.
    jlinkrdi rvds 10.gif

GHS MULTI

Software version

J-Link RDI has been tested with GHS MULTI version 4.07. There should be no problems with other versions of GHS MULTI. All screenshots are taken from GHS MULTI version 4.07.

Configuring to use J-Link RDI

  1. Start Green Hills Software MULTI integrated development environment. Click Connect | Connection Organizer to open the Connection Organizer.
    GHS Multi 01.gif
  2. Click Method | New in the Connection Organizer dialog.
  3. The Create a new Connection Method will be opened. Enter a name for your configuration in the Name field and select Custom in the Type list. Confirm your choice with the Create... button.
    GHS Multi 02.gif
  4. The Connection Editor dialog will be opened. Enter rdiserv in the Server field and enter the following values in the Arguments field:
    -config -dll <FullPathToJLinkDLLs>
    Note that JLinkRDI.dll and JLinkARM.dll must be stored in the same directory. If the standard J-Link installation path or another path that includes spaces has been used, enclose the path in quotation marks.
    Example:
    -config -dll "C:\Program Files\SEGGER\JLinkARM_V350g\JLinkRDI.dll"
    Refer to GHS manual "MULTI: Configuring Connections for ARM Targets", chapter "ARM Remote Debug Interface (rdiserv) Connections" for a complete list of possible arguments.
    GHS Multi 03.gif
  5. Confirm the choices by clicking the Apply button after the Connect button.
    GHS Multi 04.gif
  6. The J-Link RDI Configuration dialog will open. For more information about the generic setup of J-Link RDI, please refer to Configuration.
  7. Click the OK button to connect to the target. Build the project and start the debugger. Note that at least one action (for example step or run) has to be performed in order to initiate the download of the application.
    GHS Multi 06.gif

Configuration

This section describes the generic setup of J-Link RDI (same for all debuggers) using the J-Link RDI configuration dialog.

Configuration file JLinkRDI.ini

All settings are stored in the file JLinkRDI.ini. This file is located in the same directory as JLinkRDI.dll.

Using different configurations

It can be desirable to use different configurations for different targets. If this is the case, a new folder needs to be created and the JLinkARM.dll as well as the JLinkRDI.dll needs to be copied into it.
Project A needs to be configured to use JLinkRDI.dll A in the first folder, project B needs to be configured to use the DLL in the second folder. Both projects will use separate configuration files, stored in the same directory as the DLLs they are using.
If the debugger allows using a project-relative path (such as IAR EWARM: Use for example $PROJ_DIR$\RDI\), it can make sense to create the directory for the DLLs and configuration file in a subdirectory of the project.

Using multiple J-Links simultaneously

Same procedure as using different configurations. Each debugger session will use their own instance of the JLinkRDI.dll.

Configuration dialog

The configuration dialog consists of several tabs making the configuration of J-Link RDI very easy.

General tab

jlinkrdi config1.gif

Connection to J-Link

This setting allows the user to configure how the DLL should connect to the J-Link. Some J-Link models also come with an Ethernet interface which allows to use an emulator remotely via TCP/IP connection.

License (J-Link RDI License management)

  1. The License button opens the J-Link RDI License management dialog. J-Link RDI requires a valid license.
    JLnkRDI LicenseManagement 01.gif
  2. Click the Add license button and enter your license. Confirm your input by clicking the OK button.
    JLnkRDI LicenseManagement 02.gif
  3. The J-Link RDI license is now added.
    JLnkRDI LicenseManagement 04.gif
  4. Init tab

    jlinkrdi config2.gif

    Macro file

    A macro file can be specified to load custom settings to configure J-Link RDI with advanced commands for special chips or operations. For example, a macro file can be used to initialize a target to use the PLL before the target application is downloaded, in order to speed up the download.

    Commands in the macro file

    Command Description
    SetJTAGSpeed(x) Sets the JTAG speed,
    x = speed in kHz (0=Auto)
    Delay(x) Waits a given time,
    x = delay in milliseconds
    Reset(x) Resets the target,
    x = delay in milliseconds
    Go() Starts the ARM core
    Halt() Halts the ARM core
    Read8(Addr)
    Read16(Addr)
    Read32(Addr)
    Reads a 8/16/32 bit value,
    Addr = address to read (as hex value)
    Verify8(Addr, Data)
    Verify16(Addr, Data)
    Verify32(Addr, Data)
    Verifies a 8/16/32 bit value,
    Addr = address to verify (as hex value)
    Data = data to verify (as hex value)
    Write8(Addr, Data)
    Write16(Addr, Data)
    Write32(Addr, Data)
    Writes a 8/16/32 bit value,
    Addr = address to write (as hex value)
    Data = data to write (as hex value)
    WriteVerify8(Addr, Data)
    WriteVerify16(Addr, Data)
    WriteVerify32(Addr, Data)
    Writes and verifies a 8/16/32 bit value,
    Addr = address to write (as hex value)
    Data = data to write (as hex value)
    WriteRegister(Reg, Data) Writes a register
    WriteJTAG_IR(Cmd) Writes the JTAG instruction register
    WriteJTAG_DR(nBits, Data) Writes the JTAG data register

    Example of macro file

     
    /*********************************************************************
    *
    *               Macro file for J-LINK RDI
    *
    **********************************************************************
    * File:    LPC2294.setup
    * Purpose: Setup for Philips LPC2294 chip
    **********************************************************************
    */
    SetJTAGSpeed(1000);
    Reset(0);
    Write32(0xE01FC040, 0x00000001); // Map User Flash into Vector area at (0-3f)
    Write32(0xFFE00000, 0x20003CE3); // Setup CS0
    Write32(0xE002C014, 0x0E6001E4); // Setup PINSEL2 Register
    SetJTAGSpeed(2000);
    

    JTAG tab

    jlinkrdi config3.gif

    JTAG speed

    This allows the selection of the JTAG speed. There are basically three types of speed settings (which are explained below):

  • Fixed JTAG speed
  • Automatic JTAG speed
  • Adaptive clocking

JTAG scan chain with multiple devices

The JTAG scan chain allows to specify the instruction register organization of the target system. This may be needed if there are more devices located on the target system than the ARM chip you want to access or if more than one target system is connected to one J-Link at once.

Flash tab

jlinkrdi config4.gif

Enable flash programming

This checkbox enables flash programming. Flash programming is needed to use either flash download or flash breakpoints.
If flash programming is enabled you must select the correct flash memory and flash base address. Furthermore it is necessary for some chips to enter the correct CPU clock frequency.

Cache flash contents

If enabled, the flash content is cached by the J-Link RDI software to avoid reading data twice and to speed up the transfer between debugger and target.

Allow flash download

This allows the J-Link RDI software to download program into flash. A small piece of code will be downloaded and executed in the target RAM which then programs the flash memory. This provides flash loading abilities even for debuggers without a build-in flash loader.
An info window can be shown during download displaying the current operation. Depending on your JTAG speed you may see the info window only very short.

jlinkrdi config7.gif

Breakpoints tab

jlinkrdi config5.gif

Use software breakpoints

This allows to set an unlimited number of breakpoints if the program is located in RAM by setting and resetting breakpoints according to program code.

Use flash breakpoints

This allows to set an unlimited number of breakpoints if the program is located either in RAM or in flash by setting and resetting breakpoints according to program code.
An info window can be displayed while flash breakpoints are used showing the current operation. Depending on your JTAG speed the info window may hardly to be seen.

jlinkrdi config8.gif

CPU tab

jlinkrdi config6.gif

Instruction set simulation

This enables instruction set simulation which speeds up single stepping instructions especially when using flash breakpoints.

Reset strategy

This defines the way J-Link RDI should handle resets called by software.
J-Link supports different reset strategies. This is necessary because there is no single way of resetting and halting an ARM core before it starts to execute instructions.
For more information about the different reset strategies which are supported by J-Link and why different reset strategies are necessary, please refer to Reset strategies.

Log tab

A log file can be generated for the J-Link DLL and for the J-Link RDI DLL. This log files may be useful for debugging and evaluating. They may help you to solve a problem yourself, but is also needed by customer support help you.
Default path of the J-Link log file: c:\JLinkARM.log
Default path of the J-Link RDI log file: c:\JLinkRDI.log

Example log-file content

060:028 (0000) Logging started @ 2005-10-28 07:36
060:028 (0000) DLL Compiled: Oct 4 2005 09:14:54
060:031 (0026) ARM_SetMaxSpeed - Testing speed 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0F 3F0F0F0FAuto JTAG speed: 4000 kHz
060:059 (0000) ARM_SetEndian(ARM_ENDIAN_LITTLE)
060:060 (0000) ARM_SetEndian(ARM_ENDIAN_LITTLE)
060:060 (0000) ARM_ResetPullsRESET(ON)
060:060 (0116) ARM_Reset(): SpeedIsFixed == 0 -> JTAGSpeed = 30kHz >48> >2EF>
060:176 (0000) ARM_WriteIceReg(0x02,00000000)
060:177 (0016) ARM_WriteMem(FFFFFC20,0004) -- Data: 01 06 00 00 - Writing 0x4 bytes @ 0xFFFFFC20 >1D7>
060:194 (0014) ARM_WriteMem(FFFFFC2C,0004) -- Data: 05 1C 19 00 - Writing 0x4 bytes @ 0xFFFFFC2C >195>
060:208 (0015) ARM_WriteMem(FFFFFC30,0004) -- Data: 07 00 00 00 - Writing 0x4 bytes @ 0xFFFFFC30 >195>
060:223 (0002) ARM_ReadMem (00000000,0004)JTAG speed: 4000 kHz -- Data: 0C 00 00 EA
060:225 (0001) ARM_WriteMem(00000000,0004) -- Data: 0D 00 00 EA - Writing 0x4 bytes @ 0x00000000 >195>
060:226 (0001) ARM_ReadMem (00000000,0004) -- Data: 0C 00 00 EA
060:227 (0001) ARM_WriteMem(FFFFFF00,0004) -- Data: 01 00 00 00 - Writing 0x4 bytes @ 0xFFFFFF00 >195>
060:228 (0001) ARM_ReadMem (FFFFF240,0004) -- Data: 40 05 09 27
060:229 (0001) ARM_ReadMem (FFFFF244,0004) -- Data: 00 00 00 00
060:230 (0001) ARM_ReadMem (FFFFFF6C,0004) -- Data: 10 01 00 00
060:232 (0000) ARM_WriteMem(FFFFF124,0004) -- Data: FF FF FF FF - Writing 0x4 bytes @ 0xFFFFF124 >195>
060:232 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:233 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:234 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:236 (0000) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:237 (0000) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:238 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:239 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:240 (0001) ARM_ReadMem (FFFFF130,0004) -- Data: 00 00 00 00
060:241 (0001) ARM_WriteMem(FFFFFD44,0004) -- Data: 00 80 00 00 - Writing 0x4 bytes @ 0xFFFFFD44 >195>
060:277 (0000) ARM_WriteMem(00000000,0178) -- Data: 0F 00 00 EA FE FF FF EA ...
060:277 (0000) ARM_WriteMem(000003C4,0020) -- Data: 01 00 00 00 02 00 00 00 ... - Writing 0x178 bytes @ 0x00000000
060:277 (0000) ARM_WriteMem(000001CC,00F4) -- Data: 30 B5 15 48 01 68 82 68 ... - Writing 0x20 bytes @ 0x000003C4
060:277 (0000) ARM_WriteMem(000002C0,0002) -- Data: 00 47
060:278 (0000) ARM_WriteMem(000002C4,0068) -- Data: F0 B5 00 27 24 4C 34 4D ... - Writing 0xF6 bytes @ 0x000001CC
060:278 (0000) ARM_WriteMem(0000032C,0002) -- Data: 00 47
060:278 (0000) ARM_WriteMem(00000330,0074) -- Data: 30 B5 00 24 A0 00 08 49 ... - Writing 0x6A bytes @ 0x000002C4
060:278 (0000) ARM_WriteMem(000003B0,0014) -- Data: 00 00 00 00 0A 00 00 00 ... - Writing 0x74 bytes @ 0x00000330
060:278 (0000) ARM_WriteMem(000003A4,000C) -- Data: 14 00 00 00 E4 03 00 00 ... - Writing 0x14 bytes @ 0x000003B0
060:278 (0000) ARM_WriteMem(00000178,0054) -- Data: 12 4A 13 48 70 B4 81 B0 ... - Writing 0xC bytes @ 0x000003A4
060:278 (0000) ARM_SetEndian(ARM_ENDIAN_LITTLE)
060:278 (0000) ARM_SetEndian(ARM_ENDIAN_LITTLE)
060:278 (0000) ARM_ResetPullsRESET(OFF)
060:278 (0009) ARM_Reset(): - Writing 0x54 bytes @ 0x00000178 >3E68>
060:287 (0001) ARM_Halt(): **** Warning: Chip has already been halted.
...

Semihosting

Semihosting can be used with J-Link RDI. For more information how to enable semihosting in J-Link RDI, please refer to Semihosting.

Unexpected / unhandled SWIs

When an unhandled SWI is detected by J-Link RDI, the message box below is shown.