bsdl: extract parser into standalone libbsdl, pulled via FetchContent

The BSDL loader (seeded from the Viveris parser) now lives in its own
LGPL repo, electronics/libbsdl, consumed with CMake FetchContent.
Local development override: -DFETCHCONTENT_SOURCE_DIR_BSDL=<path>.
src/modules/bsdl_parser/ is removed; callers go through the libbsdl
API. Build verified against the libbsdl checkout.
This commit is contained in:
2026-06-13 00:10:02 +02:00
parent 43d291418b
commit 2752c3404b
19 changed files with 154 additions and 1897 deletions

View File

@@ -20,7 +20,12 @@ other families (Lattice, Microsemi, …) by playing a vendor-exported SVF.
The Viveris library itself lives unchanged in `src/modules/`. Everything
new is in `src/bs/` (the REPL) and the project modules (`target/`,
`bscan/`, `spi_flash/`, `svf/`, `probes/`, `program/`, `arm_debug/`)
sitting alongside the Viveris ones.
sitting alongside the Viveris ones. The BSDL parser was extracted into
a standalone library, **[libbsdl](ssh://gitea@git.beafrancois.fr:8329/electronics/libbsdl.git)**
(LGPL, seeded from the same Viveris loader), and is now pulled in via
CMake `FetchContent` instead of vendored. To build against a local
checkout (e.g. side-by-side dev): configure with
`-DFETCHCONTENT_SOURCE_DIR_BSDL=/path/to/libbsdl`.
## Architecture
@@ -30,13 +35,14 @@ src/
└── modules/
— Viveris's library (LGPL, unchanged) —
├── jtag_core/ TAP state machine, IR/DR shifts
├── bsdl_parser/ .bsd loader
├── bus_over_jtag/ SPI/I²C/MDIO/parallel mem bit-bang over EXTEST
├── drivers/ FTDI, J-Link, Linux GPIO, LPT, Digilent (optional, dlopen)
├── script/ Script engine (the real UI)
├── config/ Built-in config.script
├── os_interface/ Portable fs/network wrappers
└── natsort/ Natural pin-name sorting
— pulled via FetchContent (LGPL, separate repo) —
└── (libbsdl) BSDL (.bsd) parser; struct + JSON; stable C ABI
— new (this project) —
├── target/ Target registry: FPGAs + CPUs (parses data/targets.yaml)
├── bscan/ JTAG TAP primitives (set_ir/shift_ir/shift_dr/tap_reset/
@@ -528,7 +534,11 @@ mkdir build && cd build && cmake .. && make
Build needs **libyaml** (pkg-config `yaml-0.1`; Arch `libyaml`, Debian
`libyaml-dev`) for the registry, and **libftdi1** + **libusb-1.0**
(pkg-config `libftdi1`; Arch `libftdi`, Debian `libftdi1-dev`) for the
FTDI/Olimex driver. Run `bs` from the repo root so it finds
FTDI/Olimex driver. **libbsdl** (the BSDL parser, separate repo) is
pulled in by CMake `FetchContent` at configure time — needs network on
first build. For a local checkout, configure with
`-DFETCHCONTENT_SOURCE_DIR_BSDL=/path/to/libbsdl` (built-in FetchContent
override, no clone happens). Run `bs` from the repo root so it finds
`data/targets.yaml` (and `data/bsdl_files/`, `data/bscan_proxies/`), or
point `$BS_TARGETS` at it.