This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VH-Q1: How Do I Use OpenOCD to Debug U-Boot?

Part Number: TDA4VH-Q1
Other Parts Discussed in Thread: J784S4XEVM

Tool/software:

How do I use OpenOCD to step through U-Boot code? I need detail to debug my issue.

  • Note: Steps should translate to other Jacinto devices.

    1. Resources

    Item Link
    U-Boot OpenOCD Docs https://docs.u-boot.org/en/stable/develop/gdb.html#using-openocd-as-gdb-server

    Nishanth's Video Covering OpenOCD Debugging


    2. Requirements

    Item
    Link
    Description
    J784S4XEVM https://www.ti.com/tool/J784S4XEVM J784S4 EVM
    PSDK-LINUX-J784S4 https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-J784S4/11.00.00.08 J784S4 Linux SDK (version 11.00.00.08)
    SD Card N/A SD card to boot from


    3. Setup

    3.1. Hardware Setup

    1. Set EVM to SD card boot: https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-j784s4/11_00_00_06/exports/docs/psdk_rtos/docs/user_guide/evm_setup_j784s4.html
    2. Connect the PC to the XDS110 Debugger port
    3. Connect the PC to the UART port (open a terminal)

    3.2. Software Setup

    3.2.1. SD Card Setup

    $ cd <path-to-SDK>
    $ sudo ./bin/create-sdcard.sh
    

    3.2.2. U-Boot Setup

    # insert SD card
    $ cd <path-to-SDK>
    $ make u-boot
    # edit BOOT_PART within Rules.make
    $ vi Rules.make
    $ make u-boot_install

    3.2.3. OpenOCD Setup

    $ sudo apt-get install libhidapi-dev libtool libusb-1.0-0-dev automake libjim-dev
    $ git clone https://git.code.sf.net/p/openocd/code openocd
    $ cd openocd
    $ ./bootstrap
    $ ./configure
    $ make

    Run the following commands to avoid having to run OpenOCD as root:

    $ sudo cp ./contrib/60-openocd.rules /etc/udev/rules.d/
    $ sudo udevadm control --reload-rules

    Command to run OpenOCD (don't run this for now):

    $ cd tcl
    $ sudo ../src/openocd -f ./board/ti_j784s4evm.cfg

    3.2.4. GDB Setup

    $ sudo apt-get install gdb-multiarch
    


    4. Debug

    4.1. Prime EVM

    Boot the EVM and stop at the U-Boot console:

    U-Boot SPL 2025.01-ti-g1ffc990e9b36 (Aug 18 2025 - 15:09:45 -0500)
    SYSFW ABI: 4.0 (firmware rev 0x000b '11.0.9--v11.00.09+ (Fancy Rat)')
    Trying to boot from MMC2
    Skipping authentication on GP device
    Skipping authentication on GP device
     
     
    U-Boot 2025.01-ti-g1ffc990e9b36 (Aug 18 2025 - 15:09:45 -0500)
     
    SoC:   J784S4 SR1.0 GP
    Model: Texas Instruments J784S4 EVM
    DRAM:  2 GiB (total 32 GiB)
    mmio-mux mux-controller@4080: unable to set idle state
    Core:  143 devices, 36 uclasses, devicetree: separate
    Flash: spi_nand nand@0: Winbond SPI NAND was found.
    spi_nand nand@0: 128 MiB, block size: 256 KiB, page size: 4096, OOB size: 128
    k3-navss-ringacc ringacc@2b800000: Ring Accelerator probed rings:286, gp-rings[96,20] sci-dev-id:328
    k3-navss-ringacc ringacc@2b800000: dma-ring-reset-quirk: disabled
    cadence_spi spi@47040000: Pattern not found. Skipping calibration
    0 Bytes
    MMC:   mmc@4f80000: 0, mmc@4fb0000: 1
    Loading Environment from nowhere... OK
    In:    serial@2880000
    Out:   serial@2880000
    Err:   serial@2880000
    am65_cpsw_nuss ethernet@46000000: K3 CPSW: nuss_ver: 0x6BA02102 cpsw_ver: 0x6BA82102 ale_ver: 0x00293904 Ports:1
    Net:   eth0: ethernet@46000000port@1
    Hit any key to stop autoboot:  0
    =>

    Get relocaddr:

    => bdinfo
    boot_params = 0x0000000000000000
    DRAM bank   = 0x0000000000000000
    -> start    = 0x0000000080000000
    -> size     = 0x0000000080000000
    DRAM bank   = 0x0000000000000001
    -> start    = 0x0000000880000000
    -> size     = 0x0000000780000000
    flashstart  = 0x0000000000000000
    flashsize   = 0x0000000000000000
    flashoffset = 0x0000000000000000
    baudrate    = 115200 bps
    relocaddr   = 0x00000000ffe97000
    reloc off   = 0x000000007f697000
    Build       = 64-bit
    current eth = ethernet@46000000port@1
    ethaddr     = 04:25:e8:b6:96:f5
    IP addr     = <NULL>
    fdt_blob    = 0x00000000fde32220
    lmb_dump_all:
     memory.count = 0x2
     memory[0]  [0x80000000-0xffffffff], 0x80000000 bytes, flags: none
     memory[1]  [0x880000000-0xfffffffff], 0x780000000 bytes, flags: none
     reserved.count = 0x4
     reserved[0]    [0x9e800000-0xabffffff], 0xd800000 bytes, flags: no-map
     reserved[1]    [0xfce2f000-0xfce31fff], 0x3000 bytes, flags: no-notify, no-overwrite
     reserved[2]    [0xfce32210-0xffffffff], 0x31cddf0 bytes, flags: no-overwrite
     reserved[3]    [0x880000000-0xfffffffff], 0x780000000 bytes, flags: no-overwrite
    devicetree  = separate
    serial addr = 0x0000000002880000
     width      = 0x0000000000000000
     shift      = 0x0000000000000002
     offset     = 0x0000000000000000
     clock      = 0x0000000002dc6c00
    arch_number = 0x0000000000000000
    TLB addr    = 0x00000000ffff0000
    irq_sp      = 0x00000000fde32210
    sp start    = 0x00000000fde32210
    Early malloc usage: 3548 / 8000
    =>

    4.2. Start OpenOCD

    $ cd tcl
    $ sudo ../src/openocd -f ./board/ti_j784s4evm.cfg
    Open On-Chip Debugger 0.12.0+dev-00574-g2c8376b79 (2024-05-16-14:38)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 2500 kHz
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : XDS110: connected
    Info : XDS110: vid/pid = 0451/bef3
    Info : XDS110: firmware version = 3.0.0.32
    Info : XDS110: hardware version = 0x002f
    Info : XDS110: connected to target via JTAG
    Info : XDS110: TCK set to 2500 kHz
    Info : clock speed 2500 kHz
    Info : JTAG tap: j784s4.cpu tap/device found: 0x0bb8002f (mfg: 0x017 (Texas Instruments), part: 0xbb80, ver: 0x0)
    Info : [j784s4.axi_ap] Examination succeed
    Info : starting gdb server for j784s4.cpu.sysctrl on 3333
    Info : Listening on port 3333 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.0 on 3334
    Info : Listening on port 3334 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.1 on 3335
    Info : Listening on port 3335 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.2 on 3336
    Info : Listening on port 3336 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.3 on 3337
    Info : Listening on port 3337 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.4 on 3338
    Info : Listening on port 3338 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.5 on 3339
    Info : Listening on port 3339 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.6 on 3340
    Info : Listening on port 3340 for gdb connections
    Info : starting gdb server for j784s4.cpu.a72.7 on 3341
    Info : Listening on port 3341 for gdb connections
    Info : starting gdb server for j784s4.cpu.mcu_r5.0 on 3342
    Info : Listening on port 3342 for gdb connections
    Info : starting gdb server for j784s4.cpu.mcu_r5.1 on 3343
    Info : Listening on port 3343 for gdb connections
    Info : starting gdb server for j784s4.cpu.main0_r5.0 on 3344
    Info : Listening on port 3344 for gdb connections
    Info : starting gdb server for j784s4.cpu.main0_r5.1 on 3345
    Info : Listening on port 3345 for gdb connections
    Info : starting gdb server for j784s4.cpu.main1_r5.0 on 3346
    Info : Listening on port 3346 for gdb connections
    Info : starting gdb server for j784s4.cpu.main1_r5.1 on 3347
    Info : Listening on port 3347 for gdb connections
    Info : starting gdb server for j784s4.cpu.main2_r5.0 on 3348
    Info : Listening on port 3348 for gdb connections
    Info : starting gdb server for j784s4.cpu.main2_r5.1 on 3349
    Info : Listening on port 3349 for gdb connections
    Info : gdb port disabled
    Info : accepting 'gdb' connection on tcp/3334
    Info : j784s4.cpu.a72.0: hardware has 6 breakpoints, 4 watchpoints
    Info : j784s4.cpu.a72.0 cluster 0 core 0 multi core

    Note that A72_0 is on 3334.

    4.3. Start GDB

    $ gdb-multiarch
    # connect to A72_0
    >>> target extended-remote localhost:3334

    The symbol table needs to be added, but U-Boot relocates itself. This is why we ran bdinfo earlier.

    0x00000000ffe97000 comes from that. Depending on the device, this value may be different.

    >>> add-symbol-file <path-to-SDK>/board-support/ti-u-boot-2025.01+git/build/a72/u-boot 0x00000000ffe97000

    You can begin debugging like normal now.