Commit Graph

30 Commits

Author SHA1 Message Date
45929c732e digilent: free device enumeration after Detect
DmgrEnumDevices builds an internal device table that must be released
with DmgrFreeDvcEnum, otherwise a second enumeration (e.g. opening a
probe by index, which re-runs Detect) fails.
2026-05-23 12:07:04 +02:00
7d0b19ec25 digilent: implement TX_TMS / TXRX_DATA + lazy Detect from Init
TMS-only shifts go through DjtgPutTmsBits with TDI held to 0. Pure data
shifts use DjtgPutTdiBits with TMS held to 0. Mixed shifts (e.g. last
bit of Shift-IR/DR with TMS=1) fall back to DjtgPutTmsTdiBits — note
that within each pair the encoding is TDI(low) then TMS(high),
LSB-first, despite the function name (verified against the SDK
DjtgDemo sample).

Init also gained a lazy call to Detect: jtag_open_probe can be invoked
without first running jtag_get_probes_list.

Validated on KCU105: jtag_autoinit returns IDCODE 0x13822093
(XCKU040 rev1) through the Digilent SMT2-NC.
2026-05-23 11:19:52 +02:00
9ac794e36c digilent: implement Init / DeInit
DmgrOpen + DjtgEnable + DjtgSetSpeed at 4 MHz (Adept rounds to the
nearest supported, e.g. 3.75 MHz on SMT2-NC). DeInit does the reverse.

An atexit hook also forces Close on process shutdown — leaving an open
HIF when libdjtg's C++ static destructors run triggers "pure virtual
method called".
2026-05-23 11:14:17 +02:00
09708177b7 digilent: dlopen libdjtg/libdmgr + implement Detect
Loads the Adept .so files lazily and resolves the symbols we need.
Detect() enumerates devices via DmgrEnumDevices/DmgrGetDvc and exposes
each as a Viveris probe slot. If Adept Runtime is missing, the driver
silently reports 0 probes.
2026-05-23 11:10:58 +02:00
78f6bb9b34 digilent: add driver skeleton + CMake option BS_ENABLE_DIGILENT
Stub Digilent JTAG-SMT backend, off by default. Wiring only: option,
conditional sources, dl link, drivers_list registration. Detect()
returns 0 for now; dlopen + real implementation in follow-up commits.
2026-05-23 11:06:43 +02:00
3c1e5f987e script: show drv/probe index in jtag_get_probes_list output
The probe ID printed by jtag_get_probes_list is the hex value to pass
verbatim to jtag_open_probe (parsed as base 16), but reading
"ID 0x00000000" and typing "1" as a 1-based index is a natural mistake
— and jtag_open_probe will accept 1, fail with a misleading
"FT_DEVICE_NOT_FOUND" since (drv=0, probe=1) does not exist.

Append explicit [drv N, probe M] decomposition so the value to copy is
unambiguous.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 10:49:16 +02:00
0bd109c209 fix: bsdl folder error printed uninitialized buffer
In cmd_autoinit, when find_first_file fails to open ./bsdl_files/ the
error path printed `filename` — which is only populated inside the
directory-walk loop. Outside that loop it is uninitialized stack
content, leading to garbage in the error message (and a confusing
diagnostic when bs is launched from a directory without a bsdl_files/
subfolder, e.g. build/).

Print `scanfolder` (the actual path that was attempted) instead.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 10:48:46 +02:00
1febae7377 doc: add end-to-end tutorial
doc/tutorial.md walks from probe detection to JEDEC ID over EXTEST and
forward-references the BSCAN proxy path. Includes:
- prerequisites and build/launch
- chain scan, FPGA identification, registry lookup
- IR/DR primitive sanity check via the IDCODE register
- SPI JEDEC ID over EXTEST (with the speed caveat)
- recipe to add a new FPGA target
- troubleshooting cheat sheet

README and CLAUDE.md updated to point at it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 23:11:15 +02:00
dec0d14a06 phase 2.5: add bscan_spi/ — BSCAN proxy infrastructure
Low-level JTAG primitives operating directly on jc->io_functions
(single-device chain assumed), independent of jtag_core:
- bscan_set_ir
- bscan_shift_dr (TDI/TDO, LSB-first packing)
- bscan_idle_cycles

High-level operations driven by an fpga_target descriptor:
- bscan_load_bitstream: JPROGRAM -> CFG_IN -> shift (bit-reversed for
  Xilinx) -> JSTART -> idle -> BYPASS
- bscan_load_bitstream_file: parses the Xilinx .bit container header
  (sections a/b/c/d/e), falls back to raw .bin

bscan_spi_xfer is stubbed: the quartiq jtagspi protocol details will
be wired once we have a proxy .bit to validate against (OpenOCD
src/flash/nor/jtagspi.c is the host-side reference).

Three new script commands:
- bscan_set_ir <opcode_hex> <ir_length>
- bscan_shift_dr <nbits>  (writes zeros, prints captured TDO)
- bscan_load_bitstream <device> <path>

The sanity check for a healthy primitive on KU15P:
  jtag_init_scan; bscan_set_ir 9 6; bscan_shift_dr 32  ->  04 A5 60 93

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 23:10:54 +02:00
545fe09fd5 phase 2: add fpga/ module — per-target descriptor & registry
modules/fpga/ holds an fpga_target struct (IDCODE/mask, family, IR
length and private opcodes, proxy bitstream path, quirks) and a
compile-time registry. Initial entry: Xilinx Kintex UltraScale+
XCKU15P, populated from bsdl_files/xcku15p_ffve1517.bsd (IDCODE
0x04A56093, IR 6, USER1=0x02, CFG_IN=0x05, JPROGRAM=0x0B, JSTART=0x0C,
JSHUTDOWN=0x0D, ISC_DISABLE=0x16, quirk CCLK_VIA_STARTUP).

Two new script commands:
- fpga_list: enumerate the registry
- fpga_info: match each device on the JTAG chain against the registry
  and surface known quirks

Adding another FPGA = one entry in fpga_registry[] + its .bsd in
bsdl_files/. Proxy .bit will be wired in phase 2.5 (bscan_spi/).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 22:52:52 +02:00
bbb99ba35c add CLAUDE.md with project guide
Durable project context (architecture, roadmap, key decisions, external
references, commit conventions) so any Claude Code session on any
machine has the same baseline understanding. Machine-local facts stay
out of the repo, in ~/.claude/.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 22:41:13 +02:00
6c676d38f2 translate README to English
Match the existing project convention (Viveris code, commit messages).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 22:26:35 +02:00
7cb3627754 phase 1: cleanup, REPL polish, README
- fix format-string in jprint/script_print (printf(msg) -> fputs)
- fix bsexp_deinit: deinit_script guarded by sctx, not jc
- silence "config.script not found" when the optional override is absent
- remove dead code: bs/cmds/, bs/args.{c,h}, bs/utils.h, commented blocks
- REPL: welcome banner with version, readline tab-completion on
  script_commands_list, skip blank lines, clean Ctrl-D exit
- README: build, REPL usage, typical SPI flow, command table, probes,
  Xilinx STARTUPE3/CCLK caveat

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 22:22:05 +02:00
François Dausseur
9e0ca10a71 commands doc corrections.
Added a "script" directory for examples.
2025-02-18 15:40:58 +01:00
François Dausseur
5dfe5b123e compiles and works 2025-02-18 11:36:18 +01:00
b66e82da87 init and deinit 2025-02-16 19:43:48 +01:00
c8bda25d90 code refactoring 2025-02-16 19:32:01 +01:00
f3c2569a30 app dir changed and src dir removed 2025-02-16 17:37:56 +01:00
4f6cd20130 dir refactoring done. 2025-02-16 12:39:24 +01:00
a61fe778e6 dirs refactoring 2025-02-16 12:38:13 +01:00
054165ed84 dirs refactoring 2025-02-16 11:27:46 +01:00
5ddc9fe9b4 reorganized lib_jtag in paths 2025-02-16 09:40:14 +01:00
François Dausseur
f48e92f837 Merge branch 'main' of https://git.beafrancois.fr/Foue-opensource/bs_explorer 2025-02-13 17:26:34 +01:00
François Dausseur
f1c68de819 wip 2025-02-13 17:25:36 +01:00
8c6a3f6ef1 no parameter -> error 2025-02-12 22:28:09 +01:00
François Dausseur
c5fca73cc6 Now the device id is detected. 2025-02-12 17:19:33 +01:00
François Dausseur
a8e7599b96 added ftdi on linux 2025-02-12 12:37:38 +01:00
b6775ae680 added reference to the original repo 2025-02-11 22:35:20 +01:00
6255d9e8f4 Added readme 2025-02-11 22:26:16 +01:00
287a28f789 Creation 2025-02-11 22:21:56 +01:00