Castor-Gemini/openocd-reboot.cfg

57 lines
2.1 KiB
INI

# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board (v3)
# ----------------------------------------------------------------
# 1. Adapter and Board Configuration
# ----------------------------------------------------------------
adapter driver ftdi
ftdi channel 2
ftdi vid_pid 0x0403 0x6011
# NEW: Set the JTAG clock speed.
# Start with a conservative but reasonable speed. 1000 kHz = 1 MHz.
# If this works, you can try increasing it to 5000 or 10000 for faster performance.
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
# ----------------------------------------------------------------
# MODIFIED: Changed the reset configuration.
# By removing 'srst_pulls_trst', we are telling OpenOCD to handle the
# JTAG reset (nTRST) and the system reset (nSRST) as separate signals.
# This is often more reliable on complex SoCs.
reset_config srst_only srst_assert_width 100 srst_deassert_delay 100
# Initialize OpenOCD and connect to the target
init
# --- The Improved Reboot Sequence ---
# 'reset halt' asserts the reset line, then immediately halts the cores
# as they come out of reset, before they can execute any code.
echo "!!! Issuing reset halt to gain control..."
reset halt
# Now that the system is halted and stable, we can let it run.
echo "!!! Resuming execution to complete the reboot..."
resume
# Exit OpenOCD
shutdown