Skip to content
72 changes: 72 additions & 0 deletions docs/JLink-Debugger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Segger J-Link Debugger

!!! Note
- This section contains preliminary information and is work-in-progress.

The CMSIS-Toolbox organizes for debuggers projects and configuration options.
This chapter explains the usage of the [Segger J-Link GDB Server](https://kb.segger.com/J-Link_GDB_Server) in combination with the CMSIS-Toolbox.

- [Extended Options](#extended-options) explains additional configuration features that are required in specific use-cases.

Other manual sections describe how to configure debuggers:

- [Run and Debug Configuration](build-overview.md#run-and-debug-configuration) explains overall structure and how projects and images are configured.
- [Debugger Configuration - J-Link Server](YML-Input-Format.md#j-link-server) contains details about the options that are specific to J-Link.

## Extended Options

The section [Debugger Configuration - J-Link Server](YML-Input-Format.md#j-link-server) contains the J-Link configuration for typical systems.

### `connect:`

Configures the behavior for connecting J-Link to the hardware target for interactive debug.

`connect:` | | Description
:---------------------------------------------------------|-------------|:------------------------------------
    `mode:` |**Required** | Selects the connect mode: `attach`, `halt` (default).

Connect Mode | Description
:-------------|:--------------------------------------
`attach` | Do not change state of the core(s). No reset is executed.
`halt` | Halt core(s) after connect.

### `reset:`

Configures the reset behavior for each core when a reset is requested during interactive debug.

`reset:` | | Description
:---------------------------------------------------------|-------------|:------------------------------------
`- pname:` | Optional | Identifies the processor (not requried for single core system).
    `type:` |**Required** | Selects the reset type: `hardware`, `system` (default), `core`.

Reset Types | Description
:-------------|:--------------------------------------
`hardware` | Use the J-Link [`reset pin`](https://kb.segger.com/J-Link_Reset_Strategies#Type_2:_reset_pin) reset mode.
`system` | Use the J-Link [`normal`](https://kb.segger.com/J-Link_Reset_Strategies#Type_0:_normal) reset mode.
`core` | Use the J-Link [`core`](https://kb.segger.com/J-Link_Reset_Strategies#Type_1:_core) reset mode.

**Examples:**

```yml
debugger:
name: J-Link Server # default connect, halt and reset behavior
```

```yml
debugger:
name: J-Link Server
connect: attach # connect without reset and without CPU state change
reset:
- type: system # use system reset
```

```yml
debugger:
name: J-Link Server
connect: halt # halt CPU after connect
reset:
- pname: Core0 # for Core0
type: hardware # use hardware reset
- pname: Core1 # for Core1
type: core # use core reset
```
32 changes: 20 additions & 12 deletions docs/YML-Input-Format.md
Original file line number Diff line number Diff line change
Expand Up @@ -2438,7 +2438,7 @@ Debug Adapter `name:` | Description
[`<adapter>@Arm-Debugger`](#arm-debugger) | Debug Adapters that interface via the Arm-Debugger.
[`Arm-FVP`](#arm-fvp) | [FVP](https://arm-software.github.io/AVH/main/simulation/html/index.html) simulation models that represent processor sub-systems.
[`Keil uVision`](#keil-uvision) | [uVision Debugger](http://developer.arm.com/documentation/101407/0543/Debugging) that is integrated in the Keil uVision IDE.
[`JLink Server`](#jlink-server) | [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/) debug probes that connect using the JLink Server.
[`J-Link Server`](#j-link-server) | [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/) debug probes that connect using the J-Link Server.

The [Arm CMSIS Solution](https://marketplace.visualstudio.com/items?itemName=Arm.cmsis-csolution) VS Code extension uses the `debugger:` node to create entries in the files `.vscode/tasks.json` and `.vscode/launch.json` for running and debugging using the specified debug adapter. [`pyOCD`](#pyocd) supports a command-line mode that uses the [`*.cbuild-run.yml`](YML-CBuild-Format.md#run-and-debug-management) file which is created by the CMSIS-Toolbox.

Expand Down Expand Up @@ -2628,50 +2628,58 @@ debugger:
name: Keil uVision
```

### JLink Server
### J-Link Server

This section lists options that are specific for the [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/) debug probes.
This section lists options that are specific for the [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/) debug probes.

#### `debugger:` for JLink Server
[Extended options](JLink-Debugger.md#extended-options) are required for rare use cases and further tailor the behaviour of J-Link Server.

#### `debugger:` for J-Link Server

debugger: | | Description
:---------------------------------|:------------|:-----------------------------------------------
&nbsp;&nbsp;&nbsp; `name:` |**Required** | Identifies the debug adapter with `<adapter>@pyOCD`.
&nbsp;&nbsp;&nbsp; `clock:` | Optional | Debug clock speed in Hz.
&nbsp;&nbsp;&nbsp; `protocol:` | Optional | Debug portocol (jtag or swd).
&nbsp;&nbsp;&nbsp; [`telnet:`](#telnet-for-jlink-server) | Optional | Telnet service configuration.
&nbsp;&nbsp;&nbsp; [`trace:`](#trace-for-jlink-server) | Optional | Trace configuration.
&nbsp;&nbsp;&nbsp; [`telnet:`](#telnet-for-j-link-server) | Optional | Telnet service configuration.
&nbsp;&nbsp;&nbsp; [`trace:`](#trace-for-j-link-server) | Optional | Trace configuration.
&nbsp;&nbsp;&nbsp; [`connect:`](JLink-Debugger.md#connect) | Optional | Extended Option: Connect mode to hardware.
&nbsp;&nbsp;&nbsp; [`reset:`](JLink-Debugger.md#reset) | Optional | Extended Option: Reset type configuration for various cores.

**Examples:**

```yml
debugger:
name: JLink Server
name: J-Link Server
clock: 4000 # 4000 kHz
protocol: swd
```

#### `telnet:` for JLink Server
#### `telnet:` for J-Link Server

!!! Note
The `telnet:` feature will be implemented until Dec 2025. This section is only a preview.

J-Link supports a Telnet service that connects to character I/O funtions. Character I/O is supported via Semihosting (or Segger RTT channel 0). Currently only semihosting is configured for the primiary core.
J-Link supports a Telnet service that connects to character I/O funtions. Character I/O is supported via Semihosting (or Segger RTT channel 0). Currently only semihosting is configured for the primary core.

`telnet:` | | Description
:---------------------------------------------------------|-------------|:------------------------------------
`- mode:` |**Required** | Redirect output: `server`, `monitor`.
`- mode:` |**Required** | Redirect output: `server`, `console`, `monitor`, `off` (default).
&nbsp;&nbsp;&nbsp; `pname:` | Optional | Identifies the processor (not requried for single core system).
&nbsp;&nbsp;&nbsp; `port:` | Optional | Set TCP/IP port number of Telnet Server (default: 4444, 4445, ... incremented for each processor).

Telnet Mode | Description
:-------------|:--------------------------------------
`server` | Serial I/O to Telnet server port
`console` | Serial output to console (Debug console in VS Code).
`monitor` | Serial I/O via TCP/IP port to VS Code Serial Monitor.
`off` | Serial I/O disabled.

!!! Note
- When no `telnet` node is applied Serial I/O is disabled.
- The Telnet service is always enabled for the J-Link GDB Server. The mode `off` turns off the data source (semihosting, Segger RTT).
- When no `telnet` node is added then Serial I/O to all processors is set to mode `off`.

#### `trace:` for JLink Server
#### `trace:` for J-Link Server

!!! Note
The `trace:` feature is Work-In-Progress and will be completed in Q1'26.
Expand Down
4 changes: 2 additions & 2 deletions docs/build-operation.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ debug-adapters:
protocol: swd
clock: 10000000

- name: "JLink Server"
- name: "J-Link Server"
template: jlink.adapter.json # template file
defaults: # default values to use when nowhere specified
port: 3333 # default value of first gdbserver port
Expand Down Expand Up @@ -515,7 +515,7 @@ debug-adapters:
range: [1, 100000]
default: 4444

- name: "JLink Server"
- name: "J-Link Server"
- section: Debug Interface
description: Interface configuration for the debug port
options:
Expand Down
4 changes: 2 additions & 2 deletions docs/build-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This chapter outlines the structure of *csolution project files* that contain th
- [Directory Structure](#directory-structure) describes the overall directory structure of projects.
- [Linker Script Management](#linker-script-management) defines the available memory and controls the linker operation.
- [Generator Support](#generator-support) integrates configuration tools such as STM32CubeMX or MCUXpresso Config.
- [Run and Debug Configuration](#run-and-debug-configuration) explains how to configure debug adapters such as CMSIS-DAP or JLink.
- [Run and Debug Configuration](#run-and-debug-configuration) explains how to configure debug adapters such as CMSIS-DAP or J-Link.
- [West Build System Integration](#west-build-system-integration) allows to manage Zephyr applications in context with a *csolution project*.

## Overview of Operation
Expand Down Expand Up @@ -1009,7 +1009,7 @@ solution:
target-set:
- set:
debugger:
name: JLink Server
name: J-Link Server
port: 3333
protocol: swd
images:
Expand Down
Loading