Difference between revisions of "J-Link script files"

From SEGGER Wiki
Jump to: navigation, search
Line 1: Line 1:
  +
'''Example:'''
 
  +
In some situations it it necessary to customize some actions performed by J-Link. In most
  +
cases it is the connection sequence and/or the way in which a reset is performed by J-Link,
  +
since some custom hardware needs some special handling which cannot be integrated into
  +
the generic part of the J-Link software. J-Link script files are written in C-like syntax in
  +
order to have an easy start to learning how to write J-Link script files. The script file syntax
  +
supports most statements (if-else, while, declaration of variables, …) which are allowed in
  +
C, but not all of them. Moreover, there are some statements that are script file specific. The
  +
script file allows maximum flexibility, so almost any target initialization which is necessary
  +
can be supported.
  +
  +
  +
'''For further information regarding J-Link script files, please refer to [https://www.segger.com/downloads/jlink/UM08001 UM08001].'''
  +
  +
  +
Example:
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
void InitTarget(void) {
 
void InitTarget(void) {
Line 23: Line 38:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
In some situations it it necessary to customize some actions performed by J-Link. In most
 
cases it is the connection sequence and/or the way in which a reset is performed by J-Link,
 
since some custom hardware needs some special handling which cannot be integrated into
 
the generic part of the J-Link software. J-Link script files are written in C-like syntax in
 
order to have an easy start to learning how to write J-Link script files. The script file syntax
 
supports most statements (if-else, while, declaration of variables, …) which are allowed in
 
C, but not all of them. Moreover, there are some statements that are script file specific. The
 
script file allows maximum flexibility, so almost any target initialization which is necessary
 
can be supported.
 
 
 
For further information regarding J-Link script files, please refer to [https://www.segger.com/downloads/jlink/UM08001 UM08001].
 

Revision as of 16:27, 5 October 2017

In some situations it it necessary to customize some actions performed by J-Link. In most cases it is the connection sequence and/or the way in which a reset is performed by J-Link, since some custom hardware needs some special handling which cannot be integrated into the generic part of the J-Link software. J-Link script files are written in C-like syntax in order to have an easy start to learning how to write J-Link script files. The script file syntax supports most statements (if-else, while, declaration of variables, …) which are allowed in C, but not all of them. Moreover, there are some statements that are script file specific. The script file allows maximum flexibility, so almost any target initialization which is necessary can be supported.


For further information regarding J-Link script files, please refer to UM08001.


Example:

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;
}