Expand description
A probe-rs probe driver for our tag bases, using only the ST-LINK commands every base in the field supports.
The bases present as ST-LINK/V2s, but there is no record of which base
firmware is in the field, and some of it is old. probe-rs’s own ST-LINK
driver relies on two things those bases get wrong: READ_DAP_REG (bases
flashed before 773db79a return stale data) and the 2-byte reply to a
1-byte READMEM_8BIT (no base sends it). This driver never depends on
either. It speaks only the subset tagcore’s LinkAdapt already uses on
every base:
- USB open, mode query, DFU exit, SWD enter/exit, nRST drive, voltage;
READMEM_32BIT/WRITEMEM_32BITwith the last-R/W-status check, in chunks of at mostCHUNKbytes;READDEBUGREGfor the chip ID, which tells L4 from U3.
Everything else probe-rs asks for is answered here:
- DAP register reads are answered from a table of the part’s real values (DPIDR, the AP0 IDR, BASE and CSW, “no AP” past AP0, and 0 for any other register, CFG included); DAP writes are accepted and ignored, because memory never goes through DRW/TAR – it goes through the base’s own memory commands, which set up the AP themselves.
- 8- and 16-bit memory accesses are done with 32-bit ones: reads take the bytes they need; writes read, patch and write back whole words. That is safe for SRAM and flash-algorithm buffers, which is what probe-rs uses them for, but would not be for a peripheral register with side effects.
Reset and SWD entry happen in tagcore’s order: nRST is asserted before SWD is entered, because a tag asleep with its debug domain off answers SWD only from reset.
The layering is FieldSafeProbe (a probe-rs [DebugProbe]) ->
FieldSafeArm (its [ArmDebugInterface]) -> FieldSafeMemory (AP0’s
[ArmMemoryInterface]). None of them is thread-safe; probe-rs drives a
session from one thread at a time. The C++ host tools have no counterpart:
they call STM32_Programmer_CLI for programming. See also
host/libraries/tagprobe-rs/design/architecture.md.
Structs§
- DapTable 🔒
- What the driver answers for the target’s DAP registers.
- Field
Safe Arm - The ARM debug interface over a
FieldSafeProbe. - Field
Safe Memory - AP0 memory through the base’s 32-bit memory commands.
- Field
Safe Probe - The probe: a tagcore
LinkAdaptopened on one base. - Link
Error - A link failure, reported to probe-rs as a probe-specific error.
Constants§
- CHUNK
- Largest single memory transfer, in bytes, as tagcore’s
TagMonitoruses. - L4_DAP 🔒
- STM32L4 (Cortex-M4): SW-DP v1 and an AHB-AP.
- L4_
DBGMCU_ 🔒IDCODE - Address of
DBGMCU_IDCODEon the STM32L4. - PIN_
NRESET 🔒 - nRESET in the
swj_pinsbit map (the CMSIS-DAPDAP_SWJ_Pinslayout probe-rs uses). - U3_DAP 🔒
- STM32U3 (Cortex-M33): SW-DP v2 and an AHB5-AP. AP values read from an
STM32U375 through a base whose
READ_DAP_REGworks. - U3_
DBGMCU_ 🔒IDCODE - Address of
DBGMCU_IDCODEon the STM32U3.
Functions§
- addr32 🔒
- Narrows a probe-rs 64-bit address to the 32-bit address the base takes.
- link_
err 🔒 - Wraps a failed step, named by
what, as a probe-rs [DebugProbeError::ProbeSpecific]. - plausible 🔒
- Reports whether an
IDCODEread looks real: a device ID (low 12 bits) of all zeros or all ones is what a wrong address or a failed bus returns.