From SEGGER - Support Wiki
Jump to: navigation, search

IAR EWARM is a Visual Studio style, commercial toolchain including a non-GCC compiler. We recommend to always install the latest J-Link software and documentation pack to make sure that EWARM uses the latest J-Link DLL.

Using J-Link with an existing project

In the following, it is explained how to configure a project to be used with J-Link.

Specifying the target device

  1. Open the project to configure
  2. Open the project settings (ALT + F7)
  3. Go to General Options --> Target
  4. Make sure that the proper device is selected
    IAR Device Marked.png

If the target device used is not listed in EWARM, either a IAR device description file (.ddf) or the IDE independent way can be used. For further information regarding .ddf files, please refer to the IAR documentation.

  1. Go to Debugger --> Setup and select J-Link/J-Trace in the Driver drop-down menu
    IAR Debugger Marked.png
  1. Go to J-Link/J-Trace --> Setup
  2. Configure a proper target interface speed (fixed 4000 kHz is suitable for most targets and leads to good performance)
    IAR Interface Speed.png
  1. Switch to the Connection tab
  2. Select the appropriate target interface in the Interface box
    IAR Interface Type.png

Using the J-Link Flash loader

  1. Open the project settings (ALT + F7)
  2. Make sure appropriate target device is specified (Specifying the target device)
  3. Select Debugger in the list on the left site
  4. Select the tab Download
  5. Uncheck Use flash loader(s)
    IAR FlashLoader Marked.png

Using J-Link script files

IAR EWARM does not provide any native support for J-Link script files so usage of them cannot be configured from within the GUI of the IDE itself.
Anyhow, it is possible to use a J-Link script file by making use of the auto-search feature of the DLL:

  1. Copy the J-Link script file to folder where the J-Link settings file is located (see section "J-Link settings file" below)
  2. Rename the J-Link script to <ProjectName>_<DebugConfig>.JLinkScript. In the sample below, Start_STM32F103_MB672_Debug.JLinkScript would be correct.

J-Link settings file
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:


The settings file is created in a "settings" subdirectory where the project file is located.
IAR SettingsFile NoPath Marked.png


NOTE: Since IAR EWARM V5.30 J-Link is fully and natively supported by EWARM, so RDI is no longer needed.

In order to use J-Link RDI, the debug driver needs to be changed.

  1. Open the project settings (ALT + F7)
  2. Select Debugger in the list on the left site
  3. Select "RDI" in the Driver drop-down menu
  4. Select RDI in the list on the left site
  5. Select the tab RDI
  6. Select the manufacturer driver by navigating to the J-Link software installation directory, and select JLinkRDI.dll, then click OK
  7. Now an extra menu, RDI, has been added to the menu bar.
    IAR Toolbar RDI BeforeAfter.png
  8. Choose Configure in the RDI menu to configure J-Link RDI. For more information about the setup of J-Link RDI, please refer to UM08001.

Debugging on Cortex-M devices

The RDI protocol has only been specified by ARM for ARM 7/9 cores. For Cortex-M there is no official extension of the RDI protocol regarding the register assignement, that has been approved by ARM. Since IAR EWARM version 5.11 it is possible to use J-Link RDI for Cortex-M devices because SEGGER and IAR have come to an agreement regarding the RDI register assignment for Cortex-M. The following table lists the register assignment for RDI and Cortex-M:

Register Index Assigned register
0 R0
1 R1
2 R2
3 R3
4 R4
5 R5
6 R6
7 R7
8 R8
9 R9
10 R10
11 R11
12 R12
13 MSP / PSP (depending on mode)
14 R14 (LR)
16 R15 (PC)


Enabling stdout redirection to SWO

It is possible to configure the IAR EWARM compiler so that stdout is redirected to SWO.
IAR SWO stdout Marked.png

Connecting to a specific J-Link

If multiple J-Links are connected to the host PC and/or a J-Link connection via TCP/IP shall be used, either the IDE independent way can be used, or the S/N or IP of the respective J-Link can be specified in the IAR EWARM project settings.
In order to explicitly specify the J-Link to use,

  1. Open the project settings (ALT + F7)
  2. Select J-Link/J-Trace in the list on the left site
  3. Select the tab Connection
  4. For USB:
    1. Select USB
    2. Select "Serial number" in the drop-down menu
    3. Enter the S/N in the field labeled Serial no:
  5. For IP:
    1. Select TCP/IP
    2. Select "IP address" in the drop-down menu
    3. Enter the IP address in the field labeled IP address:
      IAR USB SN Marked.png