Trait probe_rs::CoreInterface
source · [−]pub trait CoreInterface: MemoryInterface {
Show 22 methods
fn wait_for_core_halted(&mut self, timeout: Duration) -> Result<(), Error>;
fn core_halted(&mut self) -> Result<bool, Error>;
fn status(&mut self) -> Result<CoreStatus, Error>;
fn halt(&mut self, timeout: Duration) -> Result<CoreInformation, Error>;
fn run(&mut self) -> Result<(), Error>;
fn reset(&mut self) -> Result<(), Error>;
fn reset_and_halt(
&mut self,
timeout: Duration
) -> Result<CoreInformation, Error>;
fn step(&mut self) -> Result<CoreInformation, Error>;
fn read_core_reg(
&mut self,
address: RegisterId
) -> Result<RegisterValue, Error>;
fn write_core_reg(
&mut self,
address: RegisterId,
value: RegisterValue
) -> Result<()>;
fn available_breakpoint_units(&mut self) -> Result<u32, Error>;
fn hw_breakpoints(&mut self) -> Result<Vec<Option<u64>>, Error>;
fn enable_breakpoints(&mut self, state: bool) -> Result<(), Error>;
fn set_hw_breakpoint(
&mut self,
unit_index: usize,
addr: u64
) -> Result<(), Error>;
fn clear_hw_breakpoint(&mut self, unit_index: usize) -> Result<(), Error>;
fn registers(&self) -> &'static RegisterFile;
fn hw_breakpoints_enabled(&self) -> bool;
fn architecture(&self) -> Architecture;
fn core_type(&self) -> CoreType;
fn instruction_set(&mut self) -> Result<InstructionSet, Error>;
fn fpu_support(&mut self) -> Result<bool, Error>;
fn on_session_stop(&mut self) -> Result<(), Error> { ... }
}
Expand description
A generic interface to control a MCU core.
Required Methods
Wait until the core is halted. If the core does not halt on its own,
a DebugProbeError::Timeout
error will be returned.
fn core_halted(&mut self) -> Result<bool, Error>
fn core_halted(&mut self) -> Result<bool, Error>
Check if the core is halted. If the core does not halt on its own,
a DebugProbeError::Timeout
error will be returned.
fn status(&mut self) -> Result<CoreStatus, Error>
fn status(&mut self) -> Result<CoreStatus, Error>
Returns the current status of the core.
Try to halt the core. This function ensures the core is actually halted, and
returns a DebugProbeError::Timeout
otherwise.
Reset the core, and then continue to execute instructions. If the core
should be halted after reset, use the reset_and_halt
function.
fn reset_and_halt(&mut self, timeout: Duration) -> Result<CoreInformation, Error>
fn reset_and_halt(&mut self, timeout: Duration) -> Result<CoreInformation, Error>
Reset the core, and then immediately halt. To continue execution after
reset, use the reset
function.
fn step(&mut self) -> Result<CoreInformation, Error>
fn step(&mut self) -> Result<CoreInformation, Error>
Steps one instruction and then enters halted state again.
fn read_core_reg(&mut self, address: RegisterId) -> Result<RegisterValue, Error>
fn read_core_reg(&mut self, address: RegisterId) -> Result<RegisterValue, Error>
Read the value of a core register.
fn write_core_reg(
&mut self,
address: RegisterId,
value: RegisterValue
) -> Result<()>
fn write_core_reg(
&mut self,
address: RegisterId,
value: RegisterValue
) -> Result<()>
Write the value of a core register.
fn available_breakpoint_units(&mut self) -> Result<u32, Error>
fn available_breakpoint_units(&mut self) -> Result<u32, Error>
Returns all the available breakpoint units of the core.
Read the hardware breakpoints from FpComp registers, and adds them to the Result Vector. A value of None in any position of the Vector indicates that the position is unset/available. We intentionally return all breakpoints, irrespective of whether they are enabled or not.
Enables breakpoints on this core. If a breakpoint is set, it will halt as soon as it is hit.
Sets a breakpoint at addr
. It does so by using unit bp_unit_index
.
Clears the breakpoint configured in unit unit_index
.
fn registers(&self) -> &'static RegisterFile
fn registers(&self) -> &'static RegisterFile
Returns a list of all the registers of this core.
fn hw_breakpoints_enabled(&self) -> bool
fn hw_breakpoints_enabled(&self) -> bool
Returns true
if hwardware breakpoints are enabled, false
otherwise.
fn architecture(&self) -> Architecture
fn architecture(&self) -> Architecture
Get the Architecture
of the Core.
fn instruction_set(&mut self) -> Result<InstructionSet, Error>
fn instruction_set(&mut self) -> Result<InstructionSet, Error>
Determine the instruction set the core is operating in This must be queried while halted as this is a runtime decision for some core types
fn fpu_support(&mut self) -> Result<bool, Error>
fn fpu_support(&mut self) -> Result<bool, Error>
Determine if an FPU is present. This must be queried while halted as this is a runtime decision for some core types.
Provided Methods
fn on_session_stop(&mut self) -> Result<(), Error>
fn on_session_stop(&mut self) -> Result<(), Error>
Called during session stop to do any pending cleanup