#!/bin/sh # SPDX-License-Identifier: GPL-3.0-or-later # Generate the LFE5U-25F and LFE5U-45F caBGA256 symbols from the Lattice # pinout CSVs (FPGA-SC-02033 ECP5U-25, FPGA-SC-02034 ECP5U-45). # # kicad/lib/tools/make_ecp5_symbol.sh # # Needs kipart (pipx install kipart). # # Both parts have the same balls, banks and differential pairs in caBGA256; # only the pad names and the upper-corner PLL inputs (45F only) differ. # Writes kicad/lib/eboard_fpga.kicad_sym (overwritten). set -eu here=$(cd "$(dirname "$0")" && pwd) ds=$here/../../../datasheets command -v kipart >/dev/null 2>&1 || { echo "kipart not found; install it with: pipx install kipart" >&2 exit 1 } fp=Package_BGA:BGA-256_14.0x14.0mm_Layout16x16_P0.8mm_Ball0.45mm_Pad0.32mm_NSMD out=$here/../eboard_fpga.kicad_sym tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT python3 -I "$here/lattice2kipart.py" "$ds/FPGA-SC-02033-2-0-ECP5U-25-Pinout.csv" \ CABGA256 LFE5U-25F-xBG256x "$fp" 24K > "$tmp/lfe5u25.csv" python3 -I "$here/lattice2kipart.py" "$ds/FPGA-SC-02034-3-0-ECP5U-45-Pinout.csv" \ CABGA256 LFE5U-45F-xBG256x "$fp" 44K > "$tmp/lfe5u45.csv" # kipart names the units after the CSV unit column (Bank0 ... Bank8, Config, Power). kipart -b --bundle-style none -w -o "$tmp/raw.kicad_sym" "$tmp/lfe5u45.csv" # put all pin ends on the 2.54 mm grid python3 -I "$here/kicad_sym_grid.py" "$tmp/raw.kicad_sym" > "$tmp/lfe5u45.kicad_sym" # 25F: same geometry as the 45F symbol, pin names from the 25F pinout, # so "Change symbol" swaps the two parts without touching any wire. python3 -I "$here/derive_symbol.py" "$tmp/lfe5u45.kicad_sym" LFE5U-45F-xBG256x \ "$tmp/lfe5u25.csv" > "$out" echo "wrote $out"