pub struct Session { /* private fields */ }
Expand description

The Session struct represents an active debug session.

Creating a session

The session can be created by calling the Session::auto_attach() function, which tries to automatically select a probe, and then connect to the target.

For more control, the Probe::attach() and Probe::attach_under_reset() methods can be used to open a Session from a specific Probe.

Usage

The Session is the common handle that gives a user exclusive access to an active probe. You can create and share a session between threads to enable multiple stakeholders (e.g. GDB and RTT) to access the target taking turns, by using Arc<Mutex<Session>>.

If you do so, make sure that both threads sleep in between tasks such that other stakeholders may take their turn.

To get access to a single Core from the Session, the Session::core() method can be used. Please see the Session::core() method for more usage guidelines.

Implementations

Automatically creates a session with the first connected probe found.

Lists the available cores with their number and their type.

Attaches to the core with the given number.

Usage

Everytime you want to perform an operation on the chip, you need to get the Core handle with the Session::core() method. This Core handle is merely a view into the core and provides a convenient API surface.

All the state is stored in the Session handle.

The first time you call Session::core() for a specific core, it will run the attach/init sequences and return a handle to the Core.

Every subsequent call is a no-op. It simply returns the handle for the user to use in further operations without calling any int sequences again.

It is strongly advised to never store the Core handle for any significant duration! Free it as fast as possible such that other stakeholders can have access to the Core too.

The idea behind this is: You need the smallest common denominator which you can share between threads. Since you sometimes need the Core, sometimes the Probe or sometimes the Target, the Session is the only common ground and the only handle you should actively store in your code.

Read available data from the SWO interface without waiting.

This method is only supported for ARM-based targets, and will return Error::ArchitectureRequired otherwise.

Returns an implementation of std::io::Read that wraps SwoAccess::read_swo.

The implementation buffers all available bytes from SwoAccess::read_swo on each std::io::Read::read, minimizing the chance of a target-side overflow event on which trace packets are lost.

Get the Arm probe interface.

Reads all the available ARM CoresightComponents of the currently attached target.

This will recursively parse the Romtable of the attached target and create a list of all the contained components.

Get the target description of the connected target.

Configure the target and probe for serial wire view (SWV) tracing.

Configure the target to stop emitting SWV trace data.

Begin tracing a memory address over SWV.

Stop tracing from a given SWV unit

👎 Deprecated:

Use the Session::target function instead

Returns the memory map of the target.

Return the Architecture of the currently connected chip.

Clears all hardware breakpoints on all cores

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.