program.sh 678 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. set -euo pipefail
  3. PROJECT="$(cd "$(dirname "$0")/.." && pwd)"
  4. TD_DEFAULT="$(cd "$PROJECT/../.." && pwd)/TD_4.6.7_Linux/bin/td"
  5. TD="${TD_BIN:-$TD_DEFAULT}"
  6. BIT="$PROJECT/build/td/fpga_pwm_trace.bit"
  7. if [ ! -x "$TD" ]; then
  8. echo "ERROR: TD executable not found: $TD" >&2
  9. exit 1
  10. fi
  11. if [ ! -s "$BIT" ]; then
  12. echo "ERROR: bitstream not found: $BIT" >&2
  13. echo "Run ./scripts/build.sh first." >&2
  14. exit 1
  15. fi
  16. # These are the exact low-level parameters previously verified on the real
  17. # EF2L45 board: jtag_burst + cable 0 + SVF speed 4.
  18. printf 'bit_to_vec -chip EF2L45B -m jtag_burst -bit %s\nprogram -cable 0 -mode svf -spd 4 -p\nexit\n' "$BIT" | "$TD"