2 releases

0.1.3 Aug 18, 2022
0.1.2 Jul 11, 2022
0.1.1 Jul 11, 2022
0.1.0 Jul 11, 2022

#1639 in Embedded development

Download history 15/week @ 2024-04-12 20/week @ 2024-04-19 31/week @ 2024-04-26 25/week @ 2024-05-03 31/week @ 2024-05-10 17/week @ 2024-05-17 26/week @ 2024-05-24 29/week @ 2024-05-31 19/week @ 2024-06-07 21/week @ 2024-06-14 28/week @ 2024-06-21 19/week @ 2024-06-28 35/week @ 2024-07-05 26/week @ 2024-07-12 28/week @ 2024-07-19 38/week @ 2024-07-26

128 downloads per month
Used in 3 crates

MIT license

14KB
231 lines

rtos-trace

Set of traits used to trace RTOS internals.

Features

  • trace_impl: Activates tracing function (on by default). Can be used by the RTOS to deactivate tracing.

Implementation

The backend is required implement RtosTrace.

Existing implementation:

Usage

RTOS

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);
}

Application

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");
    }
    /*..*/
}

No runtime deps

Features