#!/bin/sh -e # Kill any existing OpenOCD instances to avoid port conflicts pkill -9 openocd 2>/dev/null || true @OCD@ -f @OCDCONF@ & OPENOCD_PID=$! cleanup() { kill $OPENOCD_PID 2>/dev/null || true # Give it a moment to exit sleep 0.2 # Force kill if still running kill -9 $OPENOCD_PID 2>/dev/null || true } trap cleanup EXIT @DDD@ --gdb --debugger @GDB@ -x @GDBCONF@ "$1"