Difference between revisions of "Changing J-Link Reset Strategy"

From SEGGER Wiki
Jump to: navigation, search
(Created page with "__TOC__ How to change the reset strategy used by the J-Link depends on the used environment. The reset strategy can be either configured via a setting in the used environment...")
 
Line 4: Line 4:
 
== J-Link Commander ==
 
== J-Link Commander ==
 
https://wiki.segger.com/J-Link_Commander#Changing_J-Link_Reset_Strategy
 
https://wiki.segger.com/J-Link_Commander#Changing_J-Link_Reset_Strategy
== Eclipse ==
+
=== J-Flash ===
  +
TBD
https://wiki.segger.com/Eclipse#Using_J-Link_Command_Strings
 
   
== Generic ==
+
=== Ozone ===
  +
TBD
  +
=== Embedded Studio ===
  +
TBD
  +
  +
=== 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
 
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'''
 
'''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.
+
Please find below the content of an example J-Link Script File which passes the J-Link Command String ''SetResetType'' via the ''JLINK_ExecCommand(...)'' J-Link Script File command to the J-Link DLL.
  +
/*********************************************************************
 
  +
<source lang="c">
*
 
  +
/*********************************************************************
* ConfigTargetSettings
 
  +
*
*
 
  +
* ConfigTargetSettings
* Function description
 
  +
*
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the
 
  +
* Function description
* normal connect procedure. For ARM CoreSight devices this may be specifying the base
 
  +
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the
* address of some CoreSight components (ETM, …) that cannot be auto-detected by J-Link
 
  +
* normal connect procedure. For ARM CoreSight devices this may be specifying the base
* due to erroneous ROM tables etc. May also be used to specify the device name in case
 
  +
* address of some CoreSight components (ETM, …) that cannot be auto-detected by J-Link
* debugger does not pass it to the DLL.
 
  +
* 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.
 
  +
* Notes
* (2) Should only set some global DLL variables
 
  +
* (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.
 
  +
* Return value
* < 0 Error
 
* -1 Unspecified error
+
* >= 0 O.K.
  +
* < 0 Error
*/
 
  +
* -1 Unspecified error
int ConfigTargetSettings(void) {
 
  +
*/
//
 
  +
int ConfigTargetSettings(void) {
// Enable erase for all flash banks (e.g. QSPI)
 
//
+
//
  +
// Set reset strategy used by the J-Link to Reset + Halt After Bootloader Using Watchpoint.
JLINK_SYS_Report("--EnableEraseAllFlashBanks--");
 
  +
//
JLINK_ExecCommand("EnableEraseAllFlashBanks");
 
  +
JLINK_SYS_Report("-- Configure Reset Strategy --");
return 0;
 
  +
JLINK_ExecCommand("SetResetType = 12");
}
 
  +
return 0;
  +
}
  +
</source>

Revision as of 14:37, 7 July 2021

How to change the reset strategy used by the J-Link depends on the used environment. The reset strategy can be either configured via a setting in the used environment (if available) or via J-Link Command Strings. Some applications such as the J-Link Commander allow to pass J-Link Command Strings directly to the J-Link DLL via a native command. If neither of the options is available, please refer to Using J-Link Command Strings#Generic.

J-Link Commander

https://wiki.segger.com/J-Link_Commander#Changing_J-Link_Reset_Strategy

J-Flash

TBD

Ozone

TBD

Embedded Studio

TBD

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 Script File which passes the J-Link Command String SetResetType 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) {
  //
  // Set reset strategy used by the J-Link to Reset + Halt After Bootloader Using Watchpoint.
  //
  JLINK_SYS_Report("-- Configure Reset Strategy --");
  JLINK_ExecCommand("SetResetType = 12");
  return 0;
}