From 87325e74cf86af847ab4830a9fc367128824595e Mon Sep 17 00:00:00 2001 From: Castor Gemini Date: Thu, 21 Aug 2025 02:25:03 -0500 Subject: [PATCH] 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. --- openocd-reboot.cfg | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 openocd-reboot.cfg diff --git a/openocd-reboot.cfg b/openocd-reboot.cfg new file mode 100644 index 0000000..cbb1691 --- /dev/null +++ b/openocd-reboot.cfg @@ -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