pub trait DebugProbe: Send + Debug {
Show 25 methods
// Required methods
fn get_name(&self) -> &str;
fn speed_khz(&self) -> u32;
fn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>;
fn set_scan_chain(
&mut self,
scan_chain: Vec<ScanChainElement>,
) -> Result<(), DebugProbeError>;
fn scan_chain(&self) -> Result<&[ScanChainElement], DebugProbeError>;
fn attach(&mut self) -> Result<(), DebugProbeError>;
fn detach(&mut self) -> Result<(), Error>;
fn target_reset(&mut self) -> Result<(), DebugProbeError>;
fn target_reset_assert(&mut self) -> Result<(), DebugProbeError>;
fn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>;
fn select_protocol(
&mut self,
protocol: WireProtocol,
) -> Result<(), DebugProbeError>;
fn active_protocol(&self) -> Option<WireProtocol>;
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>;
// Provided methods
fn select_jtag_tap(&mut self, index: usize) -> Result<(), DebugProbeError> { ... }
fn has_arm_interface(&self) -> bool { ... }
fn try_get_arm_interface<'probe>(
self: Box<Self>,
) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)> { ... }
fn try_get_riscv_interface_builder<'probe>(
&'probe mut self,
) -> Result<Box<dyn RiscvInterfaceBuilder<'probe> + 'probe>, DebugProbeError> { ... }
fn has_riscv_interface(&self) -> bool { ... }
fn try_get_xtensa_interface<'probe>(
&'probe mut self,
_state: &'probe mut XtensaDebugInterfaceState,
) -> Result<XtensaCommunicationInterface<'probe>, DebugProbeError> { ... }
fn has_xtensa_interface(&self) -> bool { ... }
fn get_swo_interface(&self) -> Option<&dyn SwoAccess> { ... }
fn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess> { ... }
fn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe> { ... }
fn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError> { ... }
fn try_into_jlink(&mut self) -> Result<&mut JLink, DebugProbeError> { ... }
}
Expand description
An abstraction over general debug probe.
This trait has to be implemented by ever debug probe driver.
Required Methods§
Sourcefn speed_khz(&self) -> u32
fn speed_khz(&self) -> u32
Get the currently used maximum speed for the debug protocol in kHz.
Not all probes report which speed is used, meaning this value is not always the actual speed used. However, the speed should not be any higher than this value.
Sourcefn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>
fn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>
Set the speed in kHz used for communication with the target device.
The desired speed might not be supported by the probe. If the desired speed is not directly supported, a lower speed will be selected if possible.
If possible, the actual speed used is returned by the function. Some probes cannot report this, so the value may be inaccurate.
If the requested speed is not supported,
DebugProbeError::UnsupportedSpeed
will be returned.
Sourcefn set_scan_chain(
&mut self,
scan_chain: Vec<ScanChainElement>,
) -> Result<(), DebugProbeError>
fn set_scan_chain( &mut self, scan_chain: Vec<ScanChainElement>, ) -> Result<(), DebugProbeError>
Set the JTAG scan chain information for the target under debug.
This allows the probe to know which TAPs are in the scan chain and their position and IR lengths.
If the scan chain is provided, and the selected protocol is JTAG, the probe will automatically configure the JTAG interface to match the scan chain configuration without trying to determine the chain at runtime.
This is called by the Session
when attaching to a target.
So this does not need to be called manually, unless you want to
modify the scan chain. You must be attached to a target to set the
scan_chain since the scan chain only applies to the attached target.
Sourcefn scan_chain(&self) -> Result<&[ScanChainElement], DebugProbeError>
fn scan_chain(&self) -> Result<&[ScanChainElement], DebugProbeError>
Returns the JTAG scan chain
Sourcefn attach(&mut self) -> Result<(), DebugProbeError>
fn attach(&mut self) -> Result<(), DebugProbeError>
Attach to the chip.
This should run all the necessary protocol init routines.
Sourcefn detach(&mut self) -> Result<(), Error>
fn detach(&mut self) -> Result<(), Error>
Detach from the chip.
This should run all the necessary protocol deinit routines.
If the probe uses batched commands, this will also cause all remaining commands to be executed. If an error occurs during this execution, the probe might remain in the attached state.
Sourcefn target_reset(&mut self) -> Result<(), DebugProbeError>
fn target_reset(&mut self) -> Result<(), DebugProbeError>
This should hard reset the target device.
Sourcefn target_reset_assert(&mut self) -> Result<(), DebugProbeError>
fn target_reset_assert(&mut self) -> Result<(), DebugProbeError>
This should assert the reset pin of the target via debug probe.
Sourcefn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>
fn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>
This should deassert the reset pin of the target via debug probe.
Sourcefn select_protocol(
&mut self,
protocol: WireProtocol,
) -> Result<(), DebugProbeError>
fn select_protocol( &mut self, protocol: WireProtocol, ) -> Result<(), DebugProbeError>
Selects the transport protocol to be used by the debug probe.
Sourcefn active_protocol(&self) -> Option<WireProtocol>
fn active_protocol(&self) -> Option<WireProtocol>
Get the transport protocol currently in active use by the debug probe.
Sourcefn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Boxes itself.
Provided Methods§
Sourcefn select_jtag_tap(&mut self, index: usize) -> Result<(), DebugProbeError>
fn select_jtag_tap(&mut self, index: usize) -> Result<(), DebugProbeError>
Selects the JTAG TAP to be used for communication.
Sourcefn has_arm_interface(&self) -> bool
fn has_arm_interface(&self) -> bool
Check if the probe offers an interface to debug ARM chips.
Sourcefn try_get_arm_interface<'probe>(
self: Box<Self>,
) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)>
fn try_get_arm_interface<'probe>( self: Box<Self>, ) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)>
Get the dedicated interface to debug ARM chips. To check that the probe actually supports this, call DebugProbe::has_arm_interface first.
Sourcefn try_get_riscv_interface_builder<'probe>(
&'probe mut self,
) -> Result<Box<dyn RiscvInterfaceBuilder<'probe> + 'probe>, DebugProbeError>
fn try_get_riscv_interface_builder<'probe>( &'probe mut self, ) -> Result<Box<dyn RiscvInterfaceBuilder<'probe> + 'probe>, DebugProbeError>
Try to get a RiscvInterfaceBuilder
object, which can be used to set up a communication
interface with chips using the RISC-V architecture.
Ensure that the probe actually supports this by calling DebugProbe::has_riscv_interface first.
Sourcefn has_riscv_interface(&self) -> bool
fn has_riscv_interface(&self) -> bool
Check if the probe offers an interface to debug RISC-V chips.
Sourcefn try_get_xtensa_interface<'probe>(
&'probe mut self,
_state: &'probe mut XtensaDebugInterfaceState,
) -> Result<XtensaCommunicationInterface<'probe>, DebugProbeError>
fn try_get_xtensa_interface<'probe>( &'probe mut self, _state: &'probe mut XtensaDebugInterfaceState, ) -> Result<XtensaCommunicationInterface<'probe>, DebugProbeError>
Get the dedicated interface to debug Xtensa chips. Ensure that the probe actually supports this by calling DebugProbe::has_xtensa_interface first.
Sourcefn has_xtensa_interface(&self) -> bool
fn has_xtensa_interface(&self) -> bool
Check if the probe offers an interface to debug Xtensa chips.
Sourcefn get_swo_interface(&self) -> Option<&dyn SwoAccess>
fn get_swo_interface(&self) -> Option<&dyn SwoAccess>
Get a SWO interface from the debug probe.
This is not available on all debug probes.
Sourcefn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess>
fn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess>
Get a mutable SWO interface from the debug probe.
This is not available on all debug probes.
Sourcefn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe>
fn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe>
Try creating a DAP interface for the given probe.
This is not available on all probes.
Sourcefn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError>
fn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError>
Reads the target voltage in Volts, if possible. Returns Ok(None)
if the probe doesn’t support reading the target voltage.
Sourcefn try_into_jlink(&mut self) -> Result<&mut JLink, DebugProbeError>
fn try_into_jlink(&mut self) -> Result<&mut JLink, DebugProbeError>
Try to get a J-Link interface from the debug probe.