# Scraped: https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing

Title: zephyr/samples/subsys/tracing at main · zephyrproject-rtos/zephyr · GitHub

[Skip to content](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#start-of-content)

You signed in with another tab or window. [Reload](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing) to refresh your session.You signed out in another tab or window. [Reload](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing) to refresh your session.You switched accounts on another tab or window. [Reload](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing) to refresh your session.Dismiss alert

{{ message }}

[zephyrproject-rtos](https://github.com/zephyrproject-rtos)/ **[zephyr](https://github.com/zephyrproject-rtos/zephyr)** Public

- [Notifications](https://github.com/login?return_to=%2Fzephyrproject-rtos%2Fzephyr) You must be signed in to change notification settings
- [Fork\\
8.7k](https://github.com/login?return_to=%2Fzephyrproject-rtos%2Fzephyr)
- [Star\\
14.5k](https://github.com/login?return_to=%2Fzephyrproject-rtos%2Fzephyr)


## Collapse file tree

## Files

main

Search this repository

/

# tracing

/

Copy path

## Directory actions

## More options

More options

## Directory actions

## More options

More options

## Latest commit

![kylebonnici](https://avatars.githubusercontent.com/u/10996496?v=4&size=40)![fabiobaltieri](https://avatars.githubusercontent.com/u/891546?v=4&size=40)

[kylebonnici](https://github.com/zephyrproject-rtos/zephyr/commits?author=kylebonnici)

and

[fabiobaltieri](https://github.com/zephyrproject-rtos/zephyr/commits?author=fabiobaltieri)

[devicetree: format files in samples/subsys](https://github.com/zephyrproject-rtos/zephyr/commit/02f1c8d86c66446840e7031067b0b4cf291067ae)

Open commit details

5 months agoSep 8, 2025

[02f1c8d](https://github.com/zephyrproject-rtos/zephyr/commit/02f1c8d86c66446840e7031067b0b4cf291067ae) · 5 months agoSep 8, 2025

## History

[History](https://github.com/zephyrproject-rtos/zephyr/commits/main/samples/subsys/tracing)

Open commit details

[View commit history for this file.](https://github.com/zephyrproject-rtos/zephyr/commits/main/samples/subsys/tracing) History

/

# tracing

/

Top

## Folders and files

| Name | Name | Last commit message | Last commit date |
| --- | --- | --- | --- |
| ### parent directory<br> [..](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys) |
| [boards](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing/boards "boards") | [boards](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing/boards "boards") | [samples/subsys/tracing: Don't test on native\_posix](https://github.com/zephyrproject-rtos/zephyr/commit/4e93fa62527af9b525440cfcd65dfd398a2abfc1 "samples/subsys/tracing: Don't test on native_posix  native_posix is now deprecated. Building this sample in both native_sim and native_posix does not improve coverage for the sample or subsystem but doubles CI time. As anyhow native_posix will be removed all together in 2 releases, let's remove it already for this sample.  Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>") | 2 years agoSep 25, 2024 |
| [src](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing/src "src") | [src](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing/src "src") | [tracing: port USB backend to the new USB device stack](https://github.com/zephyrproject-rtos/zephyr/commit/1174308df80f45ab056b98a3ec6d35ef53346507 "tracing: port USB backend to the new USB device stack  Port USB backend to the new USB device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 8 months agoJun 17, 2025 |
| [CMakeLists.txt](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/CMakeLists.txt "CMakeLists.txt") | [CMakeLists.txt](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/CMakeLists.txt "CMakeLists.txt") | [tracing: port USB backend to the new USB device stack](https://github.com/zephyrproject-rtos/zephyr/commit/1174308df80f45ab056b98a3ec6d35ef53346507 "tracing: port USB backend to the new USB device stack  Port USB backend to the new USB device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 8 months agoJun 17, 2025 |
| [Kconfig](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/Kconfig "Kconfig") | [Kconfig](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/Kconfig "Kconfig") | [tracing: port USB backend to the new USB device stack](https://github.com/zephyrproject-rtos/zephyr/commit/1174308df80f45ab056b98a3ec6d35ef53346507 "tracing: port USB backend to the new USB device stack  Port USB backend to the new USB device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 8 months agoJun 17, 2025 |
| [README.rst](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/README.rst "README.rst") | [README.rst](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/README.rst "README.rst") | [tracing: port USB backend to the new USB device stack](https://github.com/zephyrproject-rtos/zephyr/commit/1174308df80f45ab056b98a3ec6d35ef53346507 "tracing: port USB backend to the new USB device stack  Port USB backend to the new USB device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 8 months agoJun 17, 2025 |
| [gpio.overlay](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/gpio.overlay "gpio.overlay") | [gpio.overlay](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/gpio.overlay "gpio.overlay") | [devicetree: format files in samples/subsys](https://github.com/zephyrproject-rtos/zephyr/commit/02f1c8d86c66446840e7031067b0b4cf291067ae "devicetree: format files in samples/subsys  Applying dts-linter results for format files in  samples/subsys  Signed-off-by: Kyle Micallef Bonnici <kylebonnici@hotmail.com>") | 5 months agoSep 8, 2025 |
| [prj.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj.conf "prj.conf") | [prj.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj.conf "prj.conf") | [samples/doc: segger: rtt: enhanced tracing/logging](https://github.com/zephyrproject-rtos/zephyr/commit/781b6d7b0ab5b10ec92c8df1f296a89622f5a8ab "samples/doc: segger: rtt: enhanced tracing/logging  Fixes a minor documentation issue and suggests/documents additional RTT tracing and logging options.  Showcases logging via RTT UART which is now available w/o restrictions due to the preceding change. This has been tested on CC13/26xx hardware.  Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>") | 3 years agoAug 6, 2023 |
| [prj\_gpio.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_gpio.conf "prj_gpio.conf") | [prj\_gpio.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_gpio.conf "prj_gpio.conf") | [samples: tracing: update sample app for gpio tracing](https://github.com/zephyrproject-rtos/zephyr/commit/d35640366423a7a0daf78eb5ab9d54a67b850db7 "samples: tracing: update sample app for gpio tracing  Implement a sample app to perform basic GPIO tracing.  Signed-off-by: Alexander Lay <alexanderlay@tenstorrent.com> Signed-off-by: Yang Xu <yangxu@tenstorrent.com>") | 2 years agoDec 4, 2024 |
| [prj\_native\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_native_ctf.conf "prj_native_ctf.conf") | [prj\_native\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_native_ctf.conf "prj_native_ctf.conf") | [services/tracing doc & samples: Replace native\_posix w native\_sim](https://github.com/zephyrproject-rtos/zephyr/commit/b4d0791d1ab727e376924a97acb5f647431fa406 "services/tracing doc & samples: Replace native_posix w native_sim  In the docs replace the references to native_posix with native_sim. In the sample, add overlays for native_sim, and add native_sim to filter and as default integration platform.  Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>") | 3 years agoNov 14, 2023 |
| [prj\_percepio.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_percepio.conf "prj_percepio.conf") | [prj\_percepio.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_percepio.conf "prj_percepio.conf") | [sample: tracing: add a configuration for percepio](https://github.com/zephyrproject-rtos/zephyr/commit/aead5b523b56f63cdec9af097f79ee89ff4d1f46 "sample: tracing: add a configuration for percepio  Add a sample configuration for percepio.  Signed-off-by: Anas Nashif <anas.nashif@intel.com>") | 4 years agoNov 4, 2022 |
| [prj\_uart.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_uart.conf "prj_uart.conf") | [prj\_uart.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_uart.conf "prj_uart.conf") | [tracing: Move to DTS for uart device](https://github.com/zephyrproject-rtos/zephyr/commit/dcfcd05ed397a075f55c4c3ad4b9ad635db53332 "tracing: Move to DTS for uart device  Move from using Kconfig TRACING_BACKEND_UART_NAME to a devicetree chosen property (\"zephyr,tracing-uart\").  This is similar to a number of other functions like \"zephyr,shell-uart\" or \"zephyr,bt-uart\".  Signed-off-by: Kumar Gala <galak@kernel.org>") | 4 years agoJul 19, 2022 |
| [prj\_uart\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_uart_ctf.conf "prj_uart_ctf.conf") | [prj\_uart\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_uart_ctf.conf "prj_uart_ctf.conf") | [tracing: Move to DTS for uart device](https://github.com/zephyrproject-rtos/zephyr/commit/dcfcd05ed397a075f55c4c3ad4b9ad635db53332 "tracing: Move to DTS for uart device  Move from using Kconfig TRACING_BACKEND_UART_NAME to a devicetree chosen property (\"zephyr,tracing-uart\").  This is similar to a number of other functions like \"zephyr,shell-uart\" or \"zephyr,bt-uart\".  Signed-off-by: Kumar Gala <galak@kernel.org>") | 4 years agoJul 19, 2022 |
| [prj\_usb\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_usb_ctf.conf "prj_usb_ctf.conf") | [prj\_usb\_ctf.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_usb_ctf.conf "prj_usb_ctf.conf") | [samples: usb: explicitly disable initialization at boot](https://github.com/zephyrproject-rtos/zephyr/commit/ec9488ceaac3ade5e11091d8cfdec2ffaba898c0 "samples: usb: explicitly disable initialization at boot  To avoid conflicts with boards using the CDC ACM serial backend, explicitly disable initialization at boot.  Similar to commit 11c7371f99ba (\"samples: Explicitly disable boot USB device support init at boot\") addressing it for the legacy device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 6 months agoAug 25, 2025 |
| [prj\_user.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_user.conf "prj_user.conf") | [prj\_user.conf](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/prj_user.conf "prj_user.conf") | [tracing: Fix tracing\_user config](https://github.com/zephyrproject-rtos/zephyr/commit/1fd29fb131475bb594e1fe8564a79d436d317cc6 "tracing: Fix tracing_user config  `tracing_user.h` lost several definitions, which made CONFIG_TRACING_USER build fail. This fixes the TRACING_USER config & adds it to the test case.  Moreover, the idle task stack is overflow on qemu_x86, qemu_cortex_m0 & qemu_riscv64. This makes the test fail. So this commit sets the idle stack size to 2048 for this sample to avoid it.  Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>") | 5 years agoJan 11, 2022 |
| [sample.yaml](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/sample.yaml "sample.yaml") | [sample.yaml](https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/tracing/sample.yaml "sample.yaml") | [tracing: port USB backend to the new USB device stack](https://github.com/zephyrproject-rtos/zephyr/commit/1174308df80f45ab056b98a3ec6d35ef53346507 "tracing: port USB backend to the new USB device stack  Port USB backend to the new USB device stack.  Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>") | 8 months agoJun 17, 2025 |
| View all files |

## [README.rst](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing\#readme)

Outline

```
.. zephyr:code-sample:: tracing
   :name: Tracing

   Send tracing formatted packet to the host with supported backends.
```

This application can be used to demonstrate the tracing feature. The tracing
formatted packet will be sent to the host with the currently supported tracing
backend under tracing generic infrastructure.

## Requirements

[Permalink: Requirements](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#requirements)

Depends of the boards which you are using, choose one of .conf files for use tracing subsys.

## Usage for UART Tracing Backend

[Permalink: Usage for UART Tracing Backend](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-uart-tracing-backend)

Build a UART-tracing image with:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: mps2/an521
        :conf: "prj_uart.conf"
        :goals: build
        :compact:
```

or:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: mps2/an521
        :conf: "prj_uart_ctf.conf"
        :goals: build
        :compact:
```

Note

You may need to set "zephyr,tracing-uart" property under the chosen node in your devicetree.
See [:zephyr\_file:\`samples/subsys/tracing/boards/mps2\_an521\_cpu0.overlay\`](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#id1) for an example.

After the application has run for a while, check the trace output file.

## Usage for USB Tracing Backend

[Permalink: Usage for USB Tracing Backend](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-usb-tracing-backend)

Build a USB-tracing image with:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: reel_board
        :conf: "prj_usb_ctf.conf"
        :goals: build
        :compact:
```

After the serial console has stable output like this:

```
threadA: Hello World!
threadB: Hello World!
threadA: Hello World!
threadB: Hello World!
```

Connect the board's USB port to the host device and
run the [:zephyr\_file:\`scripts/tracing/trace\_capture\_usb.py\`](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#id3) script on the host:

```
sudo python3 trace_capture_usb.py -v 0x2FE3 -p 0x0001 -o channel0_0
```

The VID and PID of USB device can be configured, just adjusting it accordingly.

## Usage for POSIX Tracing Backend

[Permalink: Usage for POSIX Tracing Backend](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-posix-tracing-backend)

Build a POSIX-tracing image with:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: native_sim
        :goals: build
        :compact:
```

or:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: native_sim
        :conf: "prj_native_ctf.conf"
        :goals: build
        :compact:
```

After the application has run for a while, check the trace output file.

## Usage for USER Tracing Backend

[Permalink: Usage for USER Tracing Backend](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-user-tracing-backend)

Build a USER-tracing image with:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: qemu_x86
        :conf: "prj_user.conf"
        :goals: build
        :compact:
```

After the application has run for a while, check the trace output file.

## Usage for SEGGER SystemView RTT

[Permalink: Usage for SEGGER SystemView RTT](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-segger-systemview-rtt)

Build a SystemView-tracing image with the [:ref:\`snippet-rtt-tracing\`](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#id5):

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: frdm_k64f
        :snippets: rtt-tracing
        :goals: build
        :compact:
```

After the application has run for a while, check the trace output file.

## Usage for GPIO Tracing Backend

[Permalink: Usage for GPIO Tracing Backend](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/tracing#usage-for-gpio-tracing-backend)

Build a GPIO-tracing image with:

```
.. zephyr-app-commands::
        :zephyr-app: samples/subsys/tracing
        :board: native_sim
        :conf: "prj_gpio.conf"
        :goals: build
        :compact:
```

After the application has run for a while, check the trace output file.

You can’t perform that action at this time.