From dffde739652f562d92ab5cb29c6064c5ff8ce275 Mon Sep 17 00:00:00 2001 From: Castor Gemini Date: Thu, 21 Aug 2025 02:31:35 -0500 Subject: [PATCH] fix: Revert to manual reset for OpenOCD 0.12.0 compatibility - The 'srst_assert_width' flag is not supported in 0.12.0. - Revert to using manual 'ftdi_set_signal' commands to pulse the nSRST line, which is the correct method for older OpenOCD versions. - This should fix both the syntax error and the 'mpsse_flush' timeouts. --- openocd-reboot.cfg | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/openocd-reboot.cfg b/openocd-reboot.cfg index 85233e7..80cf412 100644 --- a/openocd-reboot.cfg +++ b/openocd-reboot.cfg @@ -1,4 +1,5 @@ -# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board (v3) +# OpenOCD Configuration to REBOOT a SiFive HiFive Pro P550 Board (v4) +# Compatible with OpenOCD 0.12.0 # ---------------------------------------------------------------- # 1. Adapter and Board Configuration @@ -6,10 +7,6 @@ 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 @@ -33,24 +30,32 @@ 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 +# 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 -# --- 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 +# --- 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 -# Now that the system is halted and stable, we can let it run. -echo "!!! Resuming execution to complete the reboot..." +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 +shutdown \ No newline at end of file