Skip to content

Bump cortex-m, improve order of operations in configure #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ignore enters and exits relating to the `ThreadMode` interrupt: RTIC always executes tasks in handler mode and then returns to `ThreadMode` on `cortex_m::asm::wfi()`.
- Bumped `itm` to v0.7.0 with its `"serial"` feature; the latter used to configure a TTY source.
- Emit a warning if a DWT watch address used for software task tracing is read. Such an address should only ever be written to. This error would indicate that something has gone very wrong.
- Crate documentation for `rtic-scope-frontend-dummy`, `cortex-m-rtic-trace`, and `rtic-scope-api` which is now the same as `README.md` used for the organization documentation but with a small header summarizing the crate.
- Bumped `cortex-m`, ensuring additional target support verification during `cortex_m_rtic_trace::configure`.

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ members = [

[patch.crates-io]
include_dir = { version = "0.6.3-alpha.0", git = "https://github.com/tmplt/include_dir.git", branch = "feat/extract-overwrite" }
cortex-m = { version = "0.7", git = "https://github.com/rtic-scope/cortex-m", branch = "rtic-scope" }
2 changes: 1 addition & 1 deletion cargo-rtic-scope/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include_dir = "0.6.3-alpha.0"
libloading = "0.7"
rtic-syntax = "1.0.0"
tempfile = "3"
cortex-m = { version = "0.7", git = "https://github.com/rtic-scope/cortex-m", branch = "rtic-scope", default-features = false, features = ["serde", "std"]}
cortex-m = { version = "0.7", default-features = false, features = ["serde", "std"]}

# Probe support
probe-rs = { version = "0.12", git = "https://github.com/rtic-scope/probe-rs.git", branch = "feat/swo-read" }
Expand Down
2 changes: 1 addition & 1 deletion cortex-m-rtic-trace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ homepage = "https://github.com/rtic-scope/cortex-m-rtic-trace"
license = "MIT OR Apache-2.0"

[dependencies]
cortex-m = { version = "0.7.3", git = "https://github.com/rtic-scope/cortex-m.git", branch = "rtic-scope" }
cortex-m = "0.7.3"
rtic-trace-macros = { path = "macros", version = "0.0.0" }
15 changes: 9 additions & 6 deletions cortex-m-rtic-trace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use cortex_m::peripheral::{
self as Core,
dwt::{AccessType, ComparatorAddressSettings, ComparatorFunction, EmitOption},
itm::ITMSettings,
itm::ITMConfiguration,
};
pub use cortex_m::peripheral::{
itm::{GlobalTimestampOptions, ITMConfigurationError, LocalTimestampOptions, TimestampClkSrc},
Expand Down Expand Up @@ -106,22 +106,25 @@ pub fn configure(
}
}

// Configure DCB, TPIU, DWT, ITM for hardware task tracing.
// Globally enable DWT and ITM features
dcb.enable_trace();

tpiu.set_swo_baud_rate(config.tpiu_freq, config.tpiu_baud);
tpiu.set_trace_output_protocol(config.protocol);
tpiu.enable_continuous_formatting(false); // drop ETM packets
dwt.enable_exception_tracing();
itm.unlock();
itm.configure(ITMSettings {

itm.configure(ITMConfiguration {
enable: true, // ITMENA: master enable
forward_dwt: true, // TXENA: forward DWT packets
local_timestamps: config.delta_timestamps,
global_timestamps: config.absolute_timestamps,
bus_id: None, // only a single trace source is currently supported
bus_id: Some(1), // only a single trace source is currently supported
timestamp_clk_src: config.timestamp_clk_src,
})?;

// Enable hardware task tracing
dwt.enable_exception_tracing();

// Configure DWT comparators for software task tracing.
let enter_addr: u32 = unsafe { &WATCH_VARIABLE_ENTER.id as *const _ } as u32;
let exit_addr: u32 = unsafe { &WATCH_VARIABLE_EXIT.id as *const _ } as u32;
Expand Down