Difference between revisions of "Using J-Link Command Strings"

From SEGGER Wiki
Jump to: navigation, search
(Generic)
 
(9 intermediate revisions by the same user not shown)
Line 3: Line 3:
   
 
== J-Link Commander ==
 
== J-Link Commander ==
  +
https://wiki.segger.com/J-Link_Commander#Using_J-Link_Command_Strings
The J-Link Command Strings can be tested with the J-Link Commander.
 
  +
== Eclipse ==
Use the command \tt{exec} supplemented by one of the J-Link Command Strings.
 
  +
https://wiki.segger.com/Eclipse#Using_J-Link_Command_Strings
   
  +
== Generic ==
[[File:JLinkCommander_JLinkCommandStrings.png]]
 
  +
If the used IDE / application does not provide the option to pass J-Link Command Strings to the J-Link DLL, we recommend to include them into a J-Link Script File using the J-Link Script File API function ''JLINK_ExecCommand("<JLinkCommandString>")''. For further information how to use a J-Link Script File in your environment, please refer to: https://wiki.segger.com/Using_J-Link_Script_Files
   
  +
'''Example'''
 
  +
Please find below the content of an example J-Link Scipt File which passes the J-Link Command String ''EnableEraseAllFlashBanks'' via the ''JLINK_ExecCommand(...)'' J-Link Script File command to the J-Link DLL.
exec SupplyPower = 1
 
  +
/*********************************************************************
exec map reset
 
  +
*
exec map exclude 0x10000000-0x3FFFFFFF
 
  +
* ConfigTargetSettings
 
  +
*
 
  +
* Function description
== IAR EWARM ==
 
  +
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the
https://wiki.segger.com/IAR_EWARM#Using_J-Link_script_files
 
  +
* normal connect procedure. For ARM CoreSight devices this may be specifying the base
== Keil MDK ==
 
  +
* address of some CoreSight components (ETM, …) that cannot be auto-detected by J-Link
https://wiki.segger.com/Keil_MDK#Using_J-Link_Script_Files
 
  +
* due to erroneous ROM tables etc. May also be used to specify the device name in case
== Eclipse ==
 
  +
* debugger does not pass it to the DLL.
https://wiki.segger.com/Eclipse#Using_J-Link_script_files
 
  +
*
== Generic ==
 
  +
* Notes
If no [[J-Link settings file]] is present, "'''Default.JLinkScript'''" is loaded if present in the same directory as the J-Link DLL.<br>
 
  +
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
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]].<br>
 
  +
* (2) Should only set some global DLL variables
Alternatively, a J-Link script file can be specified by using one of the following ways:
 
  +
*
# Via [[J-Link settings file]]:
 
  +
* Return value
## Add or edit the line
 
  +
* >= 0 O.K.
## <syntaxhighlight lang="text">"ScriptFile="<path to script file""</syntaxhighlight>
 
  +
* < 0 Error
## (e.g. ScriptFile="C:\Work\Test.jlinkscript") to the '''[CPU]''' section of the J-Link settings file
 
  +
* -1 Unspecified error
# Via [[J-Link command strings]]
 
  +
*/
## Execute the command string
 
  +
int ConfigTargetSettings(void) {
## <syntaxhighlight lang="text">"ScriptFile = <path>"</syntaxhighlight>
 
  +
//
## e.g. ScriptFile = C:\Work\Test.jlinkscript
 
  +
// Enable erase for all flash banks (e.g. QSPI)
# Via the [[J-Link control panel]]
 
  +
//
## Specify the path to the J-Link script file in the tab '''Settings''' of the J-Link control panel<br>[[File:GenericIDE ScriptFile ControlPanel Marked.png]] <br>
 
  +
JLINK_SYS_Report("--EnableEraseAllFlashBanks--");
  +
JLINK_ExecCommand("EnableEraseAllFlashBanks");
  +
return 0;
  +
}

Latest revision as of 12:36, 24 January 2018

The behavior of the J-Link can be customized via command strings passed to the JLinkARM.dll which controls J-Link. In some IDEs and applications such as the J-Link Commander, command strings can be directly passed via a native command. If this is not supported, there are some alternative options which can be used to use J-Link Command Strings anyhow. For further information regarding this, please refer to Using J-Link Command Strings#Generic.

J-Link Commander

https://wiki.segger.com/J-Link_Commander#Using_J-Link_Command_Strings

Eclipse

https://wiki.segger.com/Eclipse#Using_J-Link_Command_Strings

Generic

If the used IDE / application does not provide the option to pass J-Link Command Strings to the J-Link DLL, we recommend to include them into a J-Link Script File using the J-Link Script File API function JLINK_ExecCommand("<JLinkCommandString>"). For further information how to use a J-Link Script File in your environment, please refer to: https://wiki.segger.com/Using_J-Link_Script_Files

Example Please find below the content of an example J-Link Scipt File which passes the J-Link Command String EnableEraseAllFlashBanks via the JLINK_ExecCommand(...) J-Link Script File command to the J-Link DLL.

/*********************************************************************
*                                                                     
*       ConfigTargetSettings   
*
*  Function description
*    Called before InitTarget(). Mainly used to set some global DLL variables to customize the
*    normal  connect  procedure.  For  ARM  CoreSight  devices  this  may  be  specifying  the  base
*    address of some CoreSight components (ETM, …) that cannot be auto-detected by J-Link
*    due to erroneous ROM tables etc. May also be used to specify the device name in case
*    debugger does not pass it to the DLL.                    
*
*  Notes
*    (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
*    (2) Should only set some global DLL variables
*
*  Return value
*    >= 0  O.K.
*     < 0  Error
*      -1  Unspecified error
*/
int ConfigTargetSettings(void) {
  //
  // Enable erase for all flash banks (e.g. QSPI)
  //
  JLINK_SYS_Report("--EnableEraseAllFlashBanks--");
  JLINK_ExecCommand("EnableEraseAllFlashBanks");
  return 0;
}