Castor-Gemini/openocd-reboot.cfg

61 lines
2.1 KiB
INI

# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board (v4)
# Compatible with OpenOCD 0.12.0
# ----------------------------------------------------------------
# 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
# ----------------------------------------------------------------
# Configure the reset type, but without the unsupported timing flags.
# We will control the pulse manually.
reset_config srst_only
# Initialize OpenOCD and connect to the target
init
# --- Manual Reboot Sequence for OpenOCD 0.12.0 ---
echo "!!! Manually asserting system reset (nSRST)..."
# Pull nSRST low (active low, so '0' asserts it)
ftdi_set_signal nSRST 0
# Hold the reset for 100ms to ensure the board registers it
sleep 100
echo "!!! De-asserting system reset and attempting to halt..."
# Release nSRST (set it back to high-impedance/inactive)
ftdi_set_signal nSRST 1
# Wait a moment for the board to start coming out of reset
sleep 100
# Immediately after releasing reset, halt the cores.
# This is the critical step to catch them before they boot the OS.
halt
echo "!!! System halted successfully. Resuming execution to boot..."
resume
# Exit OpenOCD
shutdown