|
| 1 | +#![allow(rustdoc::bare_urls)] |
| 2 | +//! Auxilliary target-side crate for RTIC Scope configuration. |
| 3 | +#![doc = include_str!("../../docs/profile/README.md")] |
1 | 4 | #![no_std]
|
2 |
| -//! This crate exposes functionality that eases the procedure of |
3 |
| -//! enabling tracing for embedded applications written using |
4 |
| -//! [RTIC](https://rtic.rs). A single function, [`configure`], is |
5 |
| -//! exposed that configures all relevant peripherals to trace software |
6 |
| -//! and hardware tasks. After [`configure`] has been called all hardware |
7 |
| -//! tasks will be traced. To trace software tasks each software task |
8 |
| -//! must also be decorated with the [`#[trace]`](trace) macro. See the |
9 |
| -//! below example: |
10 |
| -//! |
11 |
| -//! ```ignore |
12 |
| -//! #[rtic::app(device = stm32f4::stm32f401, dispatchers = [EXTI1])] |
13 |
| -//! mod app { |
14 |
| -//! use cortex_m_rtic_trace::{ |
15 |
| -//! self, |
16 |
| -//! trace, |
17 |
| -//! TraceConfiguration, |
18 |
| -//! LocalTimestampOptions, |
19 |
| -//! GlobalTimestampOptions, |
20 |
| -//! TimestampClkSrc, |
21 |
| -//! TraceProtocol |
22 |
| -//! }; |
23 |
| -//! use stm32f4::stm32f401::Interrupt; |
24 |
| -//! |
25 |
| -//! #[shared] |
26 |
| -//! struct Shared {} |
27 |
| -//! |
28 |
| -//! #[local] |
29 |
| -//! struct Local {} |
30 |
| -//! |
31 |
| -//! #[init] |
32 |
| -//! fn init(mut ctx: init::Context) -> (Shared, Local, init::Monotonics) { |
33 |
| -//! cortex_m_rtic_trace::configure( |
34 |
| -//! &mut ctx.core.DCB, |
35 |
| -//! &mut ctx.core.TPIU, |
36 |
| -//! &mut ctx.core.DWT, |
37 |
| -//! &mut ctx.core.ITM, |
38 |
| -//! 1, // task enter DWT comparator ID |
39 |
| -//! 2, // task exit DWT comparator ID |
40 |
| -//! &TraceConfiguration { |
41 |
| -//! delta_timestamps: LocalTimestampOptions::Enabled, |
42 |
| -//! absolute_timestamps: GlobalTimestampOptions::Disabled, |
43 |
| -//! timestamp_clk_src: TimestampClkSrc::AsyncTPIU, |
44 |
| -//! tpiu_freq: 16_000_000, // Hz |
45 |
| -//! tpiu_baud: 115_200, // B/s |
46 |
| -//! protocol: TraceProtocol::AsyncSWONRZ, |
47 |
| -//! } |
48 |
| -//! ).unwrap(); |
49 |
| -//! |
50 |
| -//! rtic::pend(Interrupt::EXTI0); |
51 |
| -//! (Shared {}, Local {}, init::Monotonics()) |
52 |
| -//! } |
53 |
| -//! |
54 |
| -//! // This hardware task is traced by calling configure above in init. |
55 |
| -//! #[task(binds = EXTI0, priority = 1)] |
56 |
| -//! fn hardware_task(_: hardware_task::Context) { |
57 |
| -//! software_task::spawn().unwrap(); |
58 |
| -//! } |
59 |
| -//! |
60 |
| -//! // This software task is traced by calling configure above in init and by |
61 |
| -//! //decorating it with #[trace]. |
62 |
| -//! #[task] |
63 |
| -//! #[trace] |
64 |
| -//! fn software_task(_: software_task::Context) { |
65 |
| -//! } |
66 |
| -//! } |
67 |
| -//! ``` |
| 5 | + |
68 | 6 | use cortex_m::peripheral::{
|
69 | 7 | self as Core,
|
70 | 8 | dwt::{AccessType, ComparatorAddressSettings, ComparatorFunction, EmitOption},
|
|
0 commit comments