pub trait CoreInterface: MemoryInterface + CoreMemoryInterfaceShim {
Show 34 methods
// Required 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<(), Error>;
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 CoreRegisters;
fn program_counter(&self) -> &'static CoreRegister;
fn frame_pointer(&self) -> &'static CoreRegister;
fn stack_pointer(&self) -> &'static CoreRegister;
fn return_address(&self) -> &'static CoreRegister;
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 floating_point_register_count(&mut self) -> Result<usize, Error>;
fn reset_catch_set(&mut self) -> Result<(), Error>;
fn reset_catch_clear(&mut self) -> Result<(), Error>;
fn debug_core_stop(&mut self) -> Result<(), Error>;
// Provided methods
fn debug_on_sw_breakpoint(&mut self, _enabled: bool) -> Result<(), Error> { ... }
fn on_session_stop(&mut self) -> Result<(), Error> { ... }
fn enable_vector_catch(
&mut self,
_condition: VectorCatchCondition,
) -> Result<(), Error> { ... }
fn disable_vector_catch(
&mut self,
_condition: VectorCatchCondition,
) -> Result<(), Error> { ... }
fn is_64_bit(&self) -> bool { ... }
}
Expand description
A generic interface to control a MCU core.
Required Methods§
Sourcefn wait_for_core_halted(&mut self, timeout: Duration) -> Result<(), Error>
fn wait_for_core_halted(&mut self, timeout: Duration) -> Result<(), Error>
Wait until the core is halted. If the core does not halt on its own,
a DebugProbeError::Timeout
error will be returned.
Sourcefn 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.
Sourcefn status(&mut self) -> Result<CoreStatus, Error>
fn status(&mut self) -> Result<CoreStatus, Error>
Returns the current status of the core.
Sourcefn halt(&mut self, timeout: Duration) -> Result<CoreInformation, Error>
fn halt(&mut self, timeout: Duration) -> Result<CoreInformation, Error>
Try to halt the core. This function ensures the core is actually halted, and
returns a DebugProbeError::Timeout
otherwise.
Sourcefn reset(&mut self) -> Result<(), Error>
fn reset(&mut self) -> Result<(), Error>
Reset the core, and then continue to execute instructions. If the core
should be halted after reset, use the reset_and_halt
function.
Sourcefn 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.
Sourcefn step(&mut self) -> Result<CoreInformation, Error>
fn step(&mut self) -> Result<CoreInformation, Error>
Steps one instruction and then enters halted state again.
Sourcefn 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.
Sourcefn write_core_reg(
&mut self,
address: RegisterId,
value: RegisterValue,
) -> Result<(), Error>
fn write_core_reg( &mut self, address: RegisterId, value: RegisterValue, ) -> Result<(), Error>
Write the value of a core register.
Sourcefn 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.
Sourcefn hw_breakpoints(&mut self) -> Result<Vec<Option<u64>>, Error>
fn hw_breakpoints(&mut self) -> Result<Vec<Option<u64>>, Error>
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.
Sourcefn enable_breakpoints(&mut self, state: bool) -> Result<(), Error>
fn enable_breakpoints(&mut self, state: bool) -> Result<(), Error>
Enables breakpoints on this core. If a breakpoint is set, it will halt as soon as it is hit.
Sourcefn set_hw_breakpoint(
&mut self,
unit_index: usize,
addr: u64,
) -> Result<(), Error>
fn set_hw_breakpoint( &mut self, unit_index: usize, addr: u64, ) -> Result<(), Error>
Sets a breakpoint at addr
. It does so by using unit bp_unit_index
.
Sourcefn clear_hw_breakpoint(&mut self, unit_index: usize) -> Result<(), Error>
fn clear_hw_breakpoint(&mut self, unit_index: usize) -> Result<(), Error>
Clears the breakpoint configured in unit unit_index
.
Sourcefn registers(&self) -> &'static CoreRegisters
fn registers(&self) -> &'static CoreRegisters
Returns a list of all the registers of this core.
Sourcefn program_counter(&self) -> &'static CoreRegister
fn program_counter(&self) -> &'static CoreRegister
Returns the program counter register.
Sourcefn frame_pointer(&self) -> &'static CoreRegister
fn frame_pointer(&self) -> &'static CoreRegister
Returns the stack pointer register.
Sourcefn stack_pointer(&self) -> &'static CoreRegister
fn stack_pointer(&self) -> &'static CoreRegister
Returns the frame pointer register.
Sourcefn return_address(&self) -> &'static CoreRegister
fn return_address(&self) -> &'static CoreRegister
Returns the return address register, a.k.a. link register.
Sourcefn hw_breakpoints_enabled(&self) -> bool
fn hw_breakpoints_enabled(&self) -> bool
Returns true
if hardware breakpoints are enabled, false
otherwise.
Sourcefn architecture(&self) -> Architecture
fn architecture(&self) -> Architecture
Get the Architecture
of the Core.
Sourcefn 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
Sourcefn 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.
Sourcefn floating_point_register_count(&mut self) -> Result<usize, Error>
fn floating_point_register_count(&mut self) -> Result<usize, Error>
Determine the number of floating point registers. This must be queried while halted as this is a runtime decision for some core types.
Sourcefn reset_catch_set(&mut self) -> Result<(), Error>
fn reset_catch_set(&mut self) -> Result<(), Error>
Set the reset catch setting.
This configures the core to halt after a reset.
use reset_catch_clear
to clear the setting again.
Sourcefn reset_catch_clear(&mut self) -> Result<(), Error>
fn reset_catch_clear(&mut self) -> Result<(), Error>
Clear the reset catch setting.
This will reset the changes done by reset_catch_set
.
Sourcefn debug_core_stop(&mut self) -> Result<(), Error>
fn debug_core_stop(&mut self) -> Result<(), Error>
Called when we stop debugging a core.
Provided Methods§
Sourcefn debug_on_sw_breakpoint(&mut self, _enabled: bool) -> Result<(), Error>
fn debug_on_sw_breakpoint(&mut self, _enabled: bool) -> Result<(), Error>
Configure the target to ensure software breakpoints will enter Debug Mode.
Sourcefn on_session_stop(&mut self) -> Result<(), Error>
fn on_session_stop(&mut self) -> Result<(), Error>
Called during session stop to do any pending cleanup
Sourcefn enable_vector_catch(
&mut self,
_condition: VectorCatchCondition,
) -> Result<(), Error>
fn enable_vector_catch( &mut self, _condition: VectorCatchCondition, ) -> Result<(), Error>
Enables vector catching for the given condition
Sourcefn disable_vector_catch(
&mut self,
_condition: VectorCatchCondition,
) -> Result<(), Error>
fn disable_vector_catch( &mut self, _condition: VectorCatchCondition, ) -> Result<(), Error>
Disables vector catching for the given condition