swd-probe¶
CLI reference¶
glasgow run swd-probe¶
At the moment, this applet does not include any high-level functionality. It only offers very low-level access to the target via the REPL or script interface.
Use the probe-rs applet to debug and program Arm microcontrollers.
usage: glasgow run swd-probe [-h] [-V VOLTS] [--swclk PIN] [--swdio PIN]
[-f FREQ]
OPERATION ...
- -h, --help¶
show this help message and exit
- -V <volts>, --voltage <volts>¶
target power (voltage reference of the interface) (range: 1.8..5 V, or ‘S<port>’ to follow the voltage sensed on a port; default: unchanged)
- --swclk <pin>¶
bind serial wire clock to PIN (default: ‘A0’, required)
- --swdio <pin>¶
bind serial wire data to PIN (default: ‘A1’, required)
- -f <freq>, --frequency <freq>¶
set SWCLK frequency to FREQ kHz (default: 1000)
glasgow run swd-probe dump-memory¶
usage: glasgow run swd-probe dump-memory [-h] [-f FILENAME] [--ap INDEX]
ADDRESS LENGTH
- address¶
start at ADDRESS
- length¶
dump LENGTH bytes
- -h, --help¶
show this help message and exit
- -f <filename>, --file <filename>¶
dump contents to FILENAME
- --ap <index>¶
access memory via MEM-AP #INDEX
API reference¶
- exception glasgow.applet.interface.swd_probe.SWDProbeException(kind: Kind = Kind.Other, *, address: int | None = None, message: str | None = None)¶
- class glasgow.applet.interface.swd_probe.SWDProbePorts(*, supply: glasgow.abstract.GlasgowSupply, swclk: amaranth.lib.io.PortLike, swdio: amaranth.lib.io.PortLike)¶
- supply: GlasgowSupply¶
target power (voltage reference of the interface)
- swclk: PortLike¶
serial wire clock
- swdio: PortLike¶
serial wire data
- class glasgow.applet.interface.swd_probe.SWDProbeInterface(logger: Logger, assembly: AbstractAssembly, ports: SWDProbePorts)¶
- property clock: ClockDivisor¶
SWCLK clock divisor.
- async line_reset()¶
Perform a line reset sequence.
- async jtag_to_swd_v1()¶
Perform a DPv1 JTAG-to-SWD switch sequence.
- async jtag_to_swd_v2()¶
Perform a DPv2 JTAG-to-SWD switch sequence.
This sequence consists of a JTAG-to-dormant, Selection Alert, and dormant-to-SWD sub-sequences.
- async dp_read(reg: int) int¶
Read from DP register
reg, switching the DP bank if necessary.- Raises:
SWDProbeException – On communication error.
- async dp_write(reg: int, data: int)¶
Write
datato DP registerreg, switching the DP bank if necessary.- Raises:
SWDProbeException – On communication error.
- async ap_read(ap: int, reg: int) int¶
Read from AP
apregisterreg, switching the AP and AP bank if necessary.- Raises:
SWDProbeException – On communication error.
- async ap_read_block(ap: int, reg: int, count: int) list[int]¶
Read from AP
apregisterregcounttimes, switching the AP and AP bank if necessary.The AP reads are pipelined, making this method significantly faster than calling
ap_read()counttimes.- Raises:
SWDProbeException – On communication error.
- async ap_write(ap: int, reg: int, data: int)¶
Write
datato APapregisterreg, switching the AP and AP bank if necessary.- Raises:
SWDProbeException – On communication error.
- async initialize(CSYSPWRUP: bool = False) DP_DPIDR¶
Initialize the SW-DP or SWJ-DP.
The initialization process is:
Perform a DPv2 JTAG-to-SWD switch sequence, as in
jtag_to_swd_v2().Perform a DPv1 JTAG-to-SWD switch sequence, as in
jtag_to_swd_v1().Perform a line reset and read
DPIDRto start SWD communication.Write
DP_ABORTto clear all errors.Write
CTRL_STATto request debug power-up.Read
CTRL_STATto ensure acknowledge of debug power-up.If :py:`CSYSPWRUP`: Write
CTRL_STATto request system power-up.If :py:`CSYSPWRUP`: Read
CTRL_STATto ensure acknowledge of system power-up.
- Raises:
SWDProbeException – On communication error, or if a power-up request isn’t acknowledged.
- async iter_aps() AsyncIterator[tuple[int, AP_IDR]]¶
Iterate available APs.
Yields 2-tuples
(ap, ap_idr)whereapis the AP index andap_idris the value of theIDRregister.- Raises:
SWDProbeException – On communication error.
- async mem_ap_read_word(ap: int, addr: int)¶
Read a word via a MEM-AP.
Reads the 32-bit value from
addrvia MEM-APap.Note that transfers via a MEM-AP may silently fail under certain conditions, e.g. if the CPU core has not been halted.
- Raises:
SWDProbeException – On communication error.
- async mem_ap_write_word(ap: int, addr: int, data: int)¶
Read a word via a MEM-AP.
Writes the 32-bit value
datatoaddrvia MEM-APap.Note that transfers via a MEM-AP may silently fail under certain conditions, e.g. if the CPU core has not been halted.
- Raises:
SWDProbeException – On communication error.