Skip to content

Commit 4fe3f11

Browse files
Brandon Matthewsthenewwazoo
Brandon Matthews
authored andcommitted
Add explanatory note about C_DEBUGEN
1 parent d562f76 commit 4fe3f11

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/peripheral/dcb.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ impl DCB {
3434
// unset bit 24 / TRCENA
3535
unsafe { self.demcr.modify(|w| w & !DCB_DEMCR_TRCENA); }
3636

37-
/// Is there a debugger attached?
38-
pub fn is_debugger_attached(&self) -> bool {
39-
self.dhcsr.read() & 0x1 == 1
37+
/// Is there a debugger attached? (see note)
38+
///
39+
/// N.B. This function is [reported not to
40+
/// work](http://web.archive.org/web/20180821191012/https://community.nxp.com/thread/424925#comment-782843)
41+
/// on Cortex-M0 devices. Per the ARM v6-M Architecture Reference Manual, "Access to the DHCSR
42+
/// from software running on the processor is IMPLEMENTATION DEFINED". Indeed, from the
43+
/// [Cortex-M0+ r0p1 Technical Reference Manual](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0484c/BABJHEIG.html), "Note Software cannot access the debug registers."
44+
pub fn is_debugger_attached() -> bool {
45+
unsafe { (*Self::ptr()).dhcsr.read() & 0x1 == 1 }
4046
}
4147
}

0 commit comments

Comments
 (0)