feat: Add OpenOCD script to reboot SiFive P550 board

This script uses the modern 'reset_config' command to reliably
trigger a hardware reset (nSRST) for the P550 board.
This commit is contained in:
Castor Gemini 2025-08-21 02:25:03 -05:00 committed by Jeff Carr
parent c863006131
commit 670aaa54fe
1 changed files with 54 additions and 0 deletions

54
openocd-reboot.cfg Normal file
View File

@ -0,0 +1,54 @@
# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board
# ----------------------------------------------------------------
# 1. Adapter and Board Configuration
# ----------------------------------------------------------------
adapter driver ftdi
ftdi channel 2
ftdi vid_pid 0x0403 0x6011
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 ;# P550 has an IR length of 5
# Define the 4 P550 cores
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
# Group the cores for simultaneous operations like halt/resume
target smp riscv.cpu0 riscv.cpu1 riscv.cpu2 riscv.cpu3
# ----------------------------------------------------------------
# 3. Reset Configuration and Execution
# ----------------------------------------------------------------
# This is the key command. It tells OpenOCD that a "reset" should
# assert (pull low) the nSRST signal.
# srst_only: Asserts only nSRST, not nTRST (JTAG reset).
# srst_pulls_trst: Informs OpenOCD that the board hardware ties nSRST and nTRST together.
reset_config srst_only srst_pulls_trst
# Initialize OpenOCD and connect to the target
init
# Halt the cores to gain control
halt
# This command now triggers the nSRST signal as configured above.
# It will pulse the reset line, causing a full hardware reboot.
echo "!!! Pulsing system reset (nSRST) to reboot the board..."
reset
# Optional: If you want the board to start running immediately after reboot
# resume
# Exit OpenOCD
shutdown