Castor-Gemini/openocd-reboot.cfg

52 lines
2.0 KiB
INI

# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board (v5)
# Correctly handles separate JTAG and System resets to prevent timeouts.
# ----------------------------------------------------------------
# 1. Adapter and Board Configuration
# ----------------------------------------------------------------
adapter driver ftdi
ftdi channel 2
ftdi vid_pid 0x0403 0x6011
adapter speed 1000
ftdi layout_init 0x0808 0x0a1b
ftdi layout_signal nSRST -oe 0x0200
ftdi layout_signal nTRST -data 0x0100 -oe 0x0100
# ----------------------------------------------------------------
# 2. JTAG Chain and Target Configuration
# ----------------------------------------------------------------
transport select jtag
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5
target create riscv.cpu0 riscv -chain-position $_CHIPNAME.cpu -coreid 0
target create riscv.cpu1 riscv -chain-position $_CHIPNAME.cpu -coreid 1
target create riscv.cpu2 riscv -chain-position $_CHIPNAME.cpu -coreid 2
target create riscv.cpu3 riscv -chain-position $_CHIPNAME.cpu -coreid 3
target smp riscv.cpu0 riscv.cpu1 riscv.cpu2 riscv.cpu3
# ----------------------------------------------------------------
# 3. Reset Configuration and Execution
# ----------------------------------------------------------------
# CRITICAL: Configure the reset strategy.
# 'srst_only': The 'reset' command will only pulse the nSRST line.
# 'separate': Tells OpenOCD that nSRST and nTRST are independent signals.
# This allows the 'init' command to correctly reset the JTAG TAP
# (using nTRST) before trying to communicate with it.
reset_config srst_only separate
# Initialize OpenOCD. This will now correctly reset the JTAG chain.
init
# Issue the system reset. Because of the config above, this will now
# cleanly pulse the nSRST line, causing a hardware reboot.
echo "!!! Issuing system reset to reboot the board..."
reset
echo "!!! Board has been reset and should be rebooting now."
# Exit OpenOCD
shutdown