|
| 1 | +.. _debug-probes: |
| 2 | + |
| 3 | +Debug Probes |
| 4 | +############ |
| 5 | + |
| 6 | +A *debug probe* is special hardware which allows you to control execution of a |
| 7 | +Zephyr application running on a separate board. Debug probes usually allow |
| 8 | +reading and writing registers and memory, and support breakpoint debugging of |
| 9 | +the Zephyr application on your host workstation using tools like GDB. They may |
| 10 | +also support other debug software and more advanced features such as |
| 11 | +:ref:`tracing program execution <tracing>`. For details on the related host |
| 12 | +software supported by Zephyr, see :ref:`debug-host-tools`. |
| 13 | + |
| 14 | +Debug probes are usually connected to your host workstation via USB; they |
| 15 | +are sometimes also accessible via an IP network or other means. They usually |
| 16 | +connect to the device running Zephyr using the JTAG or SWD protocols. Debug |
| 17 | +probes are either separate hardware devices or circuitry integrated into the same |
| 18 | +board which runs Zephyr. |
| 19 | + |
| 20 | +Many supported boards in Zephyr include a second microcontroller that serves as |
| 21 | +an onboard debug probe, usb-to-serial adapter, and sometimes a drag-and-drop |
| 22 | +flash programmer. This eliminates the need to purchase an external debug probe |
| 23 | +and provides a variety of debug host tool options. |
| 24 | + |
| 25 | +Several hardware vendors have their own branded onboard debug probe |
| 26 | +implementations: NXP LPC boards have LPC-Link2, NXP Kinetis (former Freescale) |
| 27 | +boards have OpenSDA, and ST boards have ST-LINK. Each onboard debug probe |
| 28 | +microcontroller can support one or more types of firmware that communicate with |
| 29 | +their respective debug host tools. For example, an OpenSDA microcontroller can |
| 30 | +be programmed with DAPLink firmware to communicate with pyOCD or OpenOCD debug |
| 31 | +host tools, or with J-Link firmware to communicate with J-Link debug host |
| 32 | +tools. |
| 33 | + |
| 34 | +Some supported boards in Zephyr do not include an onboard debug probe and |
| 35 | +therefore require an external debug probe. In addition, boards that do include |
| 36 | +an onboard debug probe often also have an SWD or JTAG header to enable the use |
| 37 | +of an external debug probe instead. One reason this may be useful is that the |
| 38 | +onboard debug probe may have limitations, such as lack of support for advanced |
| 39 | +debuggers or high-speed tracing. You may need to adjust jumpers to prevent the |
| 40 | +onboard debug probe from interfering with the external debug probe. |
| 41 | + |
| 42 | +.. _lpclink2-jlink-onboard-debug-probe: |
| 43 | + |
| 44 | +LPC-Link2 J-Link Onboard Debug Probe |
| 45 | +************************************ |
| 46 | + |
| 47 | +The LPC-Link2 J-Link is an onboard debug probe and usb-to-serial adapter |
| 48 | +supported on many NXP LPC and i.MX RT development boards. |
| 49 | + |
| 50 | +This debug probe is compatible with the following debug host tools: |
| 51 | + |
| 52 | +- :ref:`jlink-debug-host-tools` |
| 53 | + |
| 54 | +This probe is realized by programming the LPC-Link2 microcontroller with J-Link |
| 55 | +LPC-Link2 firmware. Download and install `LPCScrypt`_ to get the firmware and |
| 56 | +programming scripts. |
| 57 | + |
| 58 | +1. Put the LPC-Link2 microcontroller into DFU boot mode by attaching the DFU |
| 59 | + jumper, then powering up the board. |
| 60 | + |
| 61 | +#. Run the ``program_JLINK`` script. |
| 62 | + |
| 63 | +#. Remove the DFU jumper and power cycle the board. |
| 64 | + |
| 65 | +.. _opensda-daplink-onboard-debug-probe: |
| 66 | + |
| 67 | +OpenSDA DAPLink Onboard Debug Probe |
| 68 | +*********************************** |
| 69 | + |
| 70 | +The OpenSDA DAPLink is an onboard debug probe and usb-to-serial adapter |
| 71 | +supported on many NXP Kinetis and i.MX RT development boards. It also includes |
| 72 | +drag-and-drop flash programming support. |
| 73 | + |
| 74 | +This debug probe is compatible with the following debug host tools: |
| 75 | + |
| 76 | +- :ref:`pyocd-debug-host-tools` |
| 77 | +- :ref:`openocd-debug-host-tools` |
| 78 | + |
| 79 | +This probe is realized by programming the OpenSDA microcontroller with DAPLink |
| 80 | +OpenSDA firmware. NXP provides `OpenSDA DAPLink Board-Specific Firmwares`_. |
| 81 | + |
| 82 | +Before you program the firmware, make sure to install the debug host tools |
| 83 | +first. |
| 84 | + |
| 85 | +As with all OpenSDA debug probes, the steps for programming the firmware are: |
| 86 | + |
| 87 | +1. Put the OpenSDA microcontroller into bootloader mode by holding the reset |
| 88 | + button while you power on the board. Note that "bootloader mode" in this |
| 89 | + context applies to the OpenSDA microcontroller itself, not the target |
| 90 | + microcontroller of your Zephyr application. |
| 91 | + |
| 92 | +#. After you power on the board, release the reset button. A USB mass storage |
| 93 | + device called **BOOTLOADER** or **MAINTENANCE** will enumerate. |
| 94 | + |
| 95 | +#. Copy the OpenSDA firmware binary to the USB mass storage device. |
| 96 | + |
| 97 | +#. Power cycle the board, this time without holding the reset button. You |
| 98 | + should see three USB devices enumerate: a CDC device (serial port), a HID |
| 99 | + device (debug port), and a mass storage device (drag-and-drop flash |
| 100 | + programming). |
| 101 | + |
| 102 | +.. _opensda-jlink-onboard-debug-probe: |
| 103 | + |
| 104 | +OpenSDA J-Link Onboard Debug Probe |
| 105 | +********************************** |
| 106 | + |
| 107 | +The OpenSDA J-Link is an onboard debug probe and usb-to-serial adapter |
| 108 | +supported on many NXP Kinetis and i.MX RT development boards. |
| 109 | + |
| 110 | +This debug probe is compatible with the following debug host tools: |
| 111 | + |
| 112 | +- :ref:`jlink-debug-host-tools` |
| 113 | + |
| 114 | +This probe is realized by programming the OpenSDA microcontroller with J-Link |
| 115 | +OpenSDA firmware. Segger provides `OpenSDA J-Link Generic Firmwares`_ and |
| 116 | +`OpenSDA J-Link Board-Specific Firmwares`_, where the latter is generally |
| 117 | +recommended when available. Board-specific firmwares are required for i.MX RT |
| 118 | +boards to support their external flash memories, whereas generic firmwares are |
| 119 | +compatible with all Kinetis boards. |
| 120 | + |
| 121 | +Before you program the firmware, make sure to install the debug host tools |
| 122 | +first. |
| 123 | + |
| 124 | +As with all OpenSDA debug probes, the steps for programming the firmware are: |
| 125 | + |
| 126 | +1. Put the OpenSDA microcontroller into bootloader mode by holding the reset |
| 127 | + button while you power on the board. Note that "bootloader mode" in this |
| 128 | + context applies to the OpenSDA microcontroller itself, not the target |
| 129 | + microcontroller of your Zephyr application. |
| 130 | + |
| 131 | +#. After you power on the board, release the reset button. A USB mass storage |
| 132 | + device called **BOOTLOADER** or **MAINTENANCE** will enumerate. |
| 133 | + |
| 134 | +#. Copy the OpenSDA firmware binary to the USB mass storage device. |
| 135 | + |
| 136 | +#. Power cycle the board, this time without holding the reset button. You |
| 137 | + should see two USB devices enumerate: a CDC device (serial port) and a |
| 138 | + vendor-specific device (debug port). |
| 139 | + |
| 140 | +.. _jlink-external-debug-probe: |
| 141 | + |
| 142 | +J-Link External Debug Probe |
| 143 | +*************************** |
| 144 | + |
| 145 | +`Segger J-Link`_ is a family of external debug probes, including J-Link EDU, |
| 146 | +J-Link PLUS, J-Link ULTRA+, and J-Link PRO, that support a large number of |
| 147 | +devices from different hardware architectures and vendors. |
| 148 | + |
| 149 | +This debug probe is compatible with the following debug host tools: |
| 150 | + |
| 151 | +- :ref:`jlink-debug-host-tools` |
| 152 | +- :ref:`openocd-debug-host-tools` |
| 153 | + |
| 154 | +Before you use this debug probe, make sure to install the debug host tools |
| 155 | +first. |
| 156 | + |
| 157 | +.. _LPCScrypt: |
| 158 | + https://www.nxp.com/lpcscrypt |
| 159 | + |
| 160 | +.. _OpenSDA DAPLink Board-Specific Firmwares: |
| 161 | + https://www.nxp.com/opensda |
| 162 | + |
| 163 | +.. _OpenSDA J-Link Generic Firmwares: |
| 164 | + https://www.segger.com/downloads/jlink/#JLinkOpenSDAGenericFirmwares |
| 165 | + |
| 166 | +.. _OpenSDA J-Link Board-Specific Firmwares: |
| 167 | + https://www.segger.com/downloads/jlink/#JLinkOpenSDABoardSpecificFirmwares |
| 168 | + |
| 169 | +.. _Segger J-Link: |
| 170 | + https://www.segger.com/products/debug-probes/j-link/ |
0 commit comments