DSP Debugging

Preparation

Before debugging the DSP, ensure the following installations are complete:

  1. Install the xt-ocd tool: Refer to Install Debug Plugin. xt-ocd supports DSP debugging using J-Link debugger via SWD protocol.

  2. Install J-Link driver: The version we use is V6.44. Newer versions should also work but have not been tested.

Debugging Methods

When using Xplorer to debug the DSP core, it is recommended to first erase the entire Flash, then download only the KM4/KR4 firmware. During debugging startup, the DSP firmware will be loaded directly into PSRAM via J-Link.

  1. Click Debug Configurations…

    ../_images/press_debug_configurations.png
  2. Select Xtensa On Chip Debug, then create a new debug configuration. Check the Use XOCD Manager option and click the Connect button. After refreshing the OCD Version, select the 14.08 version.

    Topology File should select the C:Program Files (x86)TensilicaXtensa OCD Daemon 14.08topology.xml edited in the previous section. Connection Type should be SWD.

    ../_images/xtensa_on_chip_debug_in_debug_configuration.png
  3. Select core0, set Download binary to Always. Then click Apply and Debug.

    ../_images/set_download_binary_to_always.png
  4. By default, the DSP core will stop at the first line of the main function. To check memory values, it is recommended to use Bounded Memory and manually refresh the memory table when memory values change.

    ../_images/use_bounded_memory_to_check_memory.png

Debugging Tips

  • If you cannot connect to the debug port, it may be because the SWD port is disabled (SWD port is used as a regular GPIO). You need to enable the SWD function for the GPIO.

  • Generate DSP disassembly and map files: Build Debug Files.

  • For convenience in Linux environment, you can add the following paths to PATH:

    /opt/Tensilica/xocd-14.08
    /opt/xtensa/XtDevTools/install/tools/RI-2021.8-linux/XtensaTools/bin
    
  • If you use auto_build.sh instead of Xplorer to build the project, you can find the project_dsp elf file at: <dsp_sdk>/auto_ws/project_dsp/bin/<configuration_name>/Release

  • For more debugging guides, please refer to Xtensa Documentation.

xt-ocd Debugging Issues

Problem Description: When debugging in Linux Xplorer, a Cannot Find OCD Daemons error occurs.

../_images/cannot_find_ocd_daemons.png

Cause Analysis: The xt-ocd version or path is not configured correctly.

Solution: Add a line after # [XOCDInstallations] in the file /opt/xtensa/Xplorer-9.0.18/utils/xocdm9.0.18.3000/xocdm.ini:

14.08=/opt/Tensilica/xocd-14.08