|
Technical Support
Support Resources
Product Information
|
µVISION DEBUGGER: Using a Segger J-Link Script File During Debugging
Information in this knowledgebase article applies to:
SYMPTOM
I cannot establish a debug or trace connection using Keil MDK and
a Segger J-Link (or a Segger J-Trace). I have verified this works
using third-party software tools. Are there additional settings I can
set in a debug script?
CAUSE
Since Segger manufactures the J-Link adaptor, they provide a
J-Link dll to Keil. To use this dll in the Keil µVision IDE: in the
Project -> Options For Target -> Debug tab, on
the right-hand side, click the Settings button to
open the Cortex JLink/Jtrace Target Driver Setup
dialog. In this dialog, configure the Debug
and Flash
Download settings settings for the Segger J-Link or J-Trace.
Interfacing with the
J-Link
Instead of just using a debug
script initialisation file (.ini file) on the
Debug tab, use these methods provided by Segger for
additional configuration options.
-
J-Link Commander - a command
line interface for inputting J-Link Commands.
-
J-Link Control Panel - the J-Link dll called in the background
by the Keil µVision Debugger. Use it to monitor debug status, and
configure some J-Link features.
-
J-Link Debug Script files - for additional control of reset,
trace configuration, delays, debug commands, etc.
Debug Script
Types
Two types of Segger debug script files are:
-
*.JLinkScript file: J-Link Script File in
plain text format
-
*.Pex File: pre-compiled, non-modifiable file,
i.e., it is not plain text or human-readable. Contact Segger if
the project needs a modified version of the script file.
Ways to obtain a
J-Link Script file
-
Some CMSIS-PACK examples come with JLinkScript files.
Using Windows Explorer, search the pack directory of your device
family (typically in C:\Keil_v5\Arm\pack) for
ext:JLinkScript.
-
Segger provides examples projects that include J-Link script
files. See their debug probe wiki page for those
examples.
-
Download and unzip an example project to view the J-Link
script file.
-
Make a custom J-Link script file. See their sample J-Link script wiki page.
RESOLUTION
When starting the Keil µVision Debugger, the J-Link dll always
tries to use the JLinkSettings.JLinkScript in the project
directory (if present). So to use a .JLinkScript file in
Keil MDK5:
-
Using Windows Explorer, open the folder where the µVision
project file (*.uvprojx) is.
-
Copy the *.JLinkScript into this folder. Rename it
JLinkSettings.JLinkScript.
-
In the µVision IDE, select Debug -> Start/Stop Debug
Session and verify the J-Link script ran.
-
See more in the Segger wiki page for Keil MDK.
Setting a J-link script file using the J-Link Control Panel
Another method for including a Segger J-Link script file within a
Keil MDK project:
-
In the Keil IDE, on the Project -> Options For
Target -> Debug tab, click the click the
Settings button to open the Cortex
JLink/Jtrace Target Driver Setup dialog - this activates
the J-Link dll.
-
With the J-Link driver in use, a J-Link system tray icon - a green
box with a white "J" - appears in the Microsoft Windows task bar
notification area.
-
Click on the J-Link Icon to open the Segger J-Link
Control Panel.
- There, switch to Settings tab.
-
In the third field in the dialog - the Script
file field - click the … button.
Browse to the J-link script file. Press Open to
close this dialog.
-
For *.pex file types: change the file filter from
J-Link script files (*.Jlinkscript) to All
Files (*.*) then press Open.
-
Close the Segger J-Link Control panel this
saves the reference J-link Script file settings in the
JLinkSettings.ini in the project folder.
-
In the µVision IDE, select Debug -> Start/Stop Debug
Session and verify the J-Link script ran.
-
More information in their J-Link script file wiki page.
Additional Notes
-
Debug
Configuration (dbgconf) files will not work with a J-Link or
J-Trace. Use a Segger debug script instead.
-
In some cases, the debug sequence in the J-Link script file is
only implemented for JTAG. In such cases, JTAG mode must also be
set in the Cortex JLink/Jtrace Target Driver Setup
dialog (in the Project -> Options For Target ->
Debug tab).
-
Every time the J-Link dll connects to the J-Link debug adaptor,
it automatically generates a JLinkSettings.ini
file in the project directory. Changing a value in the
Cortex JLink/Jtrace Target Driver Setup dialog
updates a corresponding field in the JLinkSettings.ini
file.
Troubleshooting
-
Read more about using a J-link with Keil MDK on Segger's webpage.
-
To read about Segger J-Link commands in the J-Link / J-Trace
User Guide, download the J-Link Manual here.
See Also
Last Reviewed: Monday, January 11, 2021
|
|