Modality includes a set of plugins to receive Ferrous Systems's defmt(opens new window) data from embedded systems. Data can be imported from a file or collected over RTT via these plugins:
The following describes the default mapping between defmt concepts
and Modality's concepts. See the configuration section for ways to change the
default behavior.
Log messages are represented as events on the default timeline (main), unless using RTOS mode.
Log message details are represented as event attributes at the root
level (e.g. event.level = trace for trace! messages).
Other defmt-specific information is represented as event and timeline attributes with
the prefix event.internal.defmt and timeline.internal.defmt respectively.
Event names will use the log message's formatted string by default, and can be overridden using the
conventions described below.
The plugins will look for a specific convention in order to extract more semantically rich information
from the log messages to produce Modality attribute key/value pairs.
The format string syntax is [<event_name>::][<attr_key>=<attr_val>,...].
When <event_name> is not present, the formatted string is used as the event name.
<attr_val> can be a literal or parameter.
<attr_val> only supports primitive types (e.g. integer/string/etc)
For example, the statement defmt::info!("my_event::k0={=u8},k1=something,k2={=str}", 2, "foo");
will produce an event with the following attributes (not exhaustive):
The plugins can be configured to look for RTOS-specific instrumentation to determine
task/ISR contexts and interactions.
Currently the only supported RTOS mode is rtic1.
It requires using our RTIC fork(opens new window)
(based on version 1.1.4) with trace instrumentation.
You can try it out by adding the following to your Cargo.toml:
Configuration fields should be placed in a [plugins.ingest.importers.defmt.metadata] or
[plugins.ingest.collectors.defmt-rtt.metadata] table in
a modality-reflector configuration file.
All fields are optional.
# config.toml for modality-reflector[plugins.ingest.collectors.defmt-rtt.metadata]init-task-name='init'attach-timeout="10s"chip='S32K344'chip-description-path="/tmp/S32K_Series.yaml"protocol='swd'core=0reset=truertos-mode='rtic1'elf-file='firmware.elf'control-block-address=0xE50000