Skip to content

Commit

Permalink
Merge #346
Browse files Browse the repository at this point in the history
346: Add pre-requisites for enabling the cycle counter to docs r=adamgreig a=newAM

I think adding a note here about per-requisites for the cycle counter is a good idea.

Reference: https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Exception-and-Monitor-Control-Register--DEMCR?lang=en#BCGJGAGC

This may just be a me issue, I always forget to set the global trace enable when I go to use the cycle counter.  Feel free to close if you think this is a non-issue.

Co-authored-by: Alex Martens <[email protected]>
  • Loading branch information
bors[bot] and newAM authored Jul 25, 2021
2 parents 45e7ab7 + 7042622 commit ea91f18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/peripheral/dwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ pub struct Comparator {

impl DWT {
/// Enables the cycle counter
///
/// The global trace enable ([`DCB::enable_trace`]) should be set before
/// enabling the cycle counter, the processor may ignore writes to the
/// cycle counter enable if the global trace is disabled
/// (implementation defined behaviour).
///
/// [`DCB::enable_trace`]: crate::peripheral::DCB::enable_trace
#[cfg(not(armv6m))]
#[inline]
pub fn enable_cycle_counter(&mut self) {
Expand Down

0 comments on commit ea91f18

Please sign in to comment.