aboutsummaryrefslogtreecommitdiff
path: root/kicad/lib/tools/make_eboard_lib.sh
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@tha.de>2026-11-08 18:14:54 +0100
committerFriedrich Beckmann <friedrich.beckmann@tha.de>2026-11-08 18:14:54 +0100
commit5129a5a5448012a53cb9ddae1349c2a2c8571339 (patch)
tree41d60bbce7fe0de57cdd92b232682831759de1a8 /kicad/lib/tools/make_eboard_lib.sh
parent9e4911662b81bad61183cca74b8c1905f84e60e4 (diff)
Add KiCad 9 schematic, project libraries and datasheetsHEADmaster
Schematic (kicad/), one sheet per function as on ULX3S: - power: TLV62569 bucks for +1V1 / +3V3, AP2112K LDO for +2V5 - usb: USB-C with PTC and TVS, CH347F for JTAG and UART - fpga_power, fpga_config, fpga_banks_01/23/67: ECP5 LFE5U-25F caBGA256 (pin compatible with the 45F), quad SPI flash, 50 MHz CLOCK_50, ball assignment as in PINPLAN.md - ethernet: RTL8211F gigabit PHY, HR911130A RJ45, shield via 1M || 1nF 2kV - sdram: 32 MB W9825G6KH-6 - hdmi: TMDS from the FPGA (LVCMOS33D), AC coupled, ESD protected - user_io: SW, KEY (debounced), LEDR, LEDG, HEX0-HEX3 with DE1 names - gpio: two DE1 compatible 2x20 headers (THDB-ADA on GPIO_0), Pmod A/B, ESD arrays - testpoints: bring-up pads, M3 mounting holes All parts have LCSC numbers, MPN and manufacturer for JLCPCB assembly; footprints are cross-checked against the EasyEDA data. Libraries: ECP5 symbols generated from the Lattice pinout CSVs (kipart), CH347F, RTL8211F, SM410561N symbols, HR911130A symbol and footprint from KiCad library merge requests, generator scripts in lib/tools/. Datasheets of all parts except resistors and capacitors in datasheets/ (manufacturer copyright, not covered by the project licenses).
Diffstat (limited to 'kicad/lib/tools/make_eboard_lib.sh')
-rwxr-xr-xkicad/lib/tools/make_eboard_lib.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/kicad/lib/tools/make_eboard_lib.sh b/kicad/lib/tools/make_eboard_lib.sh
new file mode 100755
index 0000000..1399513
--- /dev/null
+++ b/kicad/lib/tools/make_eboard_lib.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Build kicad/lib/eboard.kicad_sym:
+# - symbols generated by kipart from the CSV files in this folder,
+# - plus ready-made symbols from the *.kicad_sym files in this folder
+# (e.g. the HR911130A symbol from a KiCad library merge request).
+#
+# kicad/lib/tools/make_eboard_lib.sh
+#
+# Needs kipart (pipx install kipart).
+set -eu
+here=$(cd "$(dirname "$0")" && pwd)
+command -v kipart >/dev/null 2>&1 || {
+ echo "kipart not found; install it with: pipx install kipart" >&2
+ exit 1
+}
+out=$here/../eboard.kicad_sym
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+
+kipart -b --bundle-style none -w -o "$tmp/raw.kicad_sym" \
+ "$here"/ch347f.csv "$here"/rtl8211f.csv "$here"/sm410561n.csv
+python3 -I "$here/kicad_sym_grid.py" "$tmp/raw.kicad_sym" > "$tmp/grid.kicad_sym"
+
+# append the top-level symbols of the extra libraries
+python3 -I - "$tmp/grid.kicad_sym" "$here"/*.kicad_sym > "$out" <<'EOF'
+import re, sys
+
+
+def match_paren(t, i):
+ depth, j = 0, i
+ while True:
+ c = t[j]
+ if c == '"':
+ j += 1
+ while t[j] != '"':
+ j += 2 if t[j] == "\\" else 1
+ elif c == "(":
+ depth += 1
+ elif c == ")":
+ depth -= 1
+ if depth == 0:
+ return j + 1
+ j += 1
+
+
+base = open(sys.argv[1]).read()
+blocks = []
+for path in sys.argv[2:]:
+ t = open(path).read()
+ i = t.index("(", 1)
+ while True:
+ m = re.compile(r'\(symbol "').search(t, i)
+ if not m:
+ break
+ e = match_paren(t, m.start())
+ blocks.append(t[m.start():e])
+ i = e
+end = base.rstrip().rfind(")")
+sys.stdout.write(base[:end] + "".join(" " + b + "\n" for b in blocks) + ")\n")
+EOF
+echo "wrote $out"