#!/usr/bin/env bash # # Install (or reinstall) the patched TMS34010 processor module into Ghidra. # # The vendored source in ./ghidra-tms34010 is upstream # https://github.com/ZPaul2Fresh8/Ghidra_TMS34010 # with two fixes needed for Ghidra 12 (see ghidra-tms34010-ghidra12.patch): # - pspec -> lowercase "rom" (matches the slaspec) # - every gains initialized="false" (required by the new schema) # # Override the install location with GHIDRA_INSTALL_DIR. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" GHIDRA="${GHIDRA_INSTALL_DIR:-/opt/ghidra}" DEST="$GHIDRA/Ghidra/Processors/TMS34010" SUDO="${SUDO:-sudo}" if [[ ! -x "$GHIDRA/support/sleigh" ]]; then echo "error: $GHIDRA/support/sleigh not found (set GHIDRA_INSTALL_DIR)" >&2 exit 1 fi $SUDO mkdir -p "$DEST/data/languages" $SUDO cp "$HERE/ghidra-tms34010"/tms34010.{slaspec,sinc,ldefs,pspec,cspec} \ "$DEST/data/languages/" $SUDO touch "$DEST/Module.manifest" echo "compiling sleigh -> sla ..." $SUDO "$GHIDRA/support/sleigh" -a "$DEST/data/languages" # The sleigh compiler writes the .sla as root; make it readable by users. $SUDO chmod -R a+rX "$DEST" echo "installed TMS34010 language into $DEST" echo "language id: tms34010:LE:32:default"