Difference between revisions of "OpenOCD"

From SEGGER Wiki
Jump to: navigation, search
(Switching the USB driver to OpenOCD)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
OpenOCD is a open and free project to support different debug probes under one "API".
 
__TOC__
 
__TOC__
   
  +
== Using J-Link with OpenOCD ==
= Modes =
 
  +
In general, it is possible to use J-Link with OpenOCD. OpenOCD handles J-Link as a dumb JTAG/SWD/... probe and only uses the very low level logic to output JTAG/SWD/... sequences. It does not make use of any high level logic etc. and therefore is much slower than the proprietary SEGGER J-Link DLL / GDBServer / ... implementation.
SEGGER RTT ([https://www.segger.com/products/debug-probes/j-link/technology/real-time-transfer/about-real-time-transfer/ SEGGER Real Time Transfer]) can run in different modes where some modes are not available on all devices but other modes are which then have an impact on the real time behavior of the device.
 
   
  +
== Switching the USB driver to OpenOCD ==
== Background mode ==
 
  +
In order to use J-Link with OpenOCD the standard J-Link USB driver must be replaced with the WinUSB driver, using 3rd party utilities. There are lots of walkthroughs available on the internet.
This is the mode which RTT was initially introduced with. In this mode, J-Link can access the memory of the target system while the MCU + application keeps running (background memory access), effectively not impacting the real time behavior of the application. In order to use this mode, the target MCU needs to support background memory accesses.
 
   
  +
{{Note|1=Current (since end 2022) models are already shipped by factory configured for WinUSB, so the reconfiguration should no longer be necessary. Some models slightly before that change are not configured for WinUSB by default but can be configured to it via [[J-Link_on_Windows_ARM#Configuration | J-Link Configurator]]}}
=== Cores with background mode support ===
 
*Cortex-M based devices (all cores from the series)
 
*Renesas RX based devices (all cores from the series)
 
   
  +
== Restoring the USB driver ==
=== Cores with optional background mode support ===
 
  +
Once the J-Link USB driver has been replaced, no SEGGER software from the J-Link software package will be able to communicate with J-Link anymore.<br>
* Cortex-A based devices (all cores from the series)
 
  +
To use SEGGER J-Link software again, the USB driver needs to be switched back to its default.<br>
* Cortex-R based devices (all cores from the series)
 
  +
This can be achieved by
* RISC-V based devices ('''no core available so far that implements this feature''')
 
  +
* navigating to the J-Link software installation (by default C:\Program Files\SEGGER\JLink\)
'''Cortex-A/R specific:''' It depends on the actual device if it supports background memory accesses because it is up to the device vendor if the necessary hardware unit is implemented or not. In addition to that, when using the background mode on Cortex-A/R based devices, some considerations need to be taken into account when it comes to caches etc. These are explained in [https://www.segger.com/downloads/application-notes/ AN08005]
 
  +
* navigating to the sub folder USBDriver\
  +
* Double clicking InstDrivers.exe
   
== Stop mode ==
+
== Limitations ==
  +
There are several limitations that apply when using J-Link with OpenOCD instead of the SEGGER J-Link software:
This mode has been introduced in J-Link software V6.30 in order to also allow using RTT on devices / CPU architectures that do not support background memory accesses. This mode affects the real time behavior of the application but can still be used for most target applications.
 
  +
* Much slower than using J-Link with the SEGGER J-Link DLL
  +
* No RTT support
  +
* No HSS support
  +
* No unlimited flash breakpoints support
  +
* No support for any utilities from the SEGGER J-Link software package
  +
* No support from SEGGER
   
  +
== Support ==
In this mode, J-Link temporarily halts the CPU (interrupts the execution of the target application) to access the memory and continues operation automatically after the memory access is done. The actual impact (halted time) on the real time behavior depends on the setup (target interface speed used, target interface used, length of JTAG chain, actual core that is used, ...).
 
  +
Please understand that SEGGER does not provide any support for J-Links used with OpenOCD. The OpenOCD software is released and maintained by a 3rd party. In order to get support, we recommend to get in touch with the OpenOCD community.
 
=== Cores with stop mode support ===
 
* Cortex-A based devices
 
* Cortex-R based devices
 
* RISC-V based devices
 
 
'''Note:''' It is recommended to only use this mode with target interface speeds of '''25 MHz or higher''' (J-Link ULTRA+, J-Link PRO) to keep the effect on the real time behavior as small as possible. [https://www.segger.com/products/debug-probes/j-link/models/model-overview/ J-Link model overview]
 
 
=== Effect on real time behavior ===
 
 
Typical halted times for memory read accesses in stop mode with '''J-Link ULTRA+ @ 50 MHz''':
 
<gallery>
 
File:Wiki-RTT_StopMode_JTAG_50MHz_256B.png|JTAG @ 50 MHz<br>256 bytes, ~552us
 
File:Wiki-RTT_StopMode_JTAG_50MHz_1B.png|JTAG @ 50 MHz<br>4 bytes, ~418us
 
</gallery>
 
 
Typical halted times for memory read accesses in stop mode with '''J-Link PLUS @ 15 MHz''':
 
<gallery>
 
File:Wiki-RTT_StopMode_JTAG_15MHz_256B.png|JTAG @ 15 MHz<br>256 bytes, ~1.02ms
 
File:Wiki-RTT_StopMode_JTAG_15MHz_1B.png|JTAG @ 15 MHz<br>4 bytes, ~718us
 
</gallery>
 

Latest revision as of 10:35, 23 March 2023

OpenOCD is a open and free project to support different debug probes under one "API".

Using J-Link with OpenOCD

In general, it is possible to use J-Link with OpenOCD. OpenOCD handles J-Link as a dumb JTAG/SWD/... probe and only uses the very low level logic to output JTAG/SWD/... sequences. It does not make use of any high level logic etc. and therefore is much slower than the proprietary SEGGER J-Link DLL / GDBServer / ... implementation.

Switching the USB driver to OpenOCD

In order to use J-Link with OpenOCD the standard J-Link USB driver must be replaced with the WinUSB driver, using 3rd party utilities. There are lots of walkthroughs available on the internet.

Note:
Current (since end 2022) models are already shipped by factory configured for WinUSB, so the reconfiguration should no longer be necessary. Some models slightly before that change are not configured for WinUSB by default but can be configured to it via J-Link Configurator

Restoring the USB driver

Once the J-Link USB driver has been replaced, no SEGGER software from the J-Link software package will be able to communicate with J-Link anymore.
To use SEGGER J-Link software again, the USB driver needs to be switched back to its default.
This can be achieved by

  • navigating to the J-Link software installation (by default C:\Program Files\SEGGER\JLink\)
  • navigating to the sub folder USBDriver\
  • Double clicking InstDrivers.exe

Limitations

There are several limitations that apply when using J-Link with OpenOCD instead of the SEGGER J-Link software:

  • Much slower than using J-Link with the SEGGER J-Link DLL
  • No RTT support
  • No HSS support
  • No unlimited flash breakpoints support
  • No support for any utilities from the SEGGER J-Link software package
  • No support from SEGGER

Support

Please understand that SEGGER does not provide any support for J-Links used with OpenOCD. The OpenOCD software is released and maintained by a 3rd party. In order to get support, we recommend to get in touch with the OpenOCD community.