Difference between revisions of "Generic IDE"

From SEGGER Wiki
Jump to: navigation, search
([Deprecated] Via J-Link settings file)
Line 258: Line 258:
 
Open the J-Link settings file in a text editor and add the following line in the [CPU] section:
 
Open the J-Link settings file in a text editor and add the following line in the [CPU] section:
 
<syntaxhighlight lang="text">
 
<syntaxhighlight lang="text">
LowPowerHandlingMode = 1<br>
+
LowPowerHandlingMode = 1
 
</syntaxhighlight>
 
</syntaxhighlight>
 
For more information about how to locate and use the settings file, please refer to ([[J-Link settings file]])
 
For more information about how to locate and use the settings file, please refer to ([[J-Link settings file]])
 
   
 
== RDI ==
 
== RDI ==

Revision as of 08:55, 6 October 2017

Generic IDE

This wiki article describes ways to set settings or use features of J-Link which work independently from the IDE / development environment used.


Getting started with J-Link

How can I get my development environment to work with J-Link?

Please refer to the Supported IDEs if there exists a wiki page dedicated to your IDE and / or consult the user manual of your IDE in order to find instructions on how to use J-Link with the debugger of the IDE used. If it is not specifically mentioned, please note that there are generic / "standardized" debugging interfaces, like RDI and GDB. If the IDE also does not support either of those, please get in touch with SEGGER via mail, so that we can evaluate what can be done.

I got my unlisted IDE to work with J-Link, but X is not working!

Please refer to this page in order to get to know about ways for setting settings or using features without using a IDEs GUI. If sth. still does not work, we suggest as a first step to test if it has sth. to do with the IDE in use by checking if it works when using SEGGER J-Link Commander (which is part of the J-Link software package) or SEGGER Ozone. Checking if a feature works using a binary build by your IDE with J-Link Commander or Ozone can usually be done in less then 10 minutes. If, on the contrary, you are facing issues verifying a setup with J-Link Commander or Ozone, please get in touch with us via mail.

Mandatory settings

Configuring target interface type

Specifying of the target interface type should be possible in the settings of debugger used.
The selected interface will be shown in the J-Link control panel
GenericIDE TargetIF Marked.png

As a workaround, the target interface can also be specified in a J-Link script file.

Configuring target interface speed

Specifying of the target interface speed should be possible in the settings of debugger used.
The selected interface speed will be shown in the J-Link control panel
GenericIDE TargetIF Marked.png
As a workaround, the target interface speed can also be changed in the J-Link control panel or specified in a J-Link script file.


Specifying the target device

If no target device or core is specified, the J-Link DLL will present a selection dialog to the user, asking for manual input.
GenericIDE Device Select.png
Alternatively, the target device can be specified by using one of the following ways:

  1. Adding a line "Device="<devicename>"" (e.g. Device="STM32F103ZE") to the [FLASH] section of the J-Link settings file
  2. Executing the command string "Device <devicename>" (e.g. Device stm32f103ve).
  3. Setting the device name in a J-Link script file

If the device is not listed as a supported device, either select the respective core, or follow the instructions given in Adding Support for New Devices in order to add your own device.

Connecting to a specific J-Link

If multiple J-Links are connected to the host PC, the J-Link DLL will ask the user which J-Link should be used.
GenericIDE JLink Select.png


If no J-Links are connected via USB the J-Link DLL will ask the user if a connection to a J-Link via TCP/IP should be established:

Using the J-Link Flash loader

Why should I use the J-Link Flash loader?

Using the J-Link flash loader allows fast flash programming, debugging and enables the Flash Breakpoint feature. For further information, please refer to UM08001, chapter "Flash download", section "Why should I use the J-Link flash download feature?".

Internal flash

If the device is specified (Specifying the target device), the J-Link Flash loader will be used automatically, if not overwritten by the IDE. If you want to use your own flash loader (or enhance / edit the J-Link flash loader), please follow the instructions given in Adding Support for New Devices

CFI flash

Via J-Link script file

Set the WorkRAM and the CFI area via J-Link commands in a J-Link script file.
The following sample script defines a 16 MiB CFI flash at address 0x64000000 and a 64 KiB WorkRAM at address 0x20000000:

/*********************************************************************
*
*       ConfigTargetSettings
*/
int ConfigTargetSettings(void) {
  JLINK_ExecCommand("SetCFIFlash 0x64000000-0x64FFFFFF");
  JLINK_ExecCommand("SetWorkRAM 0x20000000-0x2000FFFF");
  return 0;
}


[Deprecated] Via J-Link settings file

  1. Open the J-Link settings file (see J-Link settings file)
  2. Add the following lines to the file
[CFI]
CFISize = <FlashSize>
CFIAddr = <FlashAddr>
[GENERAL]
WorkRAMSize = <RAMSize>
WorkRAMAddr = <RAMAddr>
  1. After this the file should look similar to the sample in the following screenshot.
  2. IAR CFI Flash Settings Marked.png
  3. Save the settings file and restart the debug session.


J-Link Settings File

The J-Link Settings File stores configuration and selections which must not be changed by the user manually. If the IDE did not set the J-Link settings file, it can be manually set.

J-Link settings files are either passed by the application using the J-Link DLL before opening a connection to J-Link, or specified by executing the command string :

"ProjectFile = <path>"

J-Link Unlimited Flash Breakpoints

Unlimited Flash Breakpoints work if the J-Link flash loader works and a license for flash breakpoints is present. No additional setup is required. The flash breakpoint feature is available for internal flashes and for external flash (parallel NOR CFI flash as well as QSPI flash). For more information about how to setup for flash download, please refer to internal flash. Whether flash breakpoints are available can be verified using the J-Link control panel:
GenericIDE FlashBP Marked.png

Monitor mode

Monitor mode can be enabled by executing the following commands string(s):
(Second command only needed in case of monitor interrupt forwarding, see section "Forwarding of Monitor Interrupts" in UM08001):

exec SetMonModeDebug=1<br>
exec SetMonModeVTableAddr=<Addr>


Using J-Link command strings

There is always the possibility to perform the J-Link command strings manually via the J-Link control panel.
GenericIDE CommandString ControlPanel Marked.png
This works independently from the IDE.


J-Link command strings can also be executed from J-Link script files

Using J-Link script files

If no J-Link settings file is present, "Default.JLinkScript" is loaded if present in the same directory as the J-Link DLL.
If a J-Link J-Link settings file is present, but no script file is specified inside of the script file, "<Name of the J-Link settings file>.JLinkScript" is loaded if present in the same directory as the J-Link settings file.
Alternatively, a J-Link script file can be specified by using one of the following ways:

  1. Via J-Link settings file:
    1. Add or edit the line
    2. "ScriptFile="<path to script file""
      
    3. (e.g. ScriptFile="C:\Work\Test.jlinkscript") to the [CPU] section of the J-Link settings file
  2. Via J-Link command strings
    1. Execute the command string
    2. "ScriptFile = <path>"
      
    3. e.g. ScriptFile = C:\Work\Test.jlinkscript
  3. Via the J-Link control panel
    1. Specify the path to the J-Link script file in the tab Settings of the J-Link control panel
    2. GenericIDE ScriptFile ControlPanel Marked.png

J-Link DLL version

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. Select the Details tab to display information about the product version.
GenericIDE DLL Version.png

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.
GenericIDE ProcessExplorer DLL Marked.png

Updating the J-Link DLL

The J-Link DLL is part of the J-Link software and documentation pack. The software package not only installs the new files to the path specified, but also makes sure that 3rd-party applications use the newly installed version as well, if requested to do so by the user.
This is handled differently, depending on the operating system:


Windows

After copying of the installed files, the J-Link DLL Updater Dialog is started.
GenericIDE DLL Updater.png
The J-Link DLL Updater list all applications supported by the DLL updater. These applications solely use "their" own copy of the DLL, usually located in the installation directory of that application. The user can select which applications' DLL copy shall be updated (Default: all).

Other applications query an entry in the Windows registry for the path of the DLL the use. This entry is updated by the DLL Updater if the newly installed version is higher than the value currently stored.


macOS

The software is installed to /Applications/SEGGER/JLink_VXYYO
Additionally, the symbolic link /Applications/SEGGER/JLink is updated so that it points to the most recently installed version.
Therefore, users can use links or shortcuts to SEGGER applications in /Applications/SEGGER/JLink which will always point to the most recently installed version of the application.
Similarly, developers can link against libjlinkarm.dylib in /Applications/SEGGER/JLink in order to make sure that their applications always used the most recently installed version of the J-Link library.


Linux

The software is installed to /opt/SEGGER/JLink_VXYYO
Additionally, the symbolic link /opt/SEGGER/JLink is updated so that it points to the most recently installed version.
Therefore, users can use links or shortcuts to SEGGER applications in /opt/SEGGER/JLink which will always point to the most recently installed version of the application.
Similarly, developers can link against libjlinkarm.so in /opt/SEGGER/JLink in order to make sure that their applications always uses the most recently installed version of the J-Link library.


Low power debugging

Via J-Link script file

Low-power handling mode can be activated via a J-Link command string(EnableLowPowerHandlingMode), e.g. from inside a J-Link script file, like as follows:

/*********************************************************************
*
*       InitEMU
*/
int InitEMU(void) {
  JLINK_ExecCommand("EnableLowPowerHandlingMode");
  return 0;
}


[Deprecated] Via J-Link settings file

Low-power handling mode has to be activated in the J-Link settings file. Open the J-Link settings file in a text editor and add the following line in the [CPU] section:

LowPowerHandlingMode = 1

For more information about how to locate and use the settings file, please refer to (J-Link settings file)

RDI

How to enable RDI in a debugging / development environment heavy depends on the environment used. In general the debugger needs to be pointed to the JLinkRDI.dll, which is located in the J-Link software installation directory.

Once the debugger has been successfully configured to use the JLinkRDI.dll, please refer to UM08001 for further information on how to use and configure J-Link RDI.

SWO

Implementing SWO in the target application

Some compilers come with an option to enable stdout redirection to SWO, which causes all stdout traffic to be ouput via SWO. A more generic und versatile approach is to include functions dedicated to SWO output into the application code. This allows to distinguish between messages which should be output via SWO and other which should be output via stdout. Needless to say, redirection of stdout is also possible with this approach and does not depend on IDE features.

In UM08001 chapter "J-Link software and documentation package" subsection "Target example code for terminal output" an code example code is provided. Furthermore, in subsection "Configure SWO output after device reset" a code example for starting SWO output after reset is provided.

Better alternative to SWO: SEGGER Real Time Transfer

Real Time Transfer (RTT) allows 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 behavior. In contrast to SWO, RTT does not require a extra pin, but works via the normal target debug interface (e.g. JTAG or SWD). Performance is vastly superior to SWO. For more information, please refer to the RTT website and the J-Link User Guide UM08001.