J-Trace: Difference between revisions
(16 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[https://www.segger.com/products/debug-probes/j-trace/ J-Trace] is a SEGGER debug and trace probe, specialized on live instruction tracing. | [https://www.segger.com/products/debug-probes/j-trace/ J-Trace] is a SEGGER debug and trace probe, specialized on live instruction tracing. | ||
Line 23: | Line 17: | ||
** [[ETB]] | ** [[ETB]] | ||
** [[TMC]] | ** [[TMC]] | ||
* [ | ** [[STM]] | ||
== Available Trace features == | == Available Trace features == | ||
Line 43: | Line 37: | ||
* [[J-Link_Command_Strings#TraceFile | Trace to file]] | * [[J-Link_Command_Strings#TraceFile | Trace to file]] | ||
* [[Automated_Tests_with_Ozone#Trace_example | Trace automation with Ozone]] | * [[Automated_Tests_with_Ozone#Trace_example | Trace automation with Ozone]] | ||
* [[Trace_Start_Stop_Points | Trace Start/Stop Points]] | |||
== Tested devices == | == Tested devices == | ||
Line 50: | Line 45: | ||
Together with the J-Trace Pro, a trace reference board is shipped. | Together with the J-Trace Pro, a trace reference board is shipped. | ||
For this board, a trace tutorial project is available on the [https://www.segger.com/products/development-tools/ozone-j-link-debugger/technology | For this board, a trace tutorial project is available on the [https://www.segger.com/products/development-tools/ozone-j-link-debugger/technology/ozone-trace-tutorial/ SEGGER homepage]. | ||
== Setting up Trace with J-Trace == | == Setting up Trace with J-Trace == | ||
<!--- TBD: Compare with https://www.segger.com/products/debug-probes/j-trace/technology/setting-up-trace/ ---> | <!--- TBD: Compare with https://www.segger.com/products/debug-probes/j-trace/technology/setting-up-trace/ ---> | ||
If no example project is available for a specific device | If no example project is available for a specific device an example project can be requested via the [https://www.segger.com/support/technical-support/ official SEGGER Technical support]. Alternatively, support can also be added manually which is explained below. | ||
=== Pinout / Trace debug interface === | === Pinout / Trace debug interface === | ||
Line 61: | Line 56: | ||
The trace pinout (19-pin) used by J-Trace can be used with JTAG and SWD: | The trace pinout (19-pin) used by J-Trace can be used with JTAG and SWD: | ||
* [[ | * [[19-pin_JTAG/SWD_and_Trace_Connector | Trace pinout]] | ||
* [[How_to_connect_JTAG_nTRST_when_using_19-pin_trace_header | Connect nTRST using 19-pin trace header]] | * [[How_to_connect_JTAG_nTRST_when_using_19-pin_trace_header | Connect nTRST using 19-pin trace header]] | ||
====Trace pin initialization==== | |||
The pins, clocks, etc. required for tracing can be initialized either via the device application, or via a [[J-Link_script_files | J-Link Script file]]. | The pins, clocks, etc. required for tracing can be initialized either via the device application, or via a [[J-Link_script_files | J-Link Script file]]. | ||
Using a J-Link script file is generally recommended, as otherwise the init section of the code will not be traced when initializing trace from the target application. Another benefit is that by using a J-Link Script file you guarantee that not debug code gets overlooked and | Using a J-Link script file is generally recommended, as otherwise the init section of the code will not be traced when initializing trace from the target application. Another benefit is that by using a J-Link Script file you guarantee that not debug code gets overlooked and accidentally stays in your final product code. In some rare cases it might also be the case that the Arm specific registers must not be written by the J-Trace probe before they have been clocked by a chip specific init. So doing the init via the target application would be way too late. The J-Link script makes sure everything is initialized at the correct time to avoid such issues. | ||
* [[How_to_configure_JLinkScript_files_to_enable_tracing | Guide how to initialize trace pins via J-Link Script file]]. | * [[How_to_configure_JLinkScript_files_to_enable_tracing | Guide how to initialize trace pins via J-Link Script file]]. | ||
Line 77: | Line 74: | ||
* [[Keil_MDK-ARM#Trace_support | KEIL MDK]] | * [[Keil_MDK-ARM#Trace_support | KEIL MDK]] | ||
* [[Renesas_e%C2%B2studio#Enabling_Trace| e2Studio]] | * [[Renesas_e%C2%B2studio#Enabling_Trace| e2Studio]] | ||
* IAR | * IAR: See IAR documentation for reference. Trace settings and inits are completely handled via the IDE. | ||
=== Technical specification === | === Technical specification === | ||
* [[Arm trace technical specification]] | * [[Arm trace technical specification]] | ||
* [[RISC-V N-Trace technical specification]] | |||
* [[Trace board design recommendations]] | * [[Trace board design recommendations]] | ||
* [[Debug setup considerations when tracing]] | * [[Debug setup considerations when tracing]] | ||
Line 88: | Line 86: | ||
=== Trace related === | === Trace related === | ||
* [ | * [[Adjusting trace timings and general troubleshooting]] | ||
* [[Ozone_Debug_and_Trace_with_RAM_Functions | Debug & Trace with RAM Functions / reading into trace cache]] | * [[Ozone_Debug_and_Trace_with_RAM_Functions | Debug & Trace with RAM Functions / reading into trace cache]] | ||
* [[J-Trace_overflow_error | Handling J-Trace overflow errors]] | * [[J-Trace_overflow_error | Handling J-Trace overflow errors]] | ||
* [[Getting_unknown_addresses_in_instruction_trace | Tracing modified code]] | * [[Getting_unknown_addresses_in_instruction_trace | Tracing modified code]] | ||
* [[Unknown Trace Data Packet Error]] | |||
=== J-Trace Probe / driver related === | === J-Trace Probe / driver related === | ||
Line 99: | Line 98: | ||
=== FAQ === | === FAQ === | ||
* [[J-Trace vs. J-Trace_PRO | Reasons to upgrade your older J-Trace CM model to a J-Trace Pro]] | * [[J-Trace vs. J-Trace_PRO | Reasons to upgrade your older J-Trace CM model to a J-Trace Pro]] | ||
* [[Setting_up_Ethernet_interface#Setting_up_direct_connection_without_DHCP_to_the_host_PC.27s_Ethernet_interface | How to connect the J-Trace Pro directly via Ethernet to host PC without a router or switch]] |
Latest revision as of 15:42, 4 August 2025
J-Trace is a SEGGER debug and trace probe, specialized on live instruction tracing.
For the full feature set and best performance, it is recommended to use J-Trace in combination with the Ozone debugger.
For purchasing information and technical specification, please refer to the SEGGER homepage
General information about tracing
- General information about different trace types
- General information about Arm Coresight trace elements:
Available Trace features
Some trace features are only available for the J-Trace Pro series. For more information see below.
J-Link
J-Trace Pro
- J-Trace Pro supports all of the features listed above and additionally the following.
- Realtime/Streaming Trace
- Live code coverage
- Live code profiling
- Backtrace
- Trace to file
- Trace automation with Ozone
- Trace Start/Stop Points
Tested devices
The tested devices page on the SEGGER homepage contains a variety of different devices, that trace support has been tested with. For these devices example projects are available, including J-Link script files containing the required (pin) init. This is usually the best starting point if you want to trace a device, as it provides an out of the box experience.
Together with the J-Trace Pro, a trace reference board is shipped. For this board, a trace tutorial project is available on the SEGGER homepage.
Setting up Trace with J-Trace
If no example project is available for a specific device an example project can be requested via the official SEGGER Technical support. Alternatively, support can also be added manually which is explained below.
Pinout / Trace debug interface
Usually, devices provide multiple trace pin combinations to use trace with. This also means, that the pins have to be initialized before tracing can work.
The trace pinout (19-pin) used by J-Trace can be used with JTAG and SWD:
Trace pin initialization
The pins, clocks, etc. required for tracing can be initialized either via the device application, or via a J-Link Script file. Using a J-Link script file is generally recommended, as otherwise the init section of the code will not be traced when initializing trace from the target application. Another benefit is that by using a J-Link Script file you guarantee that not debug code gets overlooked and accidentally stays in your final product code. In some rare cases it might also be the case that the Arm specific registers must not be written by the J-Trace probe before they have been clocked by a chip specific init. So doing the init via the target application would be way too late. The J-Link script makes sure everything is initialized at the correct time to avoid such issues.
Setting up Trace with Ozone
Setting up Trace with different IDEs
- Embedded Studio
- KEIL MDK
- e2Studio
- IAR: See IAR documentation for reference. Trace settings and inits are completely handled via the IDE.
Technical specification
- Arm trace technical specification
- RISC-V N-Trace technical specification
- Trace board design recommendations
- Debug setup considerations when tracing
Trouble shooting
In this section multiple trouble shooting articles are referenced.
- Adjusting trace timings and general troubleshooting
- Debug & Trace with RAM Functions / reading into trace cache
- Handling J-Trace overflow errors
- Tracing modified code
- Unknown Trace Data Packet Error
- J-Trace driver issue (driver could not be started)
- USB driver not found / J-Trace detected as HP printer BIDI