From 8e3428788c712c8df2d2da6ba1f93fc584330c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 23 May 2026 17:16:36 +0200 Subject: [PATCH] build: Digilent backend on by default on UNIX The driver dlopen's libdjtg/libdmgr and degrades to "no probe" if they're absent, so building it in has no cost or dependency. BS_ENABLE_DIGILENT now defaults ON on UNIX (needs ); disable with -DBS_ENABLE_DIGILENT=OFF. Docs updated; also fixes the quartiq license note in CLAUDE.md (MIT, not BSD-2). --- CLAUDE.md | 17 ++++++++++------- CMakeLists.txt | 13 ++++++++++--- README.md | 20 +++++++++++--------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0354caa..92d08e8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -103,9 +103,12 @@ high ("all ones" symptom). Standard FTDI driver path is dead on these boards. Workaround: `modules/drivers/digilent_jtag/` wraps libdjtg/libdmgr -(Digilent Adept Runtime). Built only when `-DBS_ENABLE_DIGILENT=ON`, -loaded via `dlopen` at runtime — no Digilent binary or header in the -repo. End-user just needs the Adept Runtime package installed. +(Digilent Adept Runtime), loaded via `dlopen` at runtime — no Digilent +binary or header in the repo. Because it's dlopen'd (degrades to "no +probe" if the libs are absent), it costs nothing to build in: +`BS_ENABLE_DIGILENT` defaults **ON** on UNIX (`` required), +disable with `-DBS_ENABLE_DIGILENT=OFF`. Adept Runtime is only needed +at runtime to actually drive such a probe. ### Xilinx caveats @@ -120,7 +123,7 @@ then `JSTART` and check `DONE`. ## External references -- **BSCAN proxy bitstreams**: `quartiq/bscan_spi_bitstreams` (BSD-2). +- **BSCAN proxy bitstreams**: `quartiq/bscan_spi_bitstreams` (MIT). Pre-built `.bit` for most Xilinx parts; Migen sources to rebuild any part that's missing (needs Vivado). - **Reference host-side implementation**: `openocd/src/flash/nor/jtagspi.c`. @@ -138,9 +141,9 @@ mkdir build && cd build && cmake .. && make ./bs/bs # interactive REPL ``` -For Digilent SMT2-based boards, configure with -`cmake -DBS_ENABLE_DIGILENT=ON ..` and install the Adept Runtime -system-wide (provides `libdjtg.so` + `libdmgr.so`). +The Digilent SMT2 backend is built by default on UNIX (disable with +`-DBS_ENABLE_DIGILENT=OFF`). To actually use such a probe, install the +Adept Runtime system-wide (provides `libdjtg.so` + `libdmgr.so`). No automated tests yet. Smoke test = banner appears, `exit` works. After changes touching `jtag_core`, `drivers/ftdi_jtag`, or the diff --git a/CMakeLists.txt b/CMakeLists.txt index 80906bc..1b0f2fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,17 @@ cmake_minimum_required(VERSION 3.10) project(BoundaryScanExplorer) -# Optional backends. Off by default: no proprietary runtime dependency. +# Digilent JTAG-SMT* backend. The driver dlopen's libdjtg/libdmgr at +# runtime and degrades to "no probe" if they're absent, so building it +# in costs nothing — default ON. Needs , so UNIX only. +if(UNIX) + set(BS_DIGILENT_DEFAULT ON) +else() + set(BS_DIGILENT_DEFAULT OFF) +endif() option(BS_ENABLE_DIGILENT - "Enable Digilent JTAG-SMT* backend (dlopen libdjtg.so / libdmgr.so at runtime; requires Adept Runtime installed)" - OFF) + "Enable Digilent JTAG-SMT* backend (dlopen libdjtg.so / libdmgr.so at runtime; Adept Runtime only needed to actually use such a probe)" + ${BS_DIGILENT_DEFAULT}) # script and jtag_core must be the last linked archive for the application to compile set(BS_MODULES script jtag_core) diff --git a/README.md b/README.md index 2a2a1df..b33326c 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,12 @@ in `bsdl_files/`. - CMake ≥ 3.10, gcc/clang - `readline` (Arch: `readline`, Debian/Ubuntu: `libreadline-dev`) - `libftd2xx` for FTDI probes (vendored in `libs/libftd2xx/`) -- *Optional, for Digilent SMT2/SMT2-NC boards:* the Digilent +- *To drive a Digilent SMT2/SMT2-NC probe:* the Digilent [Adept Runtime](https://digilent.com/shop/software/digilent-adept/) installed system-wide (provides `libdjtg.so` + `libdmgr.so`). Nothing from Digilent is vendored — the backend is `dlopen`'d at - runtime. + runtime, so it's built in by default and simply reports no probe if + the libs are missing. ## Build @@ -42,10 +43,10 @@ make The binary is produced at `build/bs/bs`. -To enable the Digilent SMT2 backend: +The Digilent SMT2 backend is built by default on Linux. To leave it out: ```sh -cmake -DBS_ENABLE_DIGILENT=ON .. +cmake -DBS_ENABLE_DIGILENT=OFF .. ``` ## Run @@ -114,11 +115,12 @@ Use `help ` for per-command help. in `modules/config/config.script` for pin mapping and TCK frequency. - **SEGGER J-Link** - **Linux GPIO** (sysfs; deprecated on recent kernels, libgpiod migration TBD) -- **Digilent JTAG-SMT2 / SMT2-NC** — optional, built when - `-DBS_ENABLE_DIGILENT=ON`. Required for the USB-JTAG on Xilinx eval - boards like the KCU105: those modules ship a Digilent-proprietary - firmware that does not respond to plain MPSSE, so the FTDI driver - appears to enumerate them but the JTAG chain stays silent. +- **Digilent JTAG-SMT2 / SMT2-NC** — built in by default on Linux + (`-DBS_ENABLE_DIGILENT=OFF` to drop it). Required for the USB-JTAG on + Xilinx eval boards like the KCU105: those modules ship a + Digilent-proprietary firmware that does not respond to plain MPSSE, + so the FTDI driver appears to enumerate them but the JTAG chain stays + silent. ## Known Xilinx caveats