Merge pull request #300 from dnadlinger/always-trcena

hardware: Enable DEMCR TRCENA on boot for cycle counter
This commit is contained in:
Ryan Summers 2021-03-09 13:30:29 +01:00 committed by GitHub
commit 0b966b2627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -825,6 +825,14 @@ pub fn setup(
None
};
let cycle_counter = {
// Set TRCENA bit, which is required for DWT counter to tick. (This is also
// set automatically when running in the debugger, and only cleared on power
// reset, not on soft reset.)
core.DCB.enable_trace();
CycleCounter::new(core.DWT, ccdr.clocks.c_ck())
};
let stabilizer = StabilizerDevices {
afes,
adcs,
@ -833,7 +841,7 @@ pub fn setup(
net: network_devices,
adc_dac_timer: sampling_timer,
timestamp_timer,
cycle_counter: CycleCounter::new(core.DWT, ccdr.clocks.c_ck()),
cycle_counter,
};
// info!("Version {} {}", build_info::PKG_VERSION, build_info::GIT_VERSION.unwrap());