ftdi: replace proprietary libftd2xx with open-source libftdi1
The Olimex ARM-USB-OCD (and any FT2232 with a custom USB id) couldn't be enumerated by libftd2xx and needed a manual ftdi_sio unbind. libftdi1 (libusb) opens any VID:PID and auto-detaches the kernel driver. - rewrite drivers/ftdi_jtag on libftdi1: enumerate a known VID:PID list (incl. Olimex 15ba:0003/002b) with per-chip channel counts, open by bus/addr + interface, MPSSE via ftdi_write_data/ftdi_read_data (+ SEND_IMMEDIATE for deterministic reads). MPSSE command building, pin map and clocking unchanged. - CMake: link libftdi1 + libusb-1.0 (pkg-config), drop FTDILIB/FTD2XX defines and the libftd2xx.a link; remove the vendored src/libs/libftd2xx. - registry: NXP LPC2103 (ARM7TDMI-S) entry, IDCODE 0x4F1F0F0F. - docs updated (deps, layout, decision note, roadmap phase 8). Validated on hardware: ARM-USB-OCD enumerates, jtag_scan reads the LPC2103 IDCODE 0x4F1F0F0F, target_info -> [cpu, ARM7] prog: arm_flash. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
28
CLAUDE.md
28
CLAUDE.md
@@ -25,9 +25,8 @@ sitting alongside the Viveris ones.
|
||||
## Architecture
|
||||
|
||||
```
|
||||
src/ — code + libs —
|
||||
src/
|
||||
├── bs/ Application (readline REPL, no business logic)
|
||||
├── libs/libftd2xx/ Vendored FTDI SDK
|
||||
└── modules/
|
||||
— Viveris's library (LGPL, unchanged) —
|
||||
├── jtag_core/ TAP state machine, IR/DR shifts
|
||||
@@ -75,6 +74,8 @@ Adding a feature usually means adding a new script command in
|
||||
| 6 | `svf/` | **done** (subset, commit `c77d86e`) | SVF player + `svf_play`: SIR/SDR with masked TDO compare, RUNTEST, STATE — single-device. Validated on the IGLOO2 IDCODE. |
|
||||
| 7 | `target/` + `program/` + `arm_debug/` | **structure done; ARM impl TODO** | Generalized `fpga/` into a kind-aware `target/` registry (FPGA \| CPU). `program <dev> <file>` dispatches by `prog` (svf wired; proxy_spi points at the flash workflow). `arm_debug/` (EmbeddedICE) + `arm_flash` backend are declared but not implemented; `arm-usb-ocd` probe profile added. FPGA path re-validated on the IGLOO2. See the ARM-debug design note. |
|
||||
|
||||
| 8 | FTDI driver → libftdi1 | **done** | Replaced the proprietary libftd2xx with open-source libftdi1 (libusb): any VID:PID + auto kernel-detach. Detected an NXP LPC2103 (ARM7TDMI-S, IDCODE 0x4F1F0F0F) over an Olimex ARM-USB-OCD — the probe the old lib couldn't enumerate. Vendored `src/libs/libftd2xx` removed. |
|
||||
|
||||
Move forward phase by phase: validate one with the user before starting
|
||||
the next. Don't break the validated path
|
||||
`jtag_open → jtag_autoinit → jtag_mode 0 EXTEST` while
|
||||
@@ -119,6 +120,19 @@ with `$BS_TARGETS`, loaded lazily. Adding a target = one flat YAML entry
|
||||
`proxy_spi`/`svf`/`arm_flash`/`none` (inferred when omitted). Enums in
|
||||
`target.h`.
|
||||
|
||||
### FTDI driver on libftdi1, not the proprietary libftd2xx
|
||||
|
||||
The FTDI MPSSE driver (`drivers/ftdi_jtag/`) runs on open-source
|
||||
**libftdi1** (libusb), not FTDI's vendored `libftd2xx.a`. Why: libftdi1
|
||||
opens **any USB VID:PID** (so probes with custom ids — Olimex
|
||||
ARM-USB-OCD `0x15ba:0x0003`, etc. — enumerate with no `FT_SetVIDPID`
|
||||
tricks) and **auto-detaches the kernel `ftdi_sio`** driver. The MPSSE
|
||||
command construction, pin map and clocking are unchanged; only the
|
||||
transport (enumerate/open/read/write/bitmode) moved to `ftdi_*` calls.
|
||||
No proprietary binary in the repo. Build dep: pkg-config `libftdi1` +
|
||||
`libusb-1.0`. Validated by detecting an LPC2103 over an ARM-USB-OCD —
|
||||
the probe the old lib couldn't even enumerate.
|
||||
|
||||
### Digilent SMT2 modules need libdjtg, not raw MPSSE
|
||||
|
||||
Several Xilinx dev boards (KCU105, ZCU102, …) embed a Digilent
|
||||
@@ -372,7 +386,7 @@ the SVF player and the flash logic — is portable C, reused as-is.
|
||||
implementations, little rework);
|
||||
- runtime BSDL parsing → pre-baked tables (the registry already does
|
||||
this); `bsdl_parser` can be left out;
|
||||
- `libftd2xx` / Digilent dlopen → gone (the MCU is the probe).
|
||||
- `libftdi1` / Digilent → gone (the MCU is the probe).
|
||||
|
||||
**The one real rework: stream, don't `malloc`.** `bscan_shift_dr`
|
||||
currently allocates the whole shift buffer (`malloc(nbits)` — ~19 MB for
|
||||
@@ -415,9 +429,11 @@ mkdir build && cd build && cmake .. && make
|
||||
```
|
||||
|
||||
Build needs **libyaml** (pkg-config `yaml-0.1`; Arch `libyaml`, Debian
|
||||
`libyaml-dev`) — the FPGA registry is parsed from `data/targets.yaml`
|
||||
at runtime. Run `bs` from the repo root so it finds that file (and
|
||||
`data/bsdl_files/`, `data/bscan_proxies/`), or point `$BS_TARGETS` at it.
|
||||
`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
|
||||
`data/targets.yaml` (and `data/bsdl_files/`, `data/bscan_proxies/`), or
|
||||
point `$BS_TARGETS` at it.
|
||||
|
||||
The Digilent SMT2 backend is built by default on UNIX (disable with
|
||||
`-DBS_ENABLE_DIGILENT=OFF`). To actually use such a probe, install the
|
||||
|
||||
Reference in New Issue
Block a user