rtic-scope / itm-decode

A library for decoding ARM Cortex-M ITM and DWT packets
https://docs.rs/itm-decode/*/itm_decode/index.html
Apache License 2.0
1 stars 2 forks source link

Handle bookkeeping of instrumentation extension packets #19

Open tmplt opened 2 years ago

tmplt commented 2 years ago

TracePacket::Extension-logic is non-trivial. From the reference documentation one finds the port of the payload bytes via id = (page * 32) + port where page is from the extension packet and port is from the instrumentation packet. However, the document (D4.2.8) also says

Whenever a debugger receives an Instrumentation packet, it uses the page number from the last Extension packet it received, or a page number of 0 if it has not received an Extension packet since it last received a Synchronization.

itm-decode should handle this and yield complete messages to the end-user.

tmplt commented 2 years ago

How should this functionality be exposed to the user? Via another Decoder::pull variant?

tmplt commented 2 years ago

A better idea would perhaps be to change the API to a single pull function. This function could return an enum { ITMPacket(TracePacket), MetaPacket(TimestampedTracePacket, CompleteStimMessage) } or something similar. The decoder can then be configured via some Decoder::{group_with_timestamps, complete_stim_strings}(bool).

tmplt commented 2 years ago

When #20 closes, this issue should be moved to https://github.com/rust-embedded/itm.