220 CHAPTER 5 Working with J-Link and J-Trace
J-Link / J-Trace (UM08001) ©
2004-2017 SEGGER Microcontroller GmbH & Co. KG
5.11.5.7 Jump statements
The following jump statements are supported by the J-Link script file language:
•return
5.11.5.8 Sample script files
The J-Link software and documentation package comes with sample script files for
different devices. The sample script files can be found at $JLINK_INST_DIR$\Sam-
ples\JLink\Scripts.
5.11.6 Script file writing example
In the following, a short example of how a J-Link script file could look like. In this
example we assume a JTAG chain with two devices on it (Cortex-A8 4 bits IRLen, cus-
tom device 5-bits IRLen).
void InitTarget(void) {
Report("J-Link script example.");
JTAG_Reset(); // Perform TAP reset and J-Link JTAG auto-detection
if (JTAG_TotalIRLen != 9) { // Basic check if JTAG chain information matches
MessageBox("Can not find xxx device");
return 1;
}
JTAG_DRPre = 0; // Cortex-A8 is closest to TDO, no no pre devices
JTAG_DRPost = 1; // 1 device (custom device) comes after the Cortex-A8
JTAG_IRPre = 0; // Cortex-A8 is closest to TDO, no no pre IR bits
JTAG_IRPost = 5; // custom device after Cortex-A8 has 5 bits IR len
JTAG_IRLen = 4; // We selected the Cortex-A8, it has 4 bits IRLen
CPU = CORTEX_A8; // We are connected to a Cortex-A8
JTAG_AllowTAPReset = 1; // We are allowed to enter JTAG TAP reset
//
// We have a non-CoreSight compliant Cortex-A8 here
// which does not allow auto-detection of the Core debug components base address.
// so set it manually to overwrite the DLL auto-detection
//
CORESIGHT_CoreBaseAddr = 0x80030000;
}
5.11.7 Executing J-Link script files
5.11.7.1 In J-Link commander
When J-Link commander is started it searches for a script file called
Default.JLinkScript in the folder wich contains the JLink.exe and the J-Link DLL
(by default the installation folder e.g. "C:\Program Files\SEGGER\JLinkARM_V456\").
If this file is found, it is executed instead of the standard auto detection of J-Link. If
this file is not present, J-Link commander behaves as before and the normal auto-
detection is performed.
5.11.7.2 In Keil MDK-ARM
Keil MDK-ARM 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 possi-
ble to use a J-Link script file by making use of the auto-search feature of the DLL:
• Navigate to the folder where the uVision project (*.uvproj, *.uvprojx) is located