Crates.io | rtos-trace |
lib.rs | rtos-trace |
version | 0.1.3 |
source | src |
created_at | 2022-07-11 14:04:11.683137 |
updated_at | 2022-08-18 05:44:08.312999 |
description | RTOS tracing trait. |
homepage | https://bern-rtos.org |
repository | https://gitlab.com/bern-rtos/tools/rtos-trace |
max_upload_size | |
id | 623830 |
size | 13,284 |
rtos-trace
Set of traits used to trace RTOS internals.
trace_impl
: Activates tracing function (on by default). Can be used by
the RTOS to deactivate tracing.The backend is required implement RtosTrace
.
Existing implementation:
The RTOS can implement RtosTraceOSCallbacks
to provide additional
information upon request from the tracing software. For example:
rtos_trace::global_os_callbacks!{Scheduler}
impl rtos_trace::RtosTraceOSCallbacks for Scheduler {
fn task_list() {
/*..*/
for task in tasks.iter() {
trace::task_send_info(task.id(), task.info());
}
}
/*..*/
}
Usage for the RTOS maintainer is simple:
use rtos_trace::{RtosTrace, trace}
pub fn spawn_task(/*..*/) {
/*..*/
trace::task_new(task_id);
}
Similar to a global logger the user must provide a tracing backend, i.e.:
use systemview_target::SystemView;
rtos_trace::global_trace!{SystemView}
The user can implement [RtosTraceApplicationCallbacks
] to provide
additional information upon request from the tracing software. For example:
struct Application;
rtos_trace::global_application_callbacks!{Application}
impl rtos_trace::RtosTraceApplicationCallbacks for Application {
fn system_description() {
systemview_target::send_system_desc_app_name!("Espresso Machine");
systemview_target::send_system_desc_device!("STM32F769NI");
systemview_target::send_system_desc_core!("Cortex-M7");
systemview_target::send_system_desc_os!("Bern RTOS");
systemview_target::send_system_desc_interrupt!(15, "SysTick");
}
/*..*/
}