J-Link Command Strings

From SEGGER Wiki
Jump to: navigation, search

The behavior of the J-Link can be customized via J-Link Command Strings passed to the JLinkARM.dll which controls J-Link. Applications such as J-Link Commander, but also other IDEs, allow passing one or more J-Link Command Strings. Command strings can be used for passing commands to J-Link (such as switching on target power supply), as well as customize the behavior (by defining memory regions and other things) of J-Link. This way, J-Link Command Strings enable to set options which are not configurable via dialogs or settings (e.g. in an IDE).

This article is still under construction. For any missing sections/chapters please refer to the PDF version of the J-Link User Manual (UM08001).

Contents

List of available commands

The table below lists and describes the available J-Link Command Strings.

Command Description
AppendToLogFile Enables/Disables always appending new loginfo to logfile.
CORESIGHT_SetIndexAHBAPToUse Selects a specific AHB-AP to be used to connect to a Cortex-M device.
CORESIGHT_SetIndexAPBAPToUse Selects a specific APB-AP to be used to connect to a Cortex-A or Cortex-R device.
CORESIGHT_SetETBBaseAddr Sets ETB base address.
CORESIGHT_SetMTBBaseAddr Sets MTB base address.
CORESIGHT_SetETMBaseAddr Sets ETM base address.
CORESIGHT_SetPTMBaseAddr Sets PTM base address.
CORESIGHT_SetCSTFBaseAddr Sets Trace Funnel base address.
CORESIGHT_SetTMCBaseAddr Sets TMC base address.
CORESIGHT_SetTPIUBaseAddr Sets TPIU base address.
CORESIGHT_SetTFEnableMask Sets the CSTF mask.
device Selects the target device.
DisableAutoUpdateFW Disables automatic firmware update.
DisableCortexMXPSRAutoCorrectTBit Disables auto-correction of XPSR T-bit for Cortex-M devices.
DisableFlashBPs Disables the FlashBP feature.
DisableFlashDL Disables the J-Link FlashDL feature.
DisableInfoWinFlashBPs Disables info window for programming FlashBPs.
DisableInfoWinFlashDL Disables info window for FlashDL.
DisableLowPowerHandlingMode Disables low-power handling mode
DisableMOEHandling Disables output of additional information about mode of entry in case the target CPU is halted / entered debug mode.
DisablePowerSupplyOnClose Disables power supply on close.
EnableAutoUpdateFW Enables automatic firmware update.
EnableEraseAllFlashBanks Enables erase for all accessible flash banks.
EnableFlashBPs Enables the FlashBP feature.
EnableFlashDL Enables the J-Link FlashDL feature.
EnableInfoWinFlashBPs Enables info window for programming FlashBPs.
EnableInfoWinFlashDL Enables info window for FlashDL.
EnableLowPowerHandlingMode Enables low-power handling mode
EnableMOEHandling Enables output of additional information about mode of entry in case the target CPU is halted / entered debug mode.
EnableRemarks Enable detailed output during CPU-detection / connection process.
ExcludeFlashCacheRange Invalidate flash ranges in flash cache, that are configured to be excluded from flash cache.
HideDeviceSelection Hide device selection dialog.
HSSLogFile Logs all HSS-Data to file, regardless of the application using HSS.
InvalidateCache Invalidates Cache.
InvalidateFW Invalidating current firmware.
map exclude Ignores all memory accesses to specified area.
map illegal Marks a specified memory region as an illegal memory area. Memory accesses to this region are ignored.
map indirectread Specifies an area which should be read indirect.
map ram Specifies location of target RAM.
map region Specifies a memory region.
map reset Restores the default mapping, which means all memory accesses are permitted.
MemPreserveOnReset Adds a memory preserve area to the internal list of memory areas.
ProjectFile Specifies a file or directory which should be used by the J-Link DLL to save the current configuration.
ReadIntoTraceCache Reads the given memory area into the streaming trace instruction cache.
RTTTelnetAllowNonLocalClient Allows non local clients to connect to RTT over Telnet.
ScriptFile Set script file path.
SelectTraceSource Selects which trace source should be used for tracing.
SetAllowStopMode Allows/Disallows usage of stop mode for RTT and memory accesses.
SetAllowFlashCache Enables/Disables flash cache usage.
SetHostIF Can be used to override the host interface. Please refer to InitEmu().
SetAllowSimulation Enables/Disables instruction set simulation.
SetBatchMode Enables/Disables batch mode.
SetCFIFlash Specifies CFI flash area.
SetCheckModeAfterRead Enables/Disables CPSR check after read operations.
SetCompareMode Specifies the compare mode to be used.
SetCPUConnectIDCODE Specifies an CPU IDCODE that is used to authenticate the debug probe, when connecting to the CPU.
SetDbgPowerDownOnClose Used to power-down the debug unit of the target CPU when the debug session is closed.
SetEnableMemCache Enables/Disables DLL internal memory caching mechanisms that improve performance
SetETBIsPresent Selects if the connected device has an ETB.
SetETMIsPresent Selects if the connected device has an ETM.
SetFlashDLNoRMWThreshold Specifies a threshold when writing to flash memory does not cause a read-modify-write operation.
SetFlashDLThreshold Set minimum amount of data to be downloaded.
SetIgnoreReadMemErrors Specifies if read memory errors will be ignored.
SetIgnoreWriteMemErrors Specifies if write memory errors will be ignored.
SetMonModeDebug Enables/Disables monitor mode debugging.
SetResetPulseLen Defines the length of the RESET pulse in milliseconds.
SetResetType Selects the reset strategy.
SetRestartOnClose Specifies restart behavior on close.
SetRTTAddr Set address of the RTT buffer.
SetRTTSearchRanges Set ranges to be searched for RTT buffer.
SetRTTTelnetPort Set the port used for RTT telnet.
SetRXIDCode Specifies an ID Code for Renesas RX devices to be used by the J-Link DLL.
SetSkipProgOnCRCMatch Deprecated. Use SetCompareMode instead.
SetSysPowerDownOnIdle Used to power-down the target CPU, when there are no transmissions between J-Link and target CPU, for a specified time frame.
SetVerifyDownload Specifies the verify option to be used.
SetWorkRAM Specifies RAM area to be used by the J-Link DLL.
ShowControlPanel Opens control panel.
SilentUpdateFW Update new firmware automatically.
SupplyPower Activates/Deactivates power supply over pin 19 of the JTAG connector.
SupplyPowerDefault Activates/Deactivates power supply over pin 19 of the JTAG connector permanently.
SuppressControlPanel Suppress pop up of the control panel.
SuppressInfoUpdateFW Suppress information regarding firmware updates.
SWOSetConversionMode Set SWO Conversion mode.
TraceSampleAdjust Allows to adjust the sampling timing on the specified pins, inside the J-Trace firmware

AppendToLogFile

This command can be used to configure the AppendToLogFile feature. If enabled, new log data will always be appended to an existing logfile. Otherwise, each time a new connection will be opened, existing log data will be overwritten. By default new log data will not be always appended to an existing logfile.

Syntax

AppendToLogFile = 0 | 1

Example

AppendToLogFile 1

CORESIGHT_SetIndexAHBAPToUse

This command is used to select a specific AHB-AP to be used when connected to an ARM Cortex-M device. Usually, it is not necessary to explicitly select an AHB-AP to be used, as J-Link auto-detects the AP automatically. For multi-core systems with multiple AHB-APs it might be necessary.
The index selected here is an absolute index. For example, if the connected target provides the following AP layout:

  • AP[0]: AHB-AP
  • AP[1]: APB-AP
  • AP[2]: AHB-AP
  • AP[3]: JTAG-AP

In order to select the second AHB-AP to be used, use "2" as index.

Syntax

CORESIGHT_SetIndexAHBAPToUse = <Index>

Example

CORESIGHT_SetIndexAHBAPToUse = 2

CORESIGHT_SetIndexAPBAPToUse

This command is used to select a specific APB-AP to be used when connected to an ARM Cortex-A or Cortex-R device. Usually, it is not necessary to explicitly select an AHB-AP to be used, as J-Link auto-detects the AP automatically. For multi-core systems with multiple APB-APs it might be necessary.
The index selected here is an absolute index. For example, if the connected target provides the following AP layout:

  • AP[0]: APB-AP
  • AP[1]: AHB-AP
  • AP[2]: APB-AP
  • AP[3]: JTAG-AP

In order to select the second APB-AP to be used, use "2" as index.

Syntax

CORESIGHT_SetIndexAPBAPToUse = <Index>

Example

CORESIGHT_SetIndexAPBAPToUse = 2

CORESIGHT_SetETBBaseAddr

This command can be used to set the Coresight ETB base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetETBBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetETBBaseAddr = 0xE0041000

or

CORESIGHT_SetETBBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetMTBBaseAddr

This command can be used to set the Coresight MTB base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetMTBBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetMTBBaseAddr = 0xE0041000

or

CORESIGHT_SetMTBBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetETMBaseAddr

This command can be used to set the Coresight ETM base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetETMBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetETMBaseAddr = 0xE0041000

or

CORESIGHT_SetETMBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetPTMBaseAddr

This command can be used to set the Coresight PTM base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetPTMBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetPTMBaseAddr = 0xE0041000

or

CORESIGHT_SetPTMBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetCSTFBaseAddr

This command can be used to set the Coresight TF(Trace Funnel) base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetCSTFBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetCSTFBaseAddr = 0xE0041000

or

CORESIGHT_SetCSTFBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetTMCBaseAddr

This command can be used to set the Coresight TMC base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetTMCBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetTMCBaseAddr = 0xE0041000

or

CORESIGHT_SetTMCBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetTPIUBaseAddr

This command can be used to set the Coresight TPIU base address if the debug probe could not get this information from the target devices ROM table. Additionally an unlock of the module can be forced and an alternative AP index can be set. These settings are optional.

Default values

The default values for the APIndex and base address are usually autodetected by J-Link J-Trace. So only change these values if the autodetection fails or is incorrect. The default unlock value is 0 (no unlock) for Cortex-A/R cores and 1 (always unlock) for Cortex-M.

Syntax

CORESIGHT_SetTPIUBaseAddr = <Addr> [ForceUnlock = <ForceUnlock>] [APIndex = <APIndex>]

Example

CORESIGHT_SetTPIUBaseAddr = 0xE0041000

or

CORESIGHT_SetTPIUBaseAddr = 0xE0041000 ForceUnlock = 1 APIndex = 2

CORESIGHT_SetTFEnableMask

This command can be used to set the Coresight CSTF mask.

Default values

See Device documentation

Syntax

CORESIGHT_SetTFEnableMask <Mask>

Example

CORESIGHT_SetTFEnableMask 0x12345678

device

This command selects the target device.

Syntax

device = <DeviceID>
DeviceID has to be a valid device identifier. For a list of all available device identifiers, please refer to the SEGGER homepage.

Example

device = AT91SAM7S256

DisableAutoUpdateFW

This command is used to disable the automatic firmware update if a new firmware is available.

Syntax

DisableAutoUpdateFW

DisableCortexMXPSRAutoCorrectTBit

Usually, the J-Link DLL auto-corrects the T-bit of the XPSR register to 1, for Cortex-M devices. This is because having it set as 0 is an invalid state and would cause several problems during debugging, especially on devices where the erased state of the flash is 0x00 and therefore on empty devices the T-bit in the XPSR would be 0. Anyhow, if for some reason explicit disable of this auto-correction is necessary, this can be achieved via the following J-Link Command String.

Syntax

DisableCortexMXPSRAutoCorrectTBit

DisableFlashBPs

This command disables the FlashBP feature.

Syntax

DisableFlashBPs

DisableFlashDL

This command disables the J-Link FlashDL feature.

Syntax

DisableFlashDL

DisableInfoWinFlashBPs

This command is used to disable the flash download window for the flash breakpoint feature. Enabled by default.

Syntax

DisableInfoWinFlashBPs

DisableInfoWinFlashDL

This command is used to disable the flash download information window for the flash download feature. Enabled by default.

Syntax

DisableInfoWinFlashDL

DisableLowPowerHandlingMode

This command is used to disable low-power handling mode. For further information, please refer to Low power debugging.
Disabled by default.

Syntax

DisableLowPowerHandlingMode

DisableMOEHandling

The J-Link DLL outputs additional information about mode of entry (MOE) in case the target CPU halted / entered debug mode. Disabled by default.

Syntax

DisableMOEHandling

DisablePowerSupplyOnClose

This command is used to ensure that the power supply for the target will be disabled on close.

Syntax

DisablePowerSupplyOnClose

EnableAutoUpdateFW

This command is used to enable the automatic firmware update if a new firmware is available.

Syntax

EnableAutoUpdateFW

EnableEraseAllFlashBanks

Used to enable erasing of other flash banks than the internal, like (Q)SPI flash or CFI flash.

Syntax

EnableEraseAllFlashBanks

EnableFlashBPs

This command enables the FlashBP feature.

Syntax

EnableFlashBPs

EnableFlashDL

This command enables the J-Link ARM FlashDL feature.

Syntax

EnableFlashDL

EnableInfoWinFlashBPs

This command is used to enable the flash download window for the flash breakpoint feature. Enabled by default.

Syntax

EnableInfoWinFlashBPs

EnableInfoWinFlashDL

This command is used to enable the flash download information window for the flash download feature, which is enabled by default.

Syntax

EnableInfoWinFlashDL

EnableLowPowerHandlingMode

Puts the DLL in low-power handling mode. For further information, please refer to Low power debugging.
Disabled by default.

Syntax

EnableLowPowerHandlingMode

EnableMOEHandling

The J-Link DLL outputs additional information about mode of entry (MOE) in case the target CPU halted / entered debug mode. Disabled by default.

Syntax

EnableMOEHandling

EnableRemarks

The J-Link DLL provides more detailed output during CPU-detection / connection process. Kind of "verbose" option. Disabled by default, therefore only an enable option. Will be reset to "disabled" on each call to JLINK_Open() (reconnect to J-Link).

Syntax

EnableRemarks

ExcludeFlashCacheRange

This command is used to invalidate flash ranges in flash cache, that are configured to be excluded from the cache. Per default, all areas that J-Link knows to be Flash memory, are cached. This means that it is assumed that the contents of this area do not change during program execution. If this assumption does not hold true, typically because the target program modifies the flash content for data storage, then the affected area should be excluded. This will slightly reduce the debugging speed.

Syntax

ExcludeFlashCacheRange <Range>

Example

ExcludeFlashCacheRange 0x10000000-0x100FFFFF

selection

This command can be used to suppress the device selection dialog. If enabled, the device selection dialog will not be shown in case an unknown device is selected.

Syntax

HideDeviceSelection = 0 | 1

Example

HideDeviceSelection 1 // Device selection will not show up

HSSLogFile

This command enables HSS-Logging. Separate to the application using HSS, all HSS Data will be stored in the specified file.

Syntax

HSSLogFile = <Path>

Example

HSSLogFile = C:\Test.log

InvalidateCache

This command is used to invalidate cache.

Syntax

InvalidateCache

InvalidateFW

This command is used to invalidate the current firmware of the J-Link / J-Trace. Invalidating the firmware will force a firmware update. Can be used for downdating. For more information please refer to J-Link / J-Trace firmware

Syntax

InvalidateFW

exclude

This command excludes a specified memory region from all memory accesses. All subsequent memory accesses to this memory region are ignored.

Memory mapping

Some devices do not allow access of the entire 4GB memory area. Ideally, the entire memory can be accessed; if a memory access fails, the CPU reports this by switching to abort mode. The CPU memory interface allows halting the CPU via a WAIT signal. On some devices, the WAIT signal stays active when accessing certain unused memory areas. This halts the CPU indefinitely (until RESET) and will therefore end the debug session. This is exactly what happens when accessing critical memory areas. Critical memory areas should not be present in a device; they are typically a hardware design problem. Nevertheless, critical memory areas exist on some devices.
To avoid stalling the debug session, a critical memory area can be excluded from access: J-Link will not try to read or write to critical memory areas and instead ignore the access silently. Some debuggers (such as IAR C-SPY) can try to access memory in such areas by dereferencing non-initialized pointers even if the debugged program (the debuggee) is working perfectly. In situations like this, defining critical memory areas is a good solution.

Syntax

map exclude <SAddr>-<EAddr>

Example

This is an example for the map exclude command in combination with an NXP LPC2148 MCU.

Memory map:

Range Description
0x00000000-0x0007FFFF On-chip flash memory
0x00080000-0x3FFFFFFF Reserved
0x40000000-0x40007FFF On-chip SRAM
0x40008000-0x7FCFFFFF Reserved
0x7FD00000-0x7FD01FFF On-chip USB DMA RAM
0x7FD02000-0x7FD02000 Reserved
0x7FFFD000-0x7FFFFFFF Boot block (remapped from on-chip flash memory)
0x80000000-0xDFFFFFFF Reserved
0xE0000000-0xEFFFFFFF VPB peripherals
0xF0000000-0xFFFFFFFF AHB peripherals

The "problematic" memory areas are:

Range Description
0x00080000-0x3FFFFFFF Reserved
0x40008000-0x7FCFFFFF Reserved
0x7FD02000-0x7FD02000 Reserved
0x80000000-0xDFFFFFFF Reserved


To exclude these areas from being accessed through J-Link the map exclude command should be used as follows:

map exclude 0x00080000-0x3FFFFFFF
map exclude 0x40008000-0x7FCFFFFF
map exclude 0x7FD02000-0x7FD02000
map exclude 0x80000000-0xDFFFFFFF

illegal

This command marks a specified memory region as an illegal memory area. All subsequent memory accesses to this memory region produces a warning message and the memory access is ignored. This command can be used to mark more than one memory region as an illegal area by subsequent calls.

Syntax

Map Illegal <SAddr>-<EAddr>

Example

Map Illegal 0xF0000000-0xFFDFFFFF

Additional information

  • SAddr has to be a 256-byte aligned address.

The region size has to be a multiple of 256 bytes.

indirectread

This command can be used to read a memory area indirectly. Indirect reading means that a small code snippet is downloaded into RAM of the target device, which reads and transfers the data of the specified memory area to the host. Before map indirectread can be called a RAM area for the indirect read code snippet has to be defined. Use therefor the map ram command and define a RAM area with a size of >= 256 byte.

Syntax

map indirectread <StartAddressOfArea>-<EndAddress>

Example

map indirectread 0x3fffc000-0x3fffcfff

Additional information

  • StartAddressOfArea has to be a 256-byte aligned address.

The region size has to be a multiple of 256 bytes.

ram

This command should be used to define an area in RAM of the target device. The area must be 256-byte aligned. The data which was located in the defined area will not be corrupted. Data which resides in the defined RAM area is saved and will be restored if necessary. This command has to be executed before map indirectread will be called.

Syntax

map ram <StartAddressOfArea>-<EndAddressOfArea>

Example

map ram 0x40000000-0x40003fff;

Additional information

  • StartAddressOfArea has to be a 256-byte aligned address.

The region size has to be a multiple of 256 bytes.

region

This command is used to specify memory areas with various region types.

Syntax

map region <StartAddressOfArea>-<EndAddressOfArea> <RegionType>
In case of using alias region type:
map region <StartAddressOfArea>-<EndAddressOfArea> <RegionType> <StartAliasedAddress> <AliasedAreaSize>

Region type Description
N Normal
C Cacheable
X Excluded
XI Excluded & Illegal
I Indirect access
A Alias (static, e.g. RAM/flash that is aliased multiple times in one area. Does not change during the debug session.)
AD Alias (dynamic, e.g. memory areas where different memories can be mapped to.)

Example

map region 0x100000-0x1FFFFF C
map region 0x0-0x1ffff A 0x08000000 0x20000

reset

This command restores the default memory mapping, which means all memory accesses are permitted.

Typical applications

Used with other "map" commands to return to the default values. The map reset command should be called before any other "map" command is called.

Syntax

map reset

Example

map reset

MemPreserveOnReset

This command is used to add a memory preserve area to the internal list of memory areas that need to be preserved before reset and need to be restored after reset.
The memory area specified must be readable by the CPU before reset and must be writeable by the CPU immediately after reset.
This is mainly used for SRAM debug configurations etc.
Note:
Required software version: V6.32 or later

Syntax

MemPreserveOnReset <Addr> <Size>[ <Addr> <Size> ...]

Example

MemPreserveOnReset 0x20000000 0x1000

ProjectFile

This command is used to specify a file used by the J-Link DLL to save the current configuration.
Using this command is recommended if settings need to be saved. This is typically the case if Flash breakpoints are enabled and used. It is recommended that an IDE uses this command to allow the JLinkARM.dll to store its settings in the same directory as the project and settings file of the IDE. The recommended extension for project files is *.jlink.
Assuming the Project is saved under C:\Work\Work and the project contains to targets name Debug and Release, the debug version could set the file name
C:\Work\Work\Debug.jlink.
The release version could use
C:\Work\Work\Release.jlink.
Note:
Spaces in the filename are permitted.

Syntax

ProjectFile = <FullFileName>

Example

ProjectFile = C:\Work\Release.jlink

ReadIntoTraceCache

This command is used to read a given memory area into the trace instruction cache. It is mainly used for cases where the download address of the application differs from the execution address. As for trace analysis only cached memory contents are used as memory accesses during trace (especially streaming trace) cause an overhead that is too big, by default trace will only work if execution address is identical to the download address. For other cases, this command can be used to read specific memory areas into the trace instruction cache.
Note:
This command causes an immediate read from the target, so it should only be called at a point where memory contents at the given area are known to be valid.

Syntax

ReadIntoTraceCache <Addr> <NumBytes>

Example

ReadIntoTraceCache 0x08000000 0x2000

RTTTelnetAllowNonLocalClient

This command is used to set allowance for non local telnet clients to access RTT data. Per default this value is 0 and only local connections are accepted. It can be set to 1 to enable non local connections as well.
Note:
This command is allowed to be used before JLINKARM_Open() was called. This can be achieved using J-Link SDK. For more information visit our website.

Syntax

RTTTelnetAllowNonLocalClient = 0 | 1

Example

RTTTelnetAllowNonLocalClient = 1 // enables non local clients

ScriptFile

This command is used to set the path to a J-Link script file which shall be executed. J-Link scriptfiles are mainly used to connect to targets which need a special connection sequence before communication with the core is possible.

Syntax

ScriptFile = <FullFileName>

Example

ScriptFile = C:\Work\Default.JLinkScript

SelectTraceSource

This command selects the trace source which shall be used for tracing.
Note:
This is only relevant when tracing on a target that supports trace via pins as well as trace via on-chip trace buffer and a J-Trace (which supports both) is connected to the PC.

Syntax

SelectTraceSource = <SourceNumber>

Trace source number Description
0 ETB
1 ETM
2 MTB

Example

SelectTraceSource = 0 // Select ETB

SetAllowStopMode

This command is used to allow / disallow stop mode for RTT and memory accesses. Enabled by default, should only be disabled for testing purposes. For more information about different RTT and memory access modes, please refer to:

Syntax

SetAllowStopMode = 0 | 1

Example

SetAllowStopMode = 0 // Disable usage of stop mode

SetAllowFlashCache

This command is used to enable / disable caching of flash contents. Enabled by default.

Syntax

SetAllowFlashCache = 0 | 1

Example

SetAllowFlashCache = 1 // Enables flash cache

SetHostIF

This command can be used to override the host interface. This function should be used used thoughtful and only if you know exactly what you are doing as there are many things which needs to be taken into account. For further information regarding this please refer to InitEmu()

Syntax

SetHostIF USB = <SerialNumber>
SetHostIF IP = <IP address>

Example

SetHostIF USB = 123456           // Connect to J-Link via USB (SN 123456)
SetHostIF IP  = 192.168.0.133    // Connect to J-link with specified IP addr.

SetAllowSimulation

This command can be used to enable or disable the instruction set simulation. By default the instruction set simulation is enabled.

Syntax

SetAllowSimulation = 0 | 1

Example

SetAllowSimulation 1 // Enables instruction set simulation

SetBatchMode

This command is used to tell the J-Link DLL that it is used in batch-mode / automatized mode, so some dialogs etc. will automatically close after a given timeout. Disabled by default.

Syntax

SetBatchMode = 0 | 1

Example

SetBatchMode 1 // Enables batch mode 

SetCFIFlash

This command can be used to set a memory area for CFI compliant flashes.

Default values

  • NumChips: 1
  • NumBits: 16

Syntax

SetCFIFlash <StartAddressOfArea>-<EndAddressOfArea>[, <NumChips>, <NumBits>]

Example

SetCFIFlash 0x10000000-0x100FFFFF

or

SetCFIFlash 0x10000000-0x100FFFFF, 1, 16

SetCheckModeAfterRead

This command is used to enable or disable the verification of the CPSR (current processor status register) after each read operation. By default this check is enabled. However this can cause problems with some CPUs (e.g. if invalid CPSR values are returned). Please note that if this check is turned off (SetCheckModeAfterRead = 0), the success of read operations cannot be verified anymore and possible data aborts are not recognized.

Typical applications

This verification of the CPSR can cause problems with some CPUs (e.g. if invalid CPSR values are returned). Note that if this check is turned off (SetCheckModeAfterRead = 0), the success of read operations cannot be verified anymore and possible data aborts are not recognized.

Syntax

SetCheckModeAfterRead = 0 | 1

Example

SetCheckModeAfterRead = 0 

SetCompareMode

This command is used to configure the compare mode.

Syntax

SetCompareMode = <Mode>

<Mode> Description
0 Skip
1 Using fastest method (default)
2 Using CRC
3 Using readback

Example

SetCompareMode = 1 // Select using fastest method

SetCPUConnectIDCODE

Used to specify an IDCODE that is used by J-Link to authenticate itself when connecting to a specific device. Some devices allow the user to lock out a debugger by default, until a specific unlock code is provided that allows further debugging. This function allows to automate this process, if J-Link is used in a production environment.
The IDCODE stream is expected as a hex-encoded byte stream. If the CPU e.g. works on a word-basis for the IDCODE, this stream is interpreted as a little endian formatted stream where the J-Link library then loads the words from and passes them to the device during connect.

Syntax

SetCPUConnectIDCODE = <IDCODE_Stream>

Example

CPU has a 64-bit IDCODE (on word-basis) and expects 0x11223344 0x55667788 as IDCODE.
SetCPUConnectIDCODE = 4433221188776655

SetDbgPowerDownOnClose

When using this command, the debug unit of the target CPU is powered-down when the debug session is closed. <---only m3 ? or Mx? --->
Note:
This command works only for Cortex-M3 devices

Typical applications

This feature is useful to reduce the power consumption of the CPU when no debug session is active.

Syntax

SetDbgPowerDownOnClose = <value>

Example

SetDbgPowerDownOnClose = 1 // Enables debug power-down on close.
SetDbgPowerDownOnClose = 0 // Disables debug power-down on close.

SetEnableMemCache

Enables/Disables DLL internal memory cache mechanisms that are used to improve performance. By default, memory cache mechanisms are enabled.

Syntax

SetEnableMemCache = 0 | 1

Example

SetEnableMemCache = 0 // Disable memory caching mechanisms

Notes

This command may not be used by any IDE, listed as a supported IDE, to disable memory cache mechanisms by default. It may only be used by specific customers for very specific test cases that needs the cache mechanisms to be disabled.

SetETBIsPresent

This command is used to select if the connected device has an ETB.

Syntax

SetETBIsPresent = 0 | 1

Example

SetETBIsPresent = 1 // ETB is available
SetETBIsPresent = 0 // ETB is not available

SetETMIsPresent

This command is used to select if the connected device has an ETM.

Syntax

SetETMIsPresent = 0 | 1

Example

SetETMIsPresent = 1 // ETM is available
SetETMIsPresent = 0 // ETM is not available

SetFlashDLNoRMWThreshold

This command sets the J-Link DLL internal threshold when a write to flash memory does not cause a read-modify-write (RMW) operation. For example, when setting this value to 0x800, all writes of amounts of data < 2 KB will cause the DLL to perform a read-modify-write operation on incomplete sectors.
Default: Writing amounts of < 1 KB (0x400) to flash causes J-Link to perform a read-modify-write on the flash.
Example 1 with default config:

  • Flash has 2 * 1 KB sectors
  • Debugger writes 512 bytes

J-Link will perform a read-modify-write on the first sector, preserving contents of 512 - 1023 bytes. The Second sector is left untouched.
Example 2 with default config:

  • Flash has 2 * 1 KB sectors
  • Debugger writes 1280 bytes

J-Link will erase + program 1 KB of first sector.
J-Link will erase + program 256 bytes of second sector.
Previous 768 bytes from second sector are lost.
The default makes sense for flash programming where old contents in remaining space of affected sectors are usually not needed anymore. Writes of < 1 KB usually mean that the user is performing flash manipulation from within a memory window in a debugger to manipulate the application behavior during runtime (e.g. by writing some constant data used by the application). In such cases, it is important to preserve the remaining data in the sector to allow the application to further work correctly.

Syntax

SetFlashDLNoRMWThreshold = <value>

Example

SetFlashDLNoRMWThreshold = 0x100 // 256 Bytes

SetFlashDLThreshold

This command is used to set a minimum amount of data to be downloaded by the flash download feature.

Syntax

SetFlashDLThreshold = <value>

Example

SetFlashDLThreshold = 0x100 // 256 Bytes

SetIgnoreReadMemErrors

This command can be used to ignore read memory errors. Disabled by default.

Syntax

SetIgnoreReadMemErrors = 0 | 1

Example

SetIgnoreReadMemErrors = 1 // Read memory errors will be ignored
SetIgnoreReadMemErrors = 0 // Read memory errors will be reported

SetIgnoreWriteMemErrors

This command can be used to ignore read memory errors. Disabled by default.

Syntax

SetIgnoreWriteMemErrors = 0 | 1

Example

SetIgnoreWriteMemErrors = 1 // Write memory errors will be ignored
SetIgnoreWriteMemErrors = 0 // Write memory errors will be reported

SetMonModeDebug

This command is used to enable / disable monitor mode debugging. Disabled by default.

Syntax

SetMonModeDebug = 0 | 1

Example

SetMonModeDebug = 1 // Monitor mode debugging is enabled
SetMonModeDebug = 0 // Monitor mode debugging is disabled

TraceSampleAdjust

Allows to adjust the sample point for the specified trace data signals inside the J-Trace firmware. This can be useful to compensate certain delays on the target hardware (e.g. caused by routing etc.).

Syntax

TraceSampleAdjust <PinName> = <Adjust_Ps>[ <PinName>=<Adjust_Ps> ...]

<PinName> Description
TD Adjust all trace data signals
TD0 Adjust trace data 0
TD1 Adjust trace data 1
TD2 Adjust trace data 2
TD3 Adjust trace data 3
TD3..0 Adjust trace data 0-3
TD2..1 Adjust trace data 1-2
TDx..y Adjust trace data x-y
<Adjust_Ps> Description
-5000 to 5000 Adjustment in [ps]

Example

TraceSampleAdjust TD = 1000

SetResetPulseLen

This command defines the length of the RESET pulse in milliseconds. The default for the RESET pulse length is 20 milliseconds.

Syntax

SetResetPulseLen = <value>

Example

SetResetPulseLen = 50

SetResetType

This command selects the reset strategy which shall be used by J-Link, to reset the device. The value which is used for this command is analog to the reset type which shall be selected. For a list of all reset types which are available, please refer to Reset strategies. Please note that there different reset strategies for ARM 7/9 and Cortex-M devices.

Syntax

SetResetType = <value>

Example

SetResetType = 0 // Selects reset strategy type 0: normal

SetRestartOnClose

This command specifies whether the J-Link restarts target execution on close. The default is to restart target execution. This can be disabled by using this command.

Syntax

SetRestartOnClose = 0 | 1

Example

SetRestartOnClose = 1

SetRTTAddr

In some cases J-Link cannot locate the RTT buffer in known RAM. This command is used to set the exact address manually.

Syntax

SetRTTAddr <RangeStart>

Example

SetRTTAddr 0x20000000

SetRTTTelnetPort

This command alters the RTT telnet port. Default is 19021. This command must be called before a connection to a J-Link is established. In J-Link Commander, J-Link Command Strings ("exec <JLinkCommandString>") can only be executed after a connection to J-Link is established, therefore this command string has no effect in J-Link Commander. The -RTTTelnetPort command line parameter can be used instead.

Syntax

SetRTTTelnetPort <value>

Example

SetRTTTelnetPort 9100

SetRTTSearchRanges

In some cases J-Link cannot locate the RTT buffer in known RAM. This command is used to set (multiple) ranges to be searched for the RTT buffer.

Syntax

SetRTTSearchRanges <RangeAddr> <RangeSize> [, <RangeAddr1> <RangeSize1>, ..]

Example

SetRTTSearchRanges 0x10000000 0x1000, 0x20000000 0x1000,

SetRXIDCode

This command is used to set the ID Code for Renesas RX devices to be used by the J-Link DLL.

Syntax

SetRXIDCode = <RXIDCode_String>

Example

Set 16 IDCode Bytes (32 Characters).
SetRXIDCode = 112233445566778899AABBCCDDEEFF00

SetSkipProgOnCRCMatch


Note:
Deprecated. Use SetCompareMode instead. This command is used to configure the CRC match / compare mode.

SetSysPowerDownOnIdle

When using this command, the target CPU is powered-down when no transmission between J-Link and the target CPU was performed for a specific time. When the next command is given, the CPU is powered-up.
Note:
This command works only for Cortex-M3 devices.

Typical applications

This feature is useful to reduce the power consumption of the CPU.

Syntax

SetSysPowerDownOnIdle = <value>
Note:
A 0 for <value> disables the power-down on idle functionality.

Example

SetSysPowerDownOnIdle = 10; // The target CPU is powered-down when there is no
                            // transmission between J-Link and target CPU for
                            // at least 10ms

SetVerifyDownload

This command is used to configure the verify mode.

Syntax

SetVerifyDownload = <VerifyMode>

Compare mode Description
0 Skip
1 Programmed sectors, fastest method (default)
2 Programmed sectors using CRC
3 Programmed sectors using readback
4 All sectors using fastest method
5 All sectors using CRC
6 All sectors using read back
7 Programmed sectors using checksum
8 All sectors using checksum

Example

SetVerifyDownload = 1 // Select programmed sectors, fastest method

SetWorkRAM

This command can be used to configure the RAM area which will be used by J-Link.

Syntax

SetWorkRAM <StartAddressOfArea>-<EndAddressOfArea>

Example

SetWorkRAM 0x10000000-0x100FFFFF

ShowControlPanel

Executing this command opens the J-Link web control panel.

Syntax

ShowControlPanel

SilentUpdateFW

After using this command, new firmware will be updated automatically without opening a message box.

Syntax

SilentUpdateFW

SupplyPower

This command activates power supply over pin 19 of the JTAG connector.

Typical applications

This feature is useful for some eval boards that can be powered over the JTAG connector.

Syntax

SupplyPower = 0 | 1

Example

SupplyPower = 1

SupplyPowerDefault

This command activates power supply over pin 19 of the JTAG connector permanently.

Typical applications

This feature is useful for some eval boards that can be powered over the JTAG connector.

Syntax

SupplyPowerDefault = 0 | 1

Example

SupplyPowerDefault = 1

SuppressControlPanel

Using this command ensures, that the control panel will not pop up automatically.

Syntax

SuppressControlPanel

SuppressInfoUpdateFW

After using this command information about available firmware updates will be suppressed.
Note:
We strongly recommend not to use this command, latest firmware versions should always be used!

Syntax

SuppressInfoUpdateFW

SWOSetConversionMode

This command is used to set the SWO conversion mode.

Syntax

SWOSetConversionMode = <ConversionMode>

Conversion mode Description
0 If only '\n' is received, make it "\r\n" to make the line end Windows-compliant. (Default behavior)
1 Leave everything as it is, do not add any characters.

Example

SWOSetConversionMode = 0

Using J-Link Command Strings

The recommend way to execute J-Link command strings is to add them to a J-Link script file for repetitive use, e.g. on debug session start.