1.. zephyr:code-sample:: tracing 2 :name: Tracing 3 4 Send tracing formatted packet to the host with supported backends. 5 6This application can be used to demonstrate the tracing feature. The tracing 7formatted packet will be sent to the host with the currently supported tracing 8backend under tracing generic infrastructure. 9 10Requirements 11************ 12 13Depends of the boards which you are using, choose one of .conf files for use tracing subsys. 14 15Usage for UART Tracing Backend 16****************************** 17 18Build a UART-tracing image with: 19 20.. zephyr-app-commands:: 21 :zephyr-app: samples/subsys/tracing 22 :board: mps2/an521 23 :conf: "prj_uart.conf" 24 :goals: build 25 :compact: 26 27or: 28 29.. zephyr-app-commands:: 30 :zephyr-app: samples/subsys/tracing 31 :board: mps2/an521 32 :conf: "prj_uart_ctf.conf" 33 :goals: build 34 :compact: 35 36.. note:: 37 You may need to set "zephyr,tracing-uart" property under the chosen node in your devicetree. 38 See :zephyr_file:`samples/subsys/tracing/boards/mps2_an521_cpu0.overlay` for an example. 39 40After the application has run for a while, check the trace output file. 41 42Usage for USB Tracing Backend 43***************************** 44 45Build a USB-tracing image with: 46 47.. zephyr-app-commands:: 48 :zephyr-app: samples/subsys/tracing 49 :board: sam_e70_xplained/same70q21 50 :conf: "prj_usb.conf" 51 :goals: build 52 :compact: 53 54or: 55 56.. zephyr-app-commands:: 57 :zephyr-app: samples/subsys/tracing 58 :board: sam_e70_xplained/same70q21 59 :conf: "prj_usb_ctf.conf" 60 :goals: build 61 :compact: 62 63After the serial console has stable output like this: 64 65.. code-block:: console 66 67 threadA: Hello World! 68 threadB: Hello World! 69 threadA: Hello World! 70 threadB: Hello World! 71 72Connect the board's USB port to the host device and 73run the :zephyr_file:`scripts/tracing/trace_capture_usb.py` script on the host: 74 75.. code-block:: console 76 77 sudo python3 trace_capture_usb.py -v 0x2FE9 -p 0x100 -o channel0_0 78 79The VID and PID of USB device can be configured, just adjusting it accordingly. 80 81Usage for POSIX Tracing Backend 82******************************* 83 84Build a POSIX-tracing image with: 85 86.. zephyr-app-commands:: 87 :zephyr-app: samples/subsys/tracing 88 :board: native_sim 89 :goals: build 90 :compact: 91 92or: 93 94.. zephyr-app-commands:: 95 :zephyr-app: samples/subsys/tracing 96 :board: native_sim 97 :conf: "prj_native_ctf.conf" 98 :goals: build 99 :compact: 100 101After the application has run for a while, check the trace output file. 102 103Usage for USER Tracing Backend 104******************************* 105 106Build a USER-tracing image with: 107 108.. zephyr-app-commands:: 109 :zephyr-app: samples/subsys/tracing 110 :board: qemu_x86 111 :conf: "prj_user.conf" 112 :goals: build 113 :compact: 114 115After the application has run for a while, check the trace output file. 116 117Usage for SEGGER SystemView RTT 118******************************* 119 120Build a SystemView-tracing image with the :ref:`snippet-rtt-tracing`: 121 122.. zephyr-app-commands:: 123 :zephyr-app: samples/subsys/tracing 124 :board: frdm_k64f 125 :snippets: rtt-tracing 126 :goals: build 127 :compact: 128 129After the application has run for a while, check the trace output file. 130 131Usage for GPIO Tracing Backend 132******************************* 133 134Build a GPIO-tracing image with: 135 136.. zephyr-app-commands:: 137 :zephyr-app: samples/subsys/tracing 138 :board: native_sim 139 :conf: "prj_gpio.conf" 140 :goals: build 141 :compact: 142 143After the application has run for a while, check the trace output file. 144